| 357 let (n, m) = self.shape_generic(); |
357 let (n, m) = self.shape_generic(); |
| 358 OMatrix::zeros_generic(n, m) |
358 OMatrix::zeros_generic(n, m) |
| 359 } |
359 } |
| 360 } |
360 } |
| 361 |
361 |
| 362 impl<SM, SV1, M, N, E> AXPY<Matrix<E, M, N, SV1>> for Matrix<E, M, N, SM> |
362 // This can only be implemented for the “principal” OMatrix as parameter, as otherwise |
| 363 where |
363 // we run into problems of multiple implementations when calling the methods. |
| 364 SM: StorageMut<E, M, N>, |
364 impl<M, N, E, S> AXPY<OMatrix<E, M, N>> for Matrix<E, M, N, S> |
| 365 SV1: Storage<E, M, N>, |
365 where |
| |
366 S: StorageMut<E, M, N>, |
| 366 M: Dim, |
367 M: Dim, |
| 367 N: Dim, |
368 N: Dim, |
| 368 E: Scalar + Zero + One + Float, |
369 E: Scalar + Zero + One + Float, |
| 369 DefaultAllocator: Allocator<M, N>, |
370 DefaultAllocator: Allocator<M, N>, |
| 370 ShapeConstraint: StridesOk<E, M, N>, |
371 ShapeConstraint: StridesOk<E, M, N>, |
| 371 { |
372 { |
| 372 #[inline] |
373 #[inline] |
| 373 fn axpy<I: Instance<Matrix<E, M, N, SV1>>>(&mut self, α: E, x: I, β: E) { |
374 fn axpy<I: Instance<OMatrix<E, M, N>>>(&mut self, α: E, x: I, β: E) { |
| 374 x.eval(|x̃| { |
375 x.eval(|x̃| { |
| 375 assert_eq!(self.ncols(), x̃.ncols()); |
376 assert_eq!(self.ncols(), x̃.ncols()); |
| 376 // nalgebra does not implement axpy for matrices, and flattenining |
377 // nalgebra does not implement axpy for matrices, and flattenining |
| 377 // also seems difficult, so loop over columns. |
378 // also seems difficult, so loop over columns. |
| 378 for (mut y, ỹ) in self.column_iter_mut().zip(x̃.column_iter()) { |
379 for (mut y, ỹ) in self.column_iter_mut().zip(x̃.column_iter()) { |