--- a/src/mapping.rs Thu May 01 08:40:33 2025 -0500 +++ b/src/mapping.rs Thu May 01 13:06:58 2025 -0500 @@ -40,7 +40,7 @@ X: Space, T: Mapping<X, Codomain = Domain>, E: NormExponent, - Domain: Norm<F, E>, + Domain: Norm<E, F>, F: Num, { Composition { @@ -65,19 +65,19 @@ } } -/// 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> {} +/// Automatically implemented shorthand for referring to [`Mapping`]s from [`Loc<N, F>`] to `F`. +pub trait RealMapping<const N: usize, F: Float = f64>: Mapping<Loc<N, F>, Codomain = F> {} -impl<F: Float, T, const N: usize> RealMapping<F, N> for T where T: Mapping<Loc<F, N>, Codomain = F> {} +impl<F: Float, T, const N: usize> RealMapping<N, F> for T where T: Mapping<Loc<N, F>, Codomain = F> {} -/// 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>> +/// A helper trait alias for referring to [`Mapping`]s from [`Loc<N, F>`] to [`Loc<M, F>`]. +pub trait RealVectorField<const N: usize, const M: usize, F: Float = f64>: + Mapping<Loc<N, F>, Codomain = Loc<M, F>> { } -impl<F: Float, T, const N: usize, const M: usize> RealVectorField<F, N, M> for T where - T: Mapping<Loc<F, N>, Codomain = Loc<F, M>> +impl<F: Float, T, const N: usize, const M: usize> RealVectorField<N, M, F> for T where + T: Mapping<Loc<N, F>, Codomain = Loc<M, F>> { } @@ -102,14 +102,14 @@ } /// 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, DerivativeDomain = Loc<F, N>> +/// [`Loc<N, F>`] to `F`. +pub trait DifferentiableRealMapping<const N: usize, F: Float>: + DifferentiableMapping<Loc<N, F>, Codomain = F, DerivativeDomain = Loc<N, F>> { } -impl<F: Float, T, const N: usize> DifferentiableRealMapping<F, N> for T where - T: DifferentiableMapping<Loc<F, N>, Codomain = F, DerivativeDomain = Loc<F, N>> +impl<F: Float, T, const N: usize> DifferentiableRealMapping<N, F> for T where + T: DifferentiableMapping<Loc<N, F>, Codomain = F, DerivativeDomain = Loc<N, F>> { } @@ -186,7 +186,7 @@ impl<F: Space, X, G> Mapping<X> for FlattenedCodomain<X, F, G> where X: Space, - G: Mapping<X, Codomain = Loc<F, 1>>, + G: Mapping<X, Codomain = Loc<1, F>>, { type Codomain = F; @@ -198,7 +198,7 @@ /// An auto-trait for constructing a [`FlattenCodomain`] structure for /// flattening the codomain of a [`Mapping`] from [`Loc`]`<F, 1>` to `F`. -pub trait FlattenCodomain<X: Space, F>: Mapping<X, Codomain = Loc<F, 1>> + Sized { +pub trait FlattenCodomain<X: Space, F>: Mapping<X, Codomain = Loc<1, F>> + Sized { /// Flatten the codomain from [`Loc`]`<F, 1>` to `F`. fn flatten_codomain(self) -> FlattenedCodomain<X, F, Self> { FlattenedCodomain { @@ -208,9 +208,9 @@ } } -impl<X: Space, F, G: Sized + Mapping<X, Codomain = Loc<F, 1>>> FlattenCodomain<X, F> for G {} +impl<X: Space, F, G: Sized + Mapping<X, Codomain = Loc<1, F>>> FlattenCodomain<X, F> for G {} -/// Container for dimensional slicing [`Loc`]`<F, N>` codomain of a [`Mapping`] to `F`. +/// Container for dimensional slicing [`Loc`]`<N, F>` codomain of a [`Mapping`] to `F`. pub struct SlicedCodomain<'a, X, F, G: Clone, const N: usize> { g: Cow<'a, G>, slice: usize, @@ -221,7 +221,7 @@ where X: Space, F: Copy + Space, - G: Mapping<X, Codomain = Loc<F, N>> + Clone, + G: Mapping<X, Codomain = Loc<N, F>> + Clone, { type Codomain = F; @@ -235,8 +235,8 @@ /// An auto-trait for constructing a [`FlattenCodomain`] structure for /// flattening the codomain of a [`Mapping`] from [`Loc`]`<F, 1>` to `F`. -pub trait SliceCodomain<X: Space, F: Copy, const N: usize>: - Mapping<X, Codomain = Loc<F, N>> + Clone + Sized +pub trait SliceCodomain<X: Space, const N: usize, F: Copy = f64>: + Mapping<X, Codomain = Loc<N, F>> + Clone + Sized { /// Flatten the codomain from [`Loc`]`<F, 1>` to `F`. fn slice_codomain(self, slice: usize) -> SlicedCodomain<'static, X, F, Self, N> { @@ -259,8 +259,8 @@ } } -impl<X: Space, F: Copy, G: Sized + Mapping<X, Codomain = Loc<F, N>> + Clone, const N: usize> - SliceCodomain<X, F, N> for G +impl<X: Space, F: Copy, G: Sized + Mapping<X, Codomain = Loc<N, F>> + Clone, const N: usize> + SliceCodomain<X, N, F> for G { }