src/bisection_tree/either.rs

branch
dev
changeset 77
cf8ef9463664
parent 29
7fd0984743b5
--- a/src/bisection_tree/either.rs	Fri Apr 28 14:02:18 2023 +0300
+++ b/src/bisection_tree/either.rs	Tue Jul 18 15:44:10 2023 +0300
@@ -190,17 +190,34 @@
     }
 }
 
-impl<F, S1, S2, X> Differentiable<X> for EitherSupport<S1, S2>
-where S1 : Differentiable<X, Output=F>,
-      S2 : Differentiable<X, Output=F> {
-    type Output = F;
+impl<F, D, S1, S2, X : Clone> Differentiable<X> for EitherSupport<S1, S2>
+where S1 : Differentiable<X, Output=D> + Apply<X, Output = F>,
+      S2 : Differentiable<X, Output=D> + Apply<X, Output = F> {
+    type Output = D;
+
     #[inline]
-    fn differential(&self, x : X) -> F {
+    fn differential(&self, x : X) -> D {
         match self {
             EitherSupport::Left(ref a) => a.differential(x),
             EitherSupport::Right(ref b) => b.differential(x),
         }
     }
+    
+    #[inline]
+    fn linearisation_error(&self, x : X, y : X) -> F {
+        match self {
+            EitherSupport::Left(ref a) => a.linearisation_error(x, y),
+            EitherSupport::Right(ref b) => b.linearisation_error(x, y),
+        }
+    }
+
+    #[inline]
+    fn linearisation_error_gen(&self, x : X, y : X, z : X) -> F {
+        match self {
+            EitherSupport::Left(ref a) => a.linearisation_error_gen(x, y, z),
+            EitherSupport::Right(ref b) => b.linearisation_error_gen(x, y, z),
+        }
+    }
 }
 
 macro_rules! make_either_scalarop_rhs {

mercurial