--- a/src/bisection_tree/either.rs Fri Apr 28 08:27:17 2023 +0300 +++ b/src/bisection_tree/either.rs Fri Apr 28 08:32:15 2023 +0300 @@ -3,8 +3,8 @@ use std::sync::Arc; use crate::types::*; -use crate::mapping::Apply; -use crate::iter::{Mappable,MapF,MapZ}; +use crate::mapping::{Apply, Differentiate}; +use crate::iter::{Mappable, MapF, MapZ}; use crate::sets::Cube; use crate::loc::Loc; @@ -190,6 +190,19 @@ } } +impl<F, S1, S2, X> Differentiate<X> for EitherSupport<S1, S2> +where S1 : Differentiate<X, Output=F>, + S2 : Differentiate<X, Output=F> { + type Output = F; + #[inline] + fn differential(&self, x : X) -> F { + match self { + EitherSupport::Left(ref a) => a.differential(x), + EitherSupport::Right(ref b) => b.differential(x), + } + } +} + macro_rules! make_either_scalarop_rhs { ($trait:ident, $fn:ident, $trait_assign:ident, $fn_assign:ident) => { impl<F : Float, G1, G2>