diff -r 9f2214c961cb -r cf8ef9463664 src/bisection_tree/btfn.rs --- a/src/bisection_tree/btfn.rs Fri Apr 28 14:02:18 2023 +0300 +++ b/src/bisection_tree/btfn.rs Tue Jul 18 15:44:10 2023 +0300 @@ -420,36 +420,62 @@ } } -impl<'a, F : Float, G, BT, V, const N : usize> Differentiable<&'a Loc> +impl<'a, F : Float, G, BT, V, W, const N : usize> Differentiable<&'a Loc> for BTFN where BT : BTImpl, G : SupportGenerator, - G::SupportType : LocalAnalysis + Differentiable<&'a Loc, Output = V>, - V : Sum { + G::SupportType : LocalAnalysis + + Differentiable<&'a Loc, Output = V> + + Apply<&'a Loc, Output = W>, + V : Sum, + W : Sum { type Output = V; - fn differential(&self, x : &'a Loc) -> Self::Output { + fn differential(&self, x : &'a Loc) -> V { self.bt.iter_at(x) .map(|&d| self.generator.support_for(d).differential(x)) .sum() } + + fn linearisation_error_gen(&self, x : &'a Loc, y : &'a Loc, z : &'a Loc) -> W { + self.bt.iter_at(x) + .map(|&d| self.generator.support_for(d).linearisation_error_gen(x, y, z)).sum() + } + + fn linearisation_error(&self, x : &'a Loc, y : &'a Loc) -> W { + self.bt.iter_at(x) + .map(|&d| self.generator.support_for(d).linearisation_error(x, y)).sum() + } } -impl Differentiable> +impl Differentiable> for BTFN where BT : BTImpl, G : SupportGenerator, - G::SupportType : LocalAnalysis + Differentiable, Output = V>, - V : Sum { + G::SupportType : LocalAnalysis + + Differentiable, Output = V> + + Apply, Output = W>, + V : Sum, + W : Sum { type Output = V; - fn differential(&self, x : Loc) -> Self::Output { + fn differential(&self, x : Loc) -> V { self.bt.iter_at(&x) .map(|&d| self.generator.support_for(d).differential(x)) .sum() } + + fn linearisation_error_gen(&self, x : Loc, y : Loc, z : Loc) -> W { + self.bt.iter_at(&x) + .map(|&d| self.generator.support_for(d).linearisation_error_gen(x, y, z)).sum() + } + + fn linearisation_error(&self, x : Loc, y : Loc) -> W { + self.bt.iter_at(&x) + .map(|&d| self.generator.support_for(d).linearisation_error(x, y)).sum() + } } //