diff -r cc68841e758f -r 00029c20c0ee src/bisection_tree/either.rs --- 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 Differentiate for EitherSupport +where S1 : Differentiate, + S2 : Differentiate { + 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