Fri, 28 Apr 2023 13:42:03 +0300
Rename Differentiate → Differentiable
--- a/src/bisection_tree/btfn.rs Fri Apr 28 09:03:21 2023 +0300 +++ b/src/bisection_tree/btfn.rs Fri Apr 28 13:42:03 2023 +0300 @@ -4,7 +4,7 @@ use std::marker::PhantomData; use std::sync::Arc; use crate::types::Float; -use crate::mapping::{Apply, Mapping, Differentiate}; +use crate::mapping::{Apply, Mapping, Differentiable}; //use crate::linops::{Apply, Linear}; use crate::sets::Set; use crate::sets::Cube; @@ -420,11 +420,11 @@ } } -impl<'a, F : Float, G, BT, V, const N : usize> Differentiate<&'a Loc<F, N>> +impl<'a, F : Float, G, BT, V, const N : usize> Differentiable<&'a Loc<F, N>> for BTFN<F, G, BT, N> where BT : BTImpl<F, N>, G : SupportGenerator<F, N, Id=BT::Data>, - G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiate<&'a Loc<F, N>, Output = V>, + G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<&'a Loc<F, N>, Output = V>, V : Sum { type Output = V; @@ -436,11 +436,11 @@ } } -impl<F : Float, G, BT, V, const N : usize> Differentiate<Loc<F, N>> +impl<F : Float, G, BT, V, const N : usize> Differentiable<Loc<F, N>> for BTFN<F, G, BT, N> where BT : BTImpl<F, N>, G : SupportGenerator<F, N, Id=BT::Data>, - G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiate<Loc<F, N>, Output = V>, + G::SupportType : LocalAnalysis<F, BT::Agg, N> + Differentiable<Loc<F, N>, Output = V>, V : Sum { type Output = V;
--- a/src/bisection_tree/either.rs Fri Apr 28 09:03:21 2023 +0300 +++ b/src/bisection_tree/either.rs Fri Apr 28 13:42:03 2023 +0300 @@ -3,7 +3,7 @@ use std::sync::Arc; use crate::types::*; -use crate::mapping::{Apply, Differentiate}; +use crate::mapping::{Apply, Differentiable}; use crate::iter::{Mappable, MapF, MapZ}; use crate::sets::Cube; use crate::loc::Loc; @@ -190,9 +190,9 @@ } } -impl<F, S1, S2, X> Differentiate<X> for EitherSupport<S1, S2> -where S1 : Differentiate<X, Output=F>, - S2 : Differentiate<X, Output=F> { +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; #[inline] fn differential(&self, x : X) -> F {
--- a/src/mapping.rs Fri Apr 28 09:03:21 2023 +0300 +++ b/src/mapping.rs Fri Apr 28 13:42:03 2023 +0300 @@ -51,7 +51,7 @@ /// Trait for calculation the differential of `Self` as a mathematical function on `X`. -pub trait Differentiate<X> { +pub trait Differentiable<X> { type Output; /// Compute the differential of `self` at `x`. @@ -65,16 +65,16 @@ /// This is automatically implemented when the relevant [`Differentiate`] are implemented. pub trait DifferentiableMapping<Domain> : Mapping<Domain> - + Differentiate<Domain, Output=Self::Differential> - + for<'a> Differentiate<&'a Domain, Output=Self::Differential>{ + + Differentiable<Domain, Output=Self::Differential> + + for<'a> Differentiable<&'a Domain, Output=Self::Differential>{ type Differential; } impl<Domain, Differential, T> DifferentiableMapping<Domain> for T where T : Mapping<Domain> - + Differentiate<Domain, Output=Differential> - + for<'a> Differentiate<&'a Domain, Output=Differential> { + + Differentiable<Domain, Output=Differential> + + for<'a> Differentiable<&'a Domain, Output=Differential> { type Differential = Differential; } @@ -103,7 +103,7 @@ } } -impl<Domain, M> Differentiate<Domain> for Sum<Domain, M> +impl<Domain, M> Differentiable<Domain> for Sum<Domain, M> where M : DifferentiableMapping<Domain>, M :: Codomain : std::iter::Sum, M :: Differential : std::iter::Sum,