src/nalgebra_support.rs

branch
dev
changeset 79
d63e40672dd6
parent 78
cebedc4a8331
equal deleted inserted replaced
78:cebedc4a8331 79:d63e40672dd6
59 where SM: Storage<E,N,M>, SV: Storage<E,M,K> + Clone, 59 where SM: Storage<E,N,M>, SV: Storage<E,M,K> + Clone,
60 N : Dim, M : Dim, K : Dim, E : Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign, 60 N : Dim, M : Dim, K : Dim, E : Scalar + Zero + One + ClosedAddAssign + ClosedMulAssign,
61 DefaultAllocator : Allocator<N,K>, 61 DefaultAllocator : Allocator<N,K>,
62 DefaultAllocator : Allocator<M,K>, 62 DefaultAllocator : Allocator<M,K>,
63 DefaultAllocator : Allocator<N,M>, 63 DefaultAllocator : Allocator<N,M>,
64 DefaultAllocator : Allocator<M,N> { 64 DefaultAllocator : Allocator<M,N>
65 } 65 {
66 66 type LinCodomain = OMatrix<E,N,K>;
67 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> 67 }
68 where SM: Storage<E,N,M>, SV1: Storage<E,M,K> + Clone, SV2: StorageMut<E,N,K>, 68
69 impl<SM,SV1,N,M,K,E> GEMV<Matrix<E,M,K,SV1>> for Matrix<E,N,M,SM>
70 where SM: Storage<E,N,M>, SV1: Storage<E,M,K> + Clone,
69 N : Dim, M : Dim, K : Dim, E : Scalar + Zero + One + Float, 71 N : Dim, M : Dim, K : Dim, E : Scalar + Zero + One + Float,
70 DefaultAllocator : Allocator<N,K>, 72 DefaultAllocator : Allocator<N,K>,
71 DefaultAllocator : Allocator<M,K>, 73 DefaultAllocator : Allocator<M,K>,
72 DefaultAllocator : Allocator<N,M>, 74 DefaultAllocator : Allocator<N,M>,
73 DefaultAllocator : Allocator<M,N> { 75 DefaultAllocator : Allocator<M,N> {
83 fn apply_mut<'a, I : Instance<Matrix<E,M,K,SV1>>>(&self, y : &mut Matrix<E,N,K,SV2>, x : I) { 85 fn apply_mut<'a, I : Instance<Matrix<E,M,K,SV1>>>(&self, y : &mut Matrix<E,N,K,SV2>, x : I) {
84 x.eval(|x̃| self.mul_to(x̃, y)) 86 x.eval(|x̃| self.mul_to(x̃, y))
85 } 87 }
86 } 88 }
87 89
88 impl<SM,SV1,M,E> AXPY<E, Vector<E,M,SV1>> for Vector<E,M,SM> 90 impl<SM,M,E> AXPY for Vector<E,M,SM>
89 where SM: StorageMut<E,M> + Clone, SV1: Storage<E,M> + Clone, 91 where SM: StorageMut<E,M> + Clone,
90 M : Dim, E : Scalar + Zero + One + Float, 92 M : Dim, E : Scalar + Zero + One + Float,
91 DefaultAllocator : Allocator<M> { 93 DefaultAllocator : Allocator<M> {
92 94 type Field = E;
93 #[inline] 95
94 fn axpy<I : Instance<Vector<E,M,SV1>>>(&mut self, α : E, x : I, β : E) { 96 #[inline]
97 fn axpy<I : Instance<Vector<E,M,SM>>>(&mut self, α : E, x : I, β : E) {
95 x.eval(|x̃| Matrix::axpy(self, α, x̃, β)) 98 x.eval(|x̃| Matrix::axpy(self, α, x̃, β))
96 } 99 }
97 100
98 #[inline] 101 #[inline]
99 fn copy_from<I : Instance<Vector<E,M,SV1>>>(&mut self, y : I) { 102 fn copy_from<I : Instance<Vector<E,M,SM>>>(&mut self, y : I) {
100 y.eval(|ỹ| Matrix::copy_from(self, ỹ)) 103 y.eval(|ỹ| Matrix::copy_from(self, ỹ))
101 } 104 }
102 } 105 }
103 106
104 /* Implemented automatically as Euclidean. 107 /* Implemented automatically as Euclidean.

mercurial