src/loc.rs

branch
dev
changeset 62
d8305c9b6fdf
parent 60
848ecc05becf
child 63
f7b87d84864d
--- a/src/loc.rs	Tue Dec 31 08:30:43 2024 -0500
+++ b/src/loc.rs	Sat Dec 21 23:32:20 2024 -0500
@@ -443,11 +443,6 @@
 impl<F : Float,const N : usize> Euclidean<F> for Loc<F, N> {
     type Output = Self;
 
-    #[inline]
-    fn similar_origin(&self) -> Self {
-        Self::ORIGIN
-    }
-
     /// This implementation is not stabilised as it's meant to be used for very small vectors.
     /// Use [`nalgebra`] for larger vectors.
     #[inline]
@@ -712,6 +707,8 @@
 impl<F : Num, const N : usize> Linear<Loc<F, N>> for Loc<F, N> { }
 
 impl<F : Num, const N : usize> AXPY<F, Loc<F, N>> for Loc<F, N> {
+    type Owned = Self;
+
     #[inline]
     fn axpy<I : Instance<Loc<F, N>>>(&mut self, α : F, x : I, β : F) {
         x.eval(|x̃| {
@@ -727,4 +724,15 @@
     fn copy_from<I : Instance<Loc<F, N>>>(&mut self, x : I) {
         x.eval(|x̃| map2_mut(self, x̃, |yi, xi| *yi = *xi ))
     }
+
+    #[inline]
+    fn similar_origin(&self) -> Self::Owned {
+        Self::ORIGIN
+    }
+
+    #[inline]
+    fn set_zero(&mut self) {
+        *self = Self::ORIGIN;
+    }
 }
+

mercurial