diff --git a/nalgebra-lapack/src/eigen.rs b/nalgebra-lapack/src/eigen.rs index 1ccd6e3f..1aae842c 100644 --- a/nalgebra-lapack/src/eigen.rs +++ b/nalgebra-lapack/src/eigen.rs @@ -78,9 +78,9 @@ where let lda = n as i32; - let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; + let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; // TODO: Tap into the workspace. - let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; + let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; let mut info = 0; let mut placeholder1 = [N::zero()]; @@ -107,8 +107,10 @@ where match (left_eigenvectors, eigenvectors) { (true, true) => { - let mut vl = unsafe { Matrix::new_uninitialized_generic(nrows, ncols) }; - let mut vr = unsafe { Matrix::new_uninitialized_generic(nrows, ncols) }; + let mut vl = + unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() }; + let mut vr = + unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() }; N::xgeev( ljob, @@ -137,7 +139,8 @@ where } } (true, false) => { - let mut vl = unsafe { Matrix::new_uninitialized_generic(nrows, ncols) }; + let mut vl = + unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() }; N::xgeev( ljob, @@ -166,7 +169,8 @@ where } } (false, true) => { - let mut vr = unsafe { Matrix::new_uninitialized_generic(nrows, ncols) }; + let mut vr = + unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() }; N::xgeev( ljob, @@ -243,8 +247,8 @@ where let lda = n as i32; - let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; - let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; + let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; + let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; let mut info = 0; let mut placeholder1 = [N::zero()]; @@ -287,7 +291,7 @@ where ); lapack_panic!(info); - let mut res = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; + let mut res = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; for i in 0..res.len() { res[i] = Complex::new(wr[i], wi[i]); diff --git a/nalgebra-lapack/src/hessenberg.rs b/nalgebra-lapack/src/hessenberg.rs index b20df55e..ed456ecb 100644 --- a/nalgebra-lapack/src/hessenberg.rs +++ b/nalgebra-lapack/src/hessenberg.rs @@ -60,7 +60,7 @@ where "Unable to compute the hessenberg decomposition of an empty matrix." ); - let mut tau = unsafe { Matrix::new_uninitialized_generic(nrows.sub(U1), U1) }; + let mut tau = unsafe { Matrix::new_uninitialized_generic(nrows.sub(U1), U1).assume_init() }; let mut info = 0; let lwork = diff --git a/nalgebra-lapack/src/qr.rs b/nalgebra-lapack/src/qr.rs index ac8ad672..c9216135 100644 --- a/nalgebra-lapack/src/qr.rs +++ b/nalgebra-lapack/src/qr.rs @@ -57,7 +57,8 @@ where let (nrows, ncols) = m.data.shape(); let mut info = 0; - let mut tau = unsafe { Matrix::new_uninitialized_generic(nrows.min(ncols), U1) }; + let mut tau = + unsafe { Matrix::new_uninitialized_generic(nrows.min(ncols), U1).assume_init() }; if nrows.value() == 0 || ncols.value() == 0 { return Self { qr: m, tau: tau }; diff --git a/nalgebra-lapack/src/schur.rs b/nalgebra-lapack/src/schur.rs index 5079efbf..0480f73f 100644 --- a/nalgebra-lapack/src/schur.rs +++ b/nalgebra-lapack/src/schur.rs @@ -78,9 +78,9 @@ where let mut info = 0; - let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; - let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; - let mut q = unsafe { Matrix::new_uninitialized_generic(nrows, ncols) }; + let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; + let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; + let mut q = unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() }; // Placeholders: let mut bwork = [0i32]; let mut unused = 0; @@ -151,7 +151,8 @@ where where DefaultAllocator: Allocator, D>, { - let mut out = unsafe { VectorN::new_uninitialized_generic(self.t.data.shape().0, U1) }; + let mut out = + unsafe { VectorN::new_uninitialized_generic(self.t.data.shape().0, U1).assume_init() }; for i in 0..out.len() { out[i] = Complex::new(self.re[i], self.im[i]) diff --git a/nalgebra-lapack/src/svd.rs b/nalgebra-lapack/src/svd.rs index 18b4957f..70c7fd18 100644 --- a/nalgebra-lapack/src/svd.rs +++ b/nalgebra-lapack/src/svd.rs @@ -99,9 +99,9 @@ macro_rules! svd_impl( let lda = nrows.value() as i32; - let mut u = unsafe { Matrix::new_uninitialized_generic(nrows, nrows) }; - let mut s = unsafe { Matrix::new_uninitialized_generic(nrows.min(ncols), U1) }; - let mut vt = unsafe { Matrix::new_uninitialized_generic(ncols, ncols) }; + let mut u = unsafe { Matrix::new_uninitialized_generic(nrows, nrows).assume_init() }; + let mut s = unsafe { Matrix::new_uninitialized_generic(nrows.min(ncols), U1).assume_init() }; + let mut vt = unsafe { Matrix::new_uninitialized_generic(ncols, ncols).assume_init() }; let ldu = nrows.value(); let ldvt = ncols.value(); diff --git a/nalgebra-lapack/src/symmetric_eigen.rs b/nalgebra-lapack/src/symmetric_eigen.rs index 93961328..c255058d 100644 --- a/nalgebra-lapack/src/symmetric_eigen.rs +++ b/nalgebra-lapack/src/symmetric_eigen.rs @@ -94,7 +94,7 @@ where let lda = n as i32; - let mut values = unsafe { Matrix::new_uninitialized_generic(nrows, U1) }; + let mut values = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() }; let mut info = 0; let lwork = N::xsyev_work_size(jobz, b'L', n as i32, m.as_mut_slice(), lda, &mut info);