diff -r f7b87d84864d -r 4f6ca107ccb1 src/norms.rs --- a/src/norms.rs Sun Dec 22 14:54:46 2024 -0500 +++ b/src/norms.rs Sun Dec 22 15:30:34 2024 -0500 @@ -104,9 +104,9 @@ } /// Trait for distances with respect to a norm. -pub trait Dist : Norm { +pub trait Dist : Norm + Space { /// Calculate the distance - fn dist(&self, other : &Self, _p : Exponent) -> F; + fn dist>(&self, other : I, _p : Exponent) -> F; } /// Trait for Euclidean projections to the `Exponent`-[`Norm`]-ball. @@ -171,22 +171,22 @@ } impl> Dist> for E { - fn dist(&self, other : &Self, huber : HuberL1) -> F { + fn dist>(&self, other : I, huber : HuberL1) -> F { huber.apply(self.dist2_squared(other)) } } -impl> Norm for Vec { - fn norm(&self, _l21 : L21) -> F { - self.iter().map(|e| e.norm(L2)).sum() - } -} +// impl> Norm for Vec { +// fn norm(&self, _l21 : L21) -> F { +// self.iter().map(|e| e.norm(L2)).sum() +// } +// } -impl> Dist for Vec { - fn dist(&self, other : &Self, _l21 : L21) -> F { - self.iter().zip(other.iter()).map(|(e, g)| e.dist(g, L2)).sum() - } -} +// impl> Dist for Vec { +// fn dist>(&self, other : I, _l21 : L21) -> F { +// self.iter().zip(other.iter()).map(|(e, g)| e.dist(g, L2)).sum() +// } +// } impl Mapping for NormMapping where