--- a/src/norms.rs Sun May 18 23:15:50 2025 -0500 +++ b/src/norms.rs Sun May 18 23:31:48 2025 -0500 @@ -26,10 +26,7 @@ pub trait NormExponent: Copy { /// Return the norm as a mappin fn as_mapping<F: Float>(self) -> NormMapping<F, Self> { - NormMapping { - exponent: self, - _phantoms: PhantomData, - } + NormMapping { exponent: self, _phantoms: PhantomData } } } @@ -111,7 +108,7 @@ } /// Trait for distances with respect to a norm. -pub trait Dist<F: Num, Exponent: NormExponent>: Norm<Exponent, F> + Space { +pub trait Dist<Exponent: NormExponent, F: Num = f64>: Norm<Exponent, F> + Space { /// Calculate the distance fn dist<I: Instance<Self>>(&self, other: I, _p: Exponent) -> F; } @@ -183,7 +180,7 @@ } } -impl<F: Float, E: Euclidean<F> + Normed<F, NormExp = L2>> Dist<F, HuberL1<F>> for E { +impl<F: Float, E: Euclidean<F> + Normed<F, NormExp = L2>> Dist<HuberL1<F>, F> for E { fn dist<I: Instance<Self>>(&self, other: I, huber: HuberL1<F>) -> F { huber.apply(self.dist2_squared(other)) } @@ -195,7 +192,7 @@ // } // } -// impl<F : Float, E : Dist<F, L2>> Dist<F, L21> for Vec<E> { +// impl<F : Float, E : Dist<F, L2>> Dist<L21, F> for Vec<E> { // fn dist<I : Instance<Self>>(&self, other : I, _l21 : L21) -> F { // self.iter().zip(other.iter()).map(|(e, g)| e.dist(g, L2)).sum() // }