src/nalgebra_support.rs

branch
dev
changeset 85
f2fc6115b897
parent 82
981069ef919b
--- a/src/nalgebra_support.rs	Tue Dec 31 23:34:47 2024 -0500
+++ b/src/nalgebra_support.rs	Tue Dec 31 23:49:09 2024 -0500
@@ -63,8 +63,9 @@
         DefaultAllocator : Allocator<M,N> {
 }
 
-impl<SM,SV1,SV2,N,M,K,E> GEMV<E, Matrix<E,M,K,SV1>, Matrix<E,N,K,SV2>> for Matrix<E,N,M,SM>
-where SM: Storage<E,N,M>, SV1: Storage<E,M,K> + Clone, SV2: StorageMut<E,N,K>,
+impl<SM,SV1,N,M,K,E> GEMV<E, Matrix<E,M,K,SV1>> for Matrix<E,N,M,SM>
+where SM: Storage<E,N,M>, SV1: Storage<E,M,K> + Clone,
+      OMatrix<E, N, K> : AXPY<E>,
       N : Dim, M : Dim, K : Dim, E : Scalar + Zero + One + Float,
       DefaultAllocator : Allocator<N,K>,
       DefaultAllocator : Allocator<M,K>,
@@ -73,37 +74,36 @@
 
     #[inline]
     fn gemv<I : Instance<Matrix<E,M,K,SV1>>>(
-        &self, y : &mut Matrix<E,N,K,SV2>, α : E, x : I, β : E
+        &self, y : &mut OMatrix<E,N,K>, α : E, x : I, β : E
     ) {
         x.eval(|x̃| Matrix::gemm(y, α, self, x̃, β))
     }
 
     #[inline]
-    fn apply_mut<'a, I : Instance<Matrix<E,M,K,SV1>>>(&self, y : &mut Matrix<E,N,K,SV2>, x : I) {
+    fn apply_mut<'a, I : Instance<Matrix<E,M,K,SV1>>>(&self, y : &mut OMatrix<E,N,K>, x : I) {
         x.eval(|x̃| self.mul_to(x̃, y))
     }
 }
 
-impl<SM,SV1,M,E> AXPY<E, Vector<E,M,SV1>> for Vector<E,M,SM>
-where SM: StorageMut<E,M> + Clone, SV1: Storage<E,M> + Clone,
+impl<SM,M,E> AXPY<E, OVector<E, M>> for Vector<E,M,SM>
+where SM: StorageMut<E,M> + Clone,
       M : Dim, E : Scalar + Zero + One + Float,
       DefaultAllocator : Allocator<M> {
-    type Owned = OVector<E, M>;
 
     #[inline]
-    fn add_mul<I : Instance<Vector<E,M,SV1>>>(self, α : E, x : I, β : E) -> Self::Owned {
+    fn add_mul<I : Instance<OVector<E, M>>>(self, α : E, x : I, β : E) -> OVector<E, M> {
         let mut owned = self.into_owned();
         x.eval(|x̃| Matrix::axpy(&mut owned, α, x̃, β));
         owned
     }
 
     #[inline]
-    fn axpy<I : Instance<Vector<E,M,SV1>>>(&mut self, α : E, x : I, β : E) {
+    fn axpy<I : Instance<OVector<E, M>>>(&mut self, α : E, x : I, β : E) {
         x.eval(|x̃| Matrix::axpy(self, α, x̃, β))
     }
 
     #[inline]
-    fn copy_from<I : Instance<Vector<E,M,SV1>>>(&mut self, y : I) {
+    fn copy_from<I : Instance<OVector<E, M>>>(&mut self, y : I) {
         y.eval(|ỹ| Matrix::copy_from(self, ỹ))
     }
 
@@ -113,7 +113,7 @@
     }
 
     #[inline]
-    fn similar_origin(&self) -> Self::Owned {
+    fn similar_origin(&self) -> OVector<E, M> {
         OVector::zeros_generic(M::from_usize(self.len()), Const)
     }
 }

mercurial