src/nalgebra_support.rs

branch
dev
changeset 63
f7b87d84864d
parent 62
d8305c9b6fdf
child 64
4f6ca107ccb1
--- a/src/nalgebra_support.rs	Sat Dec 21 23:32:20 2024 -0500
+++ b/src/nalgebra_support.rs	Sun Dec 22 14:54:46 2024 -0500
@@ -1,7 +1,7 @@
 /*!
 Integration with nalgebra.
 
-This module mainly implements [`Euclidean`], [`Norm`], [`Dot`], [`Linear`], etc. for [`nalgebra`]
+This module mainly implements [`Euclidean`], [`Norm`], [`Linear`], etc. for [`nalgebra`]
 matrices and vectors.
 It also provides [`ToNalgebraRealField`] as a vomit-inducingly ugly workaround to nalgebra
 force-feeding its own versions of the same basic mathematical methods on `f32` and `f64` as
@@ -153,20 +153,6 @@
     }
 }
 
-impl<E,M,S,Si> Dot<Vector<E,M,Si>,E>
-for Vector<E,M,S>
-where M : Dim,
-      E : Float + Scalar + Zero + One,
-      S : Storage<E,M>,
-      Si : Storage<E,M>,
-      DefaultAllocator : Allocator<M> {
-
-    #[inline]
-    fn dot(&self, other : &Vector<E,M,Si>) -> E {
-        Vector::<E,M,S>::dot(self, other)
-    }
-}
-
 /// This function is [`nalgebra::EuclideanNorm::metric_distance`] without the `sqrt`.
 #[inline]
 fn metric_distance_squared<T, R1, C1, S1, R2, C2, S2>(
@@ -200,7 +186,12 @@
       DefaultAllocator : Allocator<M> {
 
     type Output = OVector<E, M>;
-    
+
+    #[inline]
+    fn dot<I : Instance<Self>>(&self, other : I) -> E {
+        Vector::<E,M,S>::dot(self, other.ref_instance())
+    }
+
     #[inline]
     fn norm2_squared(&self) -> E {
         Vector::<E,M,S>::norm_squared(self)

mercurial