forked from M-Labs/nalgebra
Fix compilation of nalgebra-lapack
This commit is contained in:
parent
5a1dbfe37d
commit
73cc9882b2
@ -40,8 +40,8 @@ lapack-src = { version = "0.6", default-features = false }
|
|||||||
# clippy = "*"
|
# clippy = "*"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
nalgebra = { version = "0.25", features = [ "arbitrary" ], path = ".." }
|
nalgebra = { version = "0.25", features = [ "arbitrary", "rand" ], path = ".." }
|
||||||
proptest = { version = "1", default-features = false, features = ["std"] }
|
proptest = { version = "1", default-features = false, features = ["std"] }
|
||||||
quickcheck = "1"
|
quickcheck = "1"
|
||||||
approx = "0.4"
|
approx = "0.4"
|
||||||
rand = "0.8"
|
rand = "0.8"
|
||||||
|
@ -8,7 +8,7 @@ use simba::scalar::RealField;
|
|||||||
|
|
||||||
use crate::ComplexHelper;
|
use crate::ComplexHelper;
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{Dim, U1};
|
use na::dimension::{Const, Dim};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -78,9 +78,9 @@ where
|
|||||||
|
|
||||||
let lda = n as i32;
|
let lda = n as i32;
|
||||||
|
|
||||||
let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
// TODO: Tap into the workspace.
|
// TODO: Tap into the workspace.
|
||||||
let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
|
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
let mut placeholder1 = [T::zero()];
|
let mut placeholder1 = [T::zero()];
|
||||||
@ -247,8 +247,8 @@ where
|
|||||||
|
|
||||||
let lda = n as i32;
|
let lda = n as i32;
|
||||||
|
|
||||||
let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
|
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
let mut placeholder1 = [T::zero()];
|
let mut placeholder1 = [T::zero()];
|
||||||
@ -291,7 +291,7 @@ where
|
|||||||
);
|
);
|
||||||
lapack_panic!(info);
|
lapack_panic!(info);
|
||||||
|
|
||||||
let mut res = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut res = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
|
|
||||||
for i in 0..res.len() {
|
for i in 0..res.len() {
|
||||||
res[i] = Complex::new(wr[i], wi[i]);
|
res[i] = Complex::new(wr[i], wi[i]);
|
||||||
|
@ -3,7 +3,7 @@ use num_complex::Complex;
|
|||||||
|
|
||||||
use crate::ComplexHelper;
|
use crate::ComplexHelper;
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{DimDiff, DimSub, U1};
|
use na::dimension::{Const, DimDiff, DimSub, U1};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -60,7 +60,9 @@ where
|
|||||||
"Unable to compute the hessenberg decomposition of an empty matrix."
|
"Unable to compute the hessenberg decomposition of an empty matrix."
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut tau = unsafe { Matrix::new_uninitialized_generic(nrows.sub(U1), U1).assume_init() };
|
let mut tau = unsafe {
|
||||||
|
Matrix::new_uninitialized_generic(nrows.sub(Const::<1>), Const::<1>).assume_init()
|
||||||
|
};
|
||||||
|
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
let lwork =
|
let lwork =
|
||||||
|
@ -3,7 +3,7 @@ use num_complex::Complex;
|
|||||||
|
|
||||||
use crate::ComplexHelper;
|
use crate::ComplexHelper;
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{Dim, DimMin, DimMinimum, U1};
|
use na::dimension::{Const, Dim, DimMin, DimMinimum};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ where
|
|||||||
let nrows = nrows.value() as i32;
|
let nrows = nrows.value() as i32;
|
||||||
let ncols = ncols.value() as i32;
|
let ncols = ncols.value() as i32;
|
||||||
|
|
||||||
let mut ipiv: OVector<i32, _> = Matrix::zeros_generic(min_nrows_ncols, U1);
|
let mut ipiv: OVector<i32, _> = Matrix::zeros_generic(min_nrows_ncols, Const::<1>);
|
||||||
|
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ where
|
|||||||
/// Computing the permutation matrix explicitly is costly and usually not necessary.
|
/// Computing the permutation matrix explicitly is costly and usually not necessary.
|
||||||
/// To permute rows of a matrix or vector, use the method `self.permute(...)` instead.
|
/// To permute rows of a matrix or vector, use the method `self.permute(...)` instead.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn p(&self) -> OMatrix<T, R> {
|
pub fn p(&self) -> OMatrix<T, R, R> {
|
||||||
let (dim, _) = self.lu.data.shape();
|
let (dim, _) = self.lu.data.shape();
|
||||||
let mut id = Matrix::identity_generic(dim, dim);
|
let mut id = Matrix::identity_generic(dim, dim);
|
||||||
self.permute(&mut id);
|
self.permute(&mut id);
|
||||||
|
@ -6,7 +6,7 @@ use num_complex::Complex;
|
|||||||
|
|
||||||
use crate::ComplexHelper;
|
use crate::ComplexHelper;
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{Dim, DimMin, DimMinimum, U1};
|
use na::dimension::{Const, Dim, DimMin, DimMinimum};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -57,8 +57,9 @@ where
|
|||||||
let (nrows, ncols) = m.data.shape();
|
let (nrows, ncols) = m.data.shape();
|
||||||
|
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
let mut tau =
|
let mut tau = unsafe {
|
||||||
unsafe { Matrix::new_uninitialized_generic(nrows.min(ncols), U1).assume_init() };
|
Matrix::new_uninitialized_generic(nrows.min(ncols), Const::<1>).assume_init()
|
||||||
|
};
|
||||||
|
|
||||||
if nrows.value() == 0 || ncols.value() == 0 {
|
if nrows.value() == 0 || ncols.value() == 0 {
|
||||||
return Self { qr: m, tau: tau };
|
return Self { qr: m, tau: tau };
|
||||||
|
@ -8,7 +8,7 @@ use simba::scalar::RealField;
|
|||||||
|
|
||||||
use crate::ComplexHelper;
|
use crate::ComplexHelper;
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{Dim, U1};
|
use na::dimension::{Const, Dim};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -78,8 +78,8 @@ where
|
|||||||
|
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
|
|
||||||
let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut wr = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut wi = unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
let mut q = unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() };
|
let mut q = unsafe { Matrix::new_uninitialized_generic(nrows, ncols).assume_init() };
|
||||||
// Placeholders:
|
// Placeholders:
|
||||||
let mut bwork = [0i32];
|
let mut bwork = [0i32];
|
||||||
@ -151,8 +151,9 @@ where
|
|||||||
where
|
where
|
||||||
DefaultAllocator: Allocator<Complex<T>, D>,
|
DefaultAllocator: Allocator<Complex<T>, D>,
|
||||||
{
|
{
|
||||||
let mut out =
|
let mut out = unsafe {
|
||||||
unsafe { OVector::new_uninitialized_generic(self.t.data.shape().0, U1).assume_init() };
|
OVector::new_uninitialized_generic(self.t.data.shape().0, Const::<1>).assume_init()
|
||||||
|
};
|
||||||
|
|
||||||
for i in 0..out.len() {
|
for i in 0..out.len() {
|
||||||
out[i] = Complex::new(self.re[i], self.im[i])
|
out[i] = Complex::new(self.re[i], self.im[i])
|
||||||
|
@ -5,7 +5,7 @@ use num::Signed;
|
|||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{Dim, DimMin, DimMinimum, U1};
|
use na::dimension::{Const, Dim, DimMin, DimMinimum, U1};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -37,9 +37,9 @@ where
|
|||||||
DefaultAllocator: Allocator<T, R, R> + Allocator<T, DimMinimum<R, C>> + Allocator<T, C, C>,
|
DefaultAllocator: Allocator<T, R, R> + Allocator<T, DimMinimum<R, C>> + Allocator<T, C, C>,
|
||||||
{
|
{
|
||||||
/// The left-singular vectors `U` of this SVD.
|
/// The left-singular vectors `U` of this SVD.
|
||||||
pub u: OMatrix<T, R>, // TODO: should be OMatrix<T, R, DimMinimum<R, C>>
|
pub u: OMatrix<T, R, R>, // TODO: should be OMatrix<T, R, DimMinimum<R, C>>
|
||||||
/// The right-singular vectors `V^t` of this SVD.
|
/// The right-singular vectors `V^t` of this SVD.
|
||||||
pub vt: OMatrix<T, C>, // TODO: should be OMatrix<T, DimMinimum<R, C>, C>
|
pub vt: OMatrix<T, C, C>, // TODO: should be OMatrix<T, DimMinimum<R, C>, C>
|
||||||
/// The singular values of this SVD.
|
/// The singular values of this SVD.
|
||||||
pub singular_values: OVector<T, DimMinimum<R, C>>,
|
pub singular_values: OVector<T, DimMinimum<R, C>>,
|
||||||
}
|
}
|
||||||
@ -100,7 +100,7 @@ macro_rules! svd_impl(
|
|||||||
let lda = nrows.value() as i32;
|
let lda = nrows.value() as i32;
|
||||||
|
|
||||||
let mut u = unsafe { Matrix::new_uninitialized_generic(nrows, nrows).assume_init() };
|
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 s = unsafe { Matrix::new_uninitialized_generic(nrows.min(ncols), Const::<1>).assume_init() };
|
||||||
let mut vt = unsafe { Matrix::new_uninitialized_generic(ncols, ncols).assume_init() };
|
let mut vt = unsafe { Matrix::new_uninitialized_generic(ncols, ncols).assume_init() };
|
||||||
|
|
||||||
let ldu = nrows.value();
|
let ldu = nrows.value();
|
||||||
|
@ -8,7 +8,7 @@ use simba::scalar::RealField;
|
|||||||
|
|
||||||
use crate::ComplexHelper;
|
use crate::ComplexHelper;
|
||||||
use na::allocator::Allocator;
|
use na::allocator::Allocator;
|
||||||
use na::dimension::{Dim, U1};
|
use na::dimension::{Const, Dim};
|
||||||
use na::storage::Storage;
|
use na::storage::Storage;
|
||||||
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
use na::{DefaultAllocator, Matrix, OMatrix, OVector, Scalar};
|
||||||
|
|
||||||
@ -94,7 +94,8 @@ where
|
|||||||
|
|
||||||
let lda = n as i32;
|
let lda = n as i32;
|
||||||
|
|
||||||
let mut values = unsafe { Matrix::new_uninitialized_generic(nrows, U1).assume_init() };
|
let mut values =
|
||||||
|
unsafe { Matrix::new_uninitialized_generic(nrows, Const::<1>).assume_init() };
|
||||||
let mut info = 0;
|
let mut info = 0;
|
||||||
|
|
||||||
let lwork = T::xsyev_work_size(jobz, b'L', n as i32, m.as_mut_slice(), lda, &mut info);
|
let lwork = T::xsyev_work_size(jobz, b'L', n as i32, m.as_mut_slice(), lda, &mut info);
|
||||||
|
@ -101,7 +101,7 @@ pub fn dvector() -> impl Strategy<Value = DVector<f64>> {
|
|||||||
|
|
||||||
pub fn dmatrix_<ScalarStrategy>(
|
pub fn dmatrix_<ScalarStrategy>(
|
||||||
scalar_strategy: ScalarStrategy,
|
scalar_strategy: ScalarStrategy,
|
||||||
) -> impl Strategy<Value = DMatrix<ScalarStrategy::Value>>
|
) -> impl Strategy<Value = OMatrix<ScalarStrategy::Value, Dynamic, Dynamic>>
|
||||||
where
|
where
|
||||||
ScalarStrategy: Strategy + Clone + 'static,
|
ScalarStrategy: Strategy + Clone + 'static,
|
||||||
ScalarStrategy::Value: Scalar,
|
ScalarStrategy::Value: Scalar,
|
||||||
|
Loading…
Reference in New Issue
Block a user