diff -r 9226980e45a7 -r 848ecc05becf src/loc.rs --- a/src/loc.rs Tue Dec 31 08:30:02 2024 -0500 +++ b/src/loc.rs Tue Dec 31 09:02:55 2024 -0500 @@ -578,6 +578,31 @@ } } + +/// The default norm for `Loc` is [`L2`]. +impl Normed for Loc { + type NormExp = L2; + + #[inline] + fn norm_exponent(&self) -> Self::NormExp { + L2 + } + + // #[inline] + // fn similar_origin(&self) -> Self { + // [F::ZERO; N].into() + // } + + #[inline] + fn is_zero(&self) -> bool { + self.norm2_squared() == F::ZERO + } +} + +impl HasDual for Loc { + type DualSpace = Self; +} + impl Norm for Loc { #[inline] fn norm(&self, _ : L2) -> F { self.norm2() } @@ -588,6 +613,17 @@ fn dist(&self, other : &Self, _ : L2) -> F { self.dist2(other) } } +/* Implemented automatically as Euclidean. +impl Projection for Loc { + #[inline] + fn proj_ball_mut(&mut self, ρ : F, nrm : L2) { + let n = self.norm(nrm); + if n > ρ { + *self *= ρ/n; + } + } +}*/ + impl Norm for Loc { /// This implementation is not stabilised as it's meant to be used for very small vectors. /// Use [`nalgebra`] for larger vectors.