src/bisection_tree/btfn.rs

branch
dev
changeset 47
a0db98c16ab5
parent 29
7fd0984743b5
child 59
9226980e45a7
child 81
d2acaaddd9af
equal deleted inserted replaced
46:bd924d62d952 47:a0db98c16ab5
422 422
423 impl<'a, F : Float, G, BT, V, const N : usize> Differentiable<&'a Loc<F, N>> 423 impl<'a, F : Float, G, BT, V, const N : usize> Differentiable<&'a Loc<F, N>>
424 for BTFN<F, G, BT, N> 424 for BTFN<F, G, BT, N>
425 where BT : BTImpl<F, N>, 425 where BT : BTImpl<F, N>,
426 G : SupportGenerator<F, N, Id=BT::Data>, 426 G : SupportGenerator<F, N, Id=BT::Data>,
427 G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<&'a Loc<F, N>, Output = V>, 427 G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<&'a Loc<F, N>, Derivative = V>,
428 V : Sum { 428 V : Sum {
429 429
430 type Output = V; 430 type Derivative = V;
431 431
432 fn differential(&self, x : &'a Loc<F, N>) -> Self::Output { 432 fn differential(&self, x : &'a Loc<F, N>) -> Self::Derivative {
433 self.bt.iter_at(x) 433 self.bt.iter_at(x)
434 .map(|&d| self.generator.support_for(d).differential(x)) 434 .map(|&d| self.generator.support_for(d).differential(x))
435 .sum() 435 .sum()
436 } 436 }
437 } 437 }
438 438
439 impl<F : Float, G, BT, V, const N : usize> Differentiable<Loc<F, N>> 439 impl<F : Float, G, BT, V, const N : usize> Differentiable<Loc<F, N>>
440 for BTFN<F, G, BT, N> 440 for BTFN<F, G, BT, N>
441 where BT : BTImpl<F, N>, 441 where BT : BTImpl<F, N>,
442 G : SupportGenerator<F, N, Id=BT::Data>, 442 G : SupportGenerator<F, N, Id=BT::Data>,
443 G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<Loc<F, N>, Output = V>, 443 G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<Loc<F, N>, Derivative = V>,
444 V : Sum { 444 V : Sum {
445 445
446 type Output = V; 446 type Derivative = V;
447 447
448 fn differential(&self, x : Loc<F, N>) -> Self::Output { 448 fn differential(&self, x : Loc<F, N>) -> Self::Derivative {
449 self.bt.iter_at(&x) 449 self.bt.iter_at(&x)
450 .map(|&d| self.generator.support_for(d).differential(x)) 450 .map(|&d| self.generator.support_for(d).differential(x))
451 .sum() 451 .sum()
452 } 452 }
453 } 453 }

mercurial