src/bisection_tree/btfn.rs

branch
dev
changeset 171
fa8df5a14486
parent 166
20fa28637737
child 197
1f301affeae3
equal deleted inserted replaced
170:221728aeeb7e 171:fa8df5a14486
433 V: Sum + ClosedSpace, 433 V: Sum + ClosedSpace,
434 { 434 {
435 type Codomain = V; 435 type Codomain = V;
436 436
437 fn apply<I: Instance<Loc<N, F>>>(&self, x: I) -> Self::Codomain { 437 fn apply<I: Instance<Loc<N, F>>>(&self, x: I) -> Self::Codomain {
438 let xc = x.cow(); 438 let xc = x.decompose();
439 self.bt 439 self.bt
440 .iter_at(&*xc) 440 .iter_at(&*xc)
441 .map(|&d| self.generator.support_for(d).apply(&*xc)) 441 .map(|&d| self.generator.support_for(d).apply(&*xc))
442 .sum() 442 .sum()
443 } 443 }
452 V: Sum + ClosedSpace, 452 V: Sum + ClosedSpace,
453 { 453 {
454 type Derivative = V; 454 type Derivative = V;
455 455
456 fn differential_impl<I: Instance<Loc<N, F>>>(&self, x: I) -> Self::Derivative { 456 fn differential_impl<I: Instance<Loc<N, F>>>(&self, x: I) -> Self::Derivative {
457 let xc = x.cow(); 457 let xc = x.decompose();
458 self.bt 458 self.bt
459 .iter_at(&*xc) 459 .iter_at(&*xc)
460 .map(|&d| self.generator.support_for(d).differential(&*xc)) 460 .map(|&d| self.generator.support_for(d).differential(&*xc))
461 .sum() 461 .sum()
462 } 462 }

mercurial