From 8270dd8e891b3f6b2ee10b6d3fa59404b2f701f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Violeta=20Hern=C3=A1ndez?= Date: Fri, 16 Jul 2021 00:39:15 -0500 Subject: [PATCH] `ops.rs` works too now! --- src/base/blas.rs | 4 ++-- src/base/ops.rs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/base/blas.rs b/src/base/blas.rs index 57d93c87..45c6bf20 100644 --- a/src/base/blas.rs +++ b/src/base/blas.rs @@ -6,7 +6,7 @@ //! that return an owned matrix that would otherwise result from setting a //! parameter to zero in the other methods. -use crate::{OMatrix, SimdComplexField}; +use crate::SimdComplexField; #[cfg(feature = "std")] use matrixmultiply; use num::{One, Zero}; @@ -923,7 +923,7 @@ where csc as isize, ); - return ; + return; } } } diff --git a/src/base/ops.rs b/src/base/ops.rs index a595a2b1..63538121 100644 --- a/src/base/ops.rs +++ b/src/base/ops.rs @@ -647,7 +647,7 @@ where SB: Storage, SA: ContiguousStorageMut + Clone, ShapeConstraint: AreMultipliable, - DefaultAllocator: InnerAllocator, + DefaultAllocator: Allocator + InnerAllocator, { #[inline] fn mul_assign(&mut self, rhs: Matrix) { @@ -663,7 +663,7 @@ where SA: ContiguousStorageMut + Clone, ShapeConstraint: AreMultipliable, // TODO: this is too restrictive. See comments for the non-ref version. - DefaultAllocator: InnerAllocator, + DefaultAllocator: Allocator + InnerAllocator, { #[inline] fn mul_assign(&mut self, rhs: &'b Matrix) { @@ -818,9 +818,7 @@ where let (nrows1, ncols1) = self.data.shape(); let (nrows2, ncols2) = rhs.data.shape(); - let mut res = unsafe { - crate::unimplemented_or_uninitialized_generic!(nrows1.mul(nrows2), ncols1.mul(ncols2)) - }; + let mut res = Matrix::new_uninitialized_generic(nrows1.mul(nrows2), ncols1.mul(ncols2)); { let mut data_res = res.data.ptr_mut(); @@ -832,8 +830,10 @@ where let coeff = self.get_unchecked((i1, j1)).inlined_clone(); for i2 in 0..nrows2.value() { - *data_res = coeff.inlined_clone() - * rhs.get_unchecked((i2, j2)).inlined_clone(); + *data_res = MaybeUninit::new( + coeff.inlined_clone() + * rhs.get_unchecked((i2, j2)).inlined_clone(), + ); data_res = data_res.offset(1); } } @@ -842,7 +842,7 @@ where } } - res + unsafe { res.assume_init() } } }