| 418 self.bt.iter_at(&x) |
418 self.bt.iter_at(&x) |
| 419 .map(|&d| self.generator.support_for(d).apply(x)).sum() |
419 .map(|&d| self.generator.support_for(d).apply(x)).sum() |
| 420 } |
420 } |
| 421 } |
421 } |
| 422 |
422 |
| 423 impl<'a, F : Float, G, BT, V, const N : usize> Differentiable<&'a Loc<F, N>> |
423 impl<'a, F : Float, G, BT, V, W, const N : usize> Differentiable<&'a Loc<F, N>> |
| 424 for BTFN<F, G, BT, N> |
424 for BTFN<F, G, BT, N> |
| 425 where BT : BTImpl<F, N>, |
425 where BT : BTImpl<F, N>, |
| 426 G : SupportGenerator<F, N, Id=BT::Data>, |
426 G : SupportGenerator<F, N, Id=BT::Data>, |
| 427 G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<&'a Loc<F, N>, Output = V>, |
427 G::SupportType : LocalAnalysis<F, BT::Agg, N> |
| 428 V : Sum { |
428 + Differentiable<&'a Loc<F, N>, Output = V> |
| |
429 + Apply<&'a Loc<F, N>, Output = W>, |
| |
430 V : Sum, |
| |
431 W : Sum { |
| 429 |
432 |
| 430 type Output = V; |
433 type Output = V; |
| 431 |
434 |
| 432 fn differential(&self, x : &'a Loc<F, N>) -> Self::Output { |
435 fn differential(&self, x : &'a Loc<F, N>) -> V { |
| 433 self.bt.iter_at(x) |
436 self.bt.iter_at(x) |
| 434 .map(|&d| self.generator.support_for(d).differential(x)) |
437 .map(|&d| self.generator.support_for(d).differential(x)) |
| 435 .sum() |
438 .sum() |
| 436 } |
439 } |
| 437 } |
440 |
| 438 |
441 fn linearisation_error_gen(&self, x : &'a Loc<F, N>, y : &'a Loc<F, N>, z : &'a Loc<F, N>) -> W { |
| 439 impl<F : Float, G, BT, V, const N : usize> Differentiable<Loc<F, N>> |
442 self.bt.iter_at(x) |
| |
443 .map(|&d| self.generator.support_for(d).linearisation_error_gen(x, y, z)).sum() |
| |
444 } |
| |
445 |
| |
446 fn linearisation_error(&self, x : &'a Loc<F, N>, y : &'a Loc<F, N>) -> W { |
| |
447 self.bt.iter_at(x) |
| |
448 .map(|&d| self.generator.support_for(d).linearisation_error(x, y)).sum() |
| |
449 } |
| |
450 } |
| |
451 |
| |
452 impl<F : Float, G, BT, V, W, const N : usize> Differentiable<Loc<F, N>> |
| 440 for BTFN<F, G, BT, N> |
453 for BTFN<F, G, BT, N> |
| 441 where BT : BTImpl<F, N>, |
454 where BT : BTImpl<F, N>, |
| 442 G : SupportGenerator<F, N, Id=BT::Data>, |
455 G : SupportGenerator<F, N, Id=BT::Data>, |
| 443 G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<Loc<F, N>, Output = V>, |
456 G::SupportType : LocalAnalysis<F, BT::Agg, N> |
| 444 V : Sum { |
457 + Differentiable<Loc<F, N>, Output = V> |
| |
458 + Apply<Loc<F, N>, Output = W>, |
| |
459 V : Sum, |
| |
460 W : Sum { |
| 445 |
461 |
| 446 type Output = V; |
462 type Output = V; |
| 447 |
463 |
| 448 fn differential(&self, x : Loc<F, N>) -> Self::Output { |
464 fn differential(&self, x : Loc<F, N>) -> V { |
| 449 self.bt.iter_at(&x) |
465 self.bt.iter_at(&x) |
| 450 .map(|&d| self.generator.support_for(d).differential(x)) |
466 .map(|&d| self.generator.support_for(d).differential(x)) |
| 451 .sum() |
467 .sum() |
| |
468 } |
| |
469 |
| |
470 fn linearisation_error_gen(&self, x : Loc<F, N>, y : Loc<F, N>, z : Loc<F, N>) -> W { |
| |
471 self.bt.iter_at(&x) |
| |
472 .map(|&d| self.generator.support_for(d).linearisation_error_gen(x, y, z)).sum() |
| |
473 } |
| |
474 |
| |
475 fn linearisation_error(&self, x : Loc<F, N>, y : Loc<F, N>) -> W { |
| |
476 self.bt.iter_at(&x) |
| |
477 .map(|&d| self.generator.support_for(d).linearisation_error(x, y)).sum() |
| 452 } |
478 } |
| 453 } |
479 } |
| 454 |
480 |
| 455 // |
481 // |
| 456 // GlobalAnalysis |
482 // GlobalAnalysis |