src/bisection_tree/either.rs

branch
dev
changeset 77
cf8ef9463664
parent 29
7fd0984743b5
equal deleted inserted replaced
30:9f2214c961cb 77:cf8ef9463664
188 EitherSupport::Right(ref b) => b.apply(x), 188 EitherSupport::Right(ref b) => b.apply(x),
189 } 189 }
190 } 190 }
191 } 191 }
192 192
193 impl<F, S1, S2, X> Differentiable<X> for EitherSupport<S1, S2> 193 impl<F, D, S1, S2, X : Clone> Differentiable<X> for EitherSupport<S1, S2>
194 where S1 : Differentiable<X, Output=F>, 194 where S1 : Differentiable<X, Output=D> + Apply<X, Output = F>,
195 S2 : Differentiable<X, Output=F> { 195 S2 : Differentiable<X, Output=D> + Apply<X, Output = F> {
196 type Output = F; 196 type Output = D;
197 #[inline] 197
198 fn differential(&self, x : X) -> F { 198 #[inline]
199 fn differential(&self, x : X) -> D {
199 match self { 200 match self {
200 EitherSupport::Left(ref a) => a.differential(x), 201 EitherSupport::Left(ref a) => a.differential(x),
201 EitherSupport::Right(ref b) => b.differential(x), 202 EitherSupport::Right(ref b) => b.differential(x),
203 }
204 }
205
206 #[inline]
207 fn linearisation_error(&self, x : X, y : X) -> F {
208 match self {
209 EitherSupport::Left(ref a) => a.linearisation_error(x, y),
210 EitherSupport::Right(ref b) => b.linearisation_error(x, y),
211 }
212 }
213
214 #[inline]
215 fn linearisation_error_gen(&self, x : X, y : X, z : X) -> F {
216 match self {
217 EitherSupport::Left(ref a) => a.linearisation_error_gen(x, y, z),
218 EitherSupport::Right(ref b) => b.linearisation_error_gen(x, y, z),
202 } 219 }
203 } 220 }
204 } 221 }
205 222
206 macro_rules! make_either_scalarop_rhs { 223 macro_rules! make_either_scalarop_rhs {

mercurial