From 7219590127867b570120024a967877d902b26137 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Fri, 24 Jul 2020 15:46:37 +0900 Subject: [PATCH] Add LeastSquaresSvdDivideConquer_ into Lapack trait (back port of #232) --- src/lapack/mod.rs | 1 + src/least_squares.rs | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/lapack/mod.rs b/src/lapack/mod.rs index 18fd9eda..de4f9819 100644 --- a/src/lapack/mod.rs +++ b/src/lapack/mod.rs @@ -44,6 +44,7 @@ pub trait Lapack: + Eigh_ + Triangular_ + Tridiagonal_ + + LeastSquaresSvdDivideConquer_ { } diff --git a/src/least_squares.rs b/src/least_squares.rs index 549c8e08..6a57a0af 100644 --- a/src/least_squares.rs +++ b/src/least_squares.rs @@ -152,7 +152,7 @@ where /// valid representation for `ArrayBase`. impl LeastSquaresSvd for ArrayBase where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D: Data, { /// Solve a least squares problem of the form `Ax = rhs` @@ -175,7 +175,7 @@ where /// valid representation for `ArrayBase`. impl LeastSquaresSvd for ArrayBase where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D: Data, { /// Solve a least squares problem of the form `Ax = rhs` @@ -200,7 +200,7 @@ where /// valid representation for `ArrayBase`. impl LeastSquaresSvdInto for ArrayBase where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D: DataMut, { /// Solve a least squares problem of the form `Ax = rhs` @@ -226,7 +226,7 @@ where /// valid representation for `ArrayBase`. impl LeastSquaresSvdInto for ArrayBase where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D: DataMut, { /// Solve a least squares problem of the form `Ax = rhs` @@ -252,7 +252,7 @@ where /// valid representation for `ArrayBase`. impl LeastSquaresSvdInPlace for ArrayBase where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D: DataMut, { /// Solve a least squares problem of the form `Ax = rhs` @@ -284,7 +284,7 @@ fn compute_least_squares_srhs( rhs: &mut ArrayBase, ) -> Result> where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D1: DataMut, D2: DataMut, { @@ -292,7 +292,7 @@ where singular_values, rank, } = unsafe { - ::least_squares( + E::least_squares( a.layout()?, a.as_allocated_mut()?, rhs.as_slice_memory_order_mut() @@ -333,7 +333,7 @@ fn compute_residual_scalar>( /// valid representation for `ArrayBase`. impl LeastSquaresSvdInPlace for ArrayBase where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D: DataMut, { /// Solve a least squares problem of the form `Ax = rhs` @@ -366,7 +366,7 @@ fn compute_least_squares_nrhs( rhs: &mut ArrayBase, ) -> Result> where - E: Scalar + Lapack + LeastSquaresSvdDivideConquer_, + E: Scalar + Lapack, D1: DataMut, D2: DataMut, { @@ -376,7 +376,7 @@ where singular_values, rank, } = unsafe { - ::least_squares_nrhs( + E::least_squares_nrhs( a_layout, a.as_allocated_mut()?, rhs_layout,