54 fn apply(&self, x : &'a Matrix<E,M,K,SV>) -> Self::Output { |
54 fn apply(&self, x : &'a Matrix<E,M,K,SV>) -> Self::Output { |
55 self.mul(x) |
55 self.mul(x) |
56 } |
56 } |
57 } |
57 } |
58 |
58 |
59 impl<'a, SM,SV,N,M,K,E> Linear<Matrix<E,M,K,SV>> for Matrix<E,N,M,SM> |
59 impl<SM,SV,N,M,K,E> Linear<Matrix<E,M,K,SV>> for Matrix<E,N,M,SM> |
60 where SM: Storage<E,N,M>, SV: Storage<E,M,K>, |
60 where SM: Storage<E,N,M>, SV: Storage<E,M,K>, |
61 N : Dim, M : Dim, K : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One, |
61 N : Dim, M : Dim, K : Dim, E : Float + Scalar + ClosedMul + ClosedAdd + Zero + One, |
62 DefaultAllocator : Allocator<E,N,K>, |
62 DefaultAllocator : Allocator<E,N,K>, |
63 DefaultAllocator : Allocator<E,M,K>, |
63 DefaultAllocator : Allocator<E,M,K>, |
64 DefaultAllocator : Allocator<E,N,M>, |
64 DefaultAllocator : Allocator<E,N,M>, |
65 DefaultAllocator : Allocator<E,M,N> { |
65 DefaultAllocator : Allocator<E,M,N> { |
66 type Codomain = OMatrix<E,N,K>; |
66 type Codomain = OMatrix<E,N,K>; |
73 DefaultAllocator : Allocator<E,M,K>, |
73 DefaultAllocator : Allocator<E,M,K>, |
74 DefaultAllocator : Allocator<E,N,M>, |
74 DefaultAllocator : Allocator<E,N,M>, |
75 DefaultAllocator : Allocator<E,M,N> { |
75 DefaultAllocator : Allocator<E,M,N> { |
76 |
76 |
77 #[inline] |
77 #[inline] |
78 fn gemv(&self, y : &mut Matrix<E,N,K,SV2>, α : E, x : &Matrix<E,M,K,SV1>, β : E) { |
78 fn gemv(&self, y : &mut Matrix<E,N,K,SV2>, α : E, x : Matrix<E,M,K,SV1>, β : E) { |
|
79 Matrix::gemm(y, α, self, &x, β) |
|
80 } |
|
81 |
|
82 #[inline] |
|
83 fn apply_mut(&self, y : &mut Matrix<E,N,K,SV2>, x : Matrix<E,M,K,SV1>) { |
|
84 self.mul_to(&x, y) |
|
85 } |
|
86 } |
|
87 |
|
88 impl<'a, SM,SV1,SV2,N,M,K,E> GEMV<E, &'a Matrix<E,M,K,SV1>, Matrix<E,N,K,SV2>> for Matrix<E,N,M,SM> |
|
89 where SM: Storage<E,N,M>, SV1: Storage<E,M,K>, SV2: StorageMut<E,N,K>, |
|
90 N : Dim, M : Dim, K : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + Float, |
|
91 DefaultAllocator : Allocator<E,N,K>, |
|
92 DefaultAllocator : Allocator<E,M,K>, |
|
93 DefaultAllocator : Allocator<E,N,M>, |
|
94 DefaultAllocator : Allocator<E,M,N> { |
|
95 |
|
96 #[inline] |
|
97 fn gemv(&self, y : &mut Matrix<E,N,K,SV2>, α : E, x : &'a Matrix<E,M,K,SV1>, β : E) { |
79 Matrix::gemm(y, α, self, x, β) |
98 Matrix::gemm(y, α, self, x, β) |
80 } |
99 } |
81 |
100 |
82 #[inline] |
101 #[inline] |
83 fn apply_mut<'a>(&self, y : &mut Matrix<E,N,K,SV2>, x : &Matrix<E,M,K,SV1>) { |
102 fn apply_mut(&self, y : &mut Matrix<E,N,K,SV2>, x : &'a Matrix<E,M,K,SV1>) { |
84 self.mul_to(x, y) |
103 self.mul_to(x, y) |
85 } |
104 } |
86 } |
105 } |
87 |
106 |
88 impl<SM,SV1,M,E> AXPY<E, Vector<E,M,SV1>> for Vector<E,M,SM> |
107 impl<SM,SV1,M,E> AXPY<E, Vector<E,M,SV1>> for Vector<E,M,SM> |
89 where SM: StorageMut<E,M>, SV1: Storage<E,M>, |
108 where SM: StorageMut<E,M>, SV1: Storage<E,M>, |
90 M : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + Float, |
109 M : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + Float, |
91 DefaultAllocator : Allocator<E,M> { |
110 DefaultAllocator : Allocator<E,M> { |
92 |
111 |
93 #[inline] |
112 #[inline] |
94 fn axpy(&mut self, α : E, x : &Vector<E,M,SV1>, β : E) { |
113 fn axpy(&mut self, α : E, x : Vector<E,M,SV1>, β : E) { |
|
114 Matrix::axpy(self, α, &x, β) |
|
115 } |
|
116 |
|
117 #[inline] |
|
118 fn copy_from(&mut self, y : Vector<E,M,SV1>) { |
|
119 Matrix::copy_from(self, &y) |
|
120 } |
|
121 } |
|
122 |
|
123 impl<'a, SM,SV1,M,E> AXPY<E, &'a Vector<E,M,SV1>> for Vector<E,M,SM> |
|
124 where SM: StorageMut<E,M>, SV1: Storage<E,M>, |
|
125 M : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + Float, |
|
126 DefaultAllocator : Allocator<E,M> { |
|
127 |
|
128 #[inline] |
|
129 fn axpy(&mut self, α : E, x : &'a Vector<E,M,SV1>, β : E) { |
95 Matrix::axpy(self, α, x, β) |
130 Matrix::axpy(self, α, x, β) |
96 } |
131 } |
97 |
132 |
98 #[inline] |
133 #[inline] |
99 fn copy_from(&mut self, y : &Vector<E,M,SV1>) { |
134 fn copy_from(&mut self, y : &'a Vector<E,M,SV1>) { |
100 Matrix::copy_from(self, y) |
135 Matrix::copy_from(self, y) |
101 } |
136 } |
102 } |
137 } |
103 |
138 |
104 impl<SM,M,E> Projection<E, Linfinity> for Vector<E,M,SM> |
139 impl<SM,M,E> Projection<Linfinity> for Vector<E,M,SM> |
105 where SM: StorageMut<E,M>, |
140 where SM: StorageMut<E,M>, |
106 M : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + Float + RealField, |
141 M : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + Float + RealField, |
107 DefaultAllocator : Allocator<E,M> { |
142 DefaultAllocator : Allocator<E,M> { |
108 #[inline] |
143 #[inline] |
109 fn proj_ball_mut(&mut self, ρ : E, _ : Linfinity) { |
144 fn proj_ball_mut(&mut self, ρ : E, _ : Linfinity) { |
112 } |
147 } |
113 |
148 |
114 impl<'own,SV1,SV2,SM,N,M,K,E> Adjointable<Matrix<E,M,K,SV1>,Matrix<E,N,K,SV2>> |
149 impl<'own,SV1,SV2,SM,N,M,K,E> Adjointable<Matrix<E,M,K,SV1>,Matrix<E,N,K,SV2>> |
115 for Matrix<E,N,M,SM> |
150 for Matrix<E,N,M,SM> |
116 where SM: Storage<E,N,M>, SV1: Storage<E,M,K>, SV2: Storage<E,N,K>, |
151 where SM: Storage<E,N,M>, SV1: Storage<E,M,K>, SV2: Storage<E,N,K>, |
117 N : Dim, M : Dim, K : Dim, E : Scalar + ClosedMul + ClosedAdd + Zero + One + SimdComplexField, |
152 N : Dim, M : Dim, K : Dim, |
|
153 E : Float + Scalar + ClosedMul + ClosedAdd + Zero + One + SimdComplexField, |
118 DefaultAllocator : Allocator<E,N,K>, |
154 DefaultAllocator : Allocator<E,N,K>, |
119 DefaultAllocator : Allocator<E,M,K>, |
155 DefaultAllocator : Allocator<E,M,K>, |
120 DefaultAllocator : Allocator<E,N,M>, |
156 DefaultAllocator : Allocator<E,N,M>, |
121 DefaultAllocator : Allocator<E,M,N> { |
157 DefaultAllocator : Allocator<E,M,N> { |
122 type AdjointCodomain = OMatrix<E,M,K>; |
158 type AdjointCodomain = OMatrix<E,M,K>; |
126 fn adjoint(&self) -> Self::Adjoint<'_> { |
162 fn adjoint(&self) -> Self::Adjoint<'_> { |
127 Matrix::adjoint(self) |
163 Matrix::adjoint(self) |
128 } |
164 } |
129 } |
165 } |
130 |
166 |
131 impl<E,M,S,Si> Dot<Vector<E,M,Si>,E> |
167 impl<E,M,S,Si> Dot<Vector<E,M,Si>> |
132 for Vector<E,M,S> |
168 for Vector<E,M,S> |
133 where M : Dim, |
169 where M : Dim, |
134 E : Float + Scalar + ClosedMul + ClosedAdd + Zero + One, |
170 E : Float + Scalar + ClosedMul + ClosedAdd + Zero + One, |
135 S : Storage<E,M>, |
171 S : Storage<E,M>, |
136 Si : Storage<E,M>, |
172 Si : Storage<E,M>, |
137 DefaultAllocator : Allocator<E,M> { |
173 DefaultAllocator : Allocator<E,M> { |
138 |
174 |
139 #[inline] |
175 #[inline] |
140 fn dot(&self, other : &Vector<E,M,Si>) -> E { |
176 fn dot(&self, other : Vector<E,M,Si>) -> E { |
|
177 Vector::<E,M,S>::dot(self, &other) |
|
178 } |
|
179 } |
|
180 |
|
181 impl<'a, E,M,S,Si> Dot<&'a Vector<E,M,Si>> |
|
182 for Vector<E,M,S> |
|
183 where M : Dim, |
|
184 E : Float + Scalar + ClosedMul + ClosedAdd + Zero + One, |
|
185 S : Storage<E,M>, |
|
186 Si : Storage<E,M>, |
|
187 DefaultAllocator : Allocator<E,M> { |
|
188 |
|
189 #[inline] |
|
190 fn dot(&self, other : &'a Vector<E,M,Si>) -> E { |
141 Vector::<E,M,S>::dot(self, other) |
191 Vector::<E,M,S>::dot(self, other) |
142 } |
192 } |
143 } |
193 } |
144 |
194 |
145 /// This function is [`nalgebra::EuclideanNorm::metric_distance`] without the `sqrt`. |
195 /// This function is [`nalgebra::EuclideanNorm::metric_distance`] without the `sqrt`. |