Wed, 04 Oct 2023 09:03:47 -0500
Add DifferentiableRealMapping shorthand
src/mapping.rs | file | annotate | diff | comparison | revisions |
--- a/src/mapping.rs Wed Oct 04 08:59:29 2023 -0500 +++ b/src/mapping.rs Wed Oct 04 09:03:47 2023 -0500 @@ -42,13 +42,22 @@ type Codomain = Codomain; } - +/// Automatically implemented shorthand for referring to [`Mapping`]s from [`Loc<F, N>`] to `F`. pub trait RealMapping<F : Float, const N : usize> : Mapping<Loc<F, N>, Codomain = F> {} impl<F : Float, T, const N : usize> RealMapping<F, N> for T where T : Mapping<Loc<F, N>, Codomain = F> {} +/// Automatically implemented shorthand for referring to differentiable [`Mapping`]s from +/// [`Loc<F, N>`] to `F`. +pub trait DifferentiableRealMapping<F : Float, const N : usize> +: DifferentiableMapping<Loc<F, N>, Codomain = F, Differential=Loc<F, N>> {} + +impl<F : Float, T, const N : usize> DifferentiableRealMapping<F, N> for T +where T : DifferentiableMapping<Loc<F, N>, Codomain = F, Differential=Loc<F, N>> {} + + /// A helper trait alias for referring to [`Mapping`]s from [`Loc<F, N>`] to [`Loc<F, M>`]. pub trait RealVectorField<F : Float, const N : usize, const M : usize> : Mapping<Loc<F, N>, Codomain = Loc<F, M>> {}