diff --git a/src/solve.rs b/src/solve.rs index 52a58dde..7346ad1b 100644 --- a/src/solve.rs +++ b/src/solve.rs @@ -137,7 +137,8 @@ pub trait Solve { } /// Represents the LU factorization of a matrix `A` as `A = P*L*U`. -pub struct LUFactorized { +#[derive(Clone)] +pub struct LUFactorized { /// The factors `L` and `U`; the unit diagonal elements of `L` are not /// stored. pub a: ArrayBase, @@ -148,7 +149,7 @@ pub struct LUFactorized { impl Solve for LUFactorized where A: Scalar + Lapack, - S: Data, + S: Data + RawDataClone, { fn solve_inplace<'a, Sb>(&self, rhs: &'a mut ArrayBase) -> Result<&'a mut ArrayBase> where @@ -226,14 +227,14 @@ where } /// An interface for computing LU factorizations of matrix refs. -pub trait Factorize { +pub trait Factorize { /// Computes the LU factorization `A = P*L*U`, where `P` is a permutation /// matrix. fn factorize(&self) -> Result>; } /// An interface for computing LU factorizations of matrices. -pub trait FactorizeInto { +pub trait FactorizeInto { /// Computes the LU factorization `A = P*L*U`, where `P` is a permutation /// matrix. fn factorize_into(self) -> Result>; @@ -242,7 +243,7 @@ pub trait FactorizeInto { impl FactorizeInto for ArrayBase where A: Scalar + Lapack, - S: DataMut, + S: DataMut + RawDataClone, { fn factorize_into(mut self) -> Result> { let ipiv = unsafe { A::lu(self.layout()?, self.as_allocated_mut()?)? }; @@ -279,7 +280,7 @@ pub trait InverseInto { impl InverseInto for LUFactorized where A: Scalar + Lapack, - S: DataMut, + S: DataMut + RawDataClone, { type Output = ArrayBase; @@ -292,7 +293,7 @@ where impl Inverse for LUFactorized where A: Scalar + Lapack, - S: Data, + S: Data + RawDataClone, { type Output = Array2; @@ -308,7 +309,7 @@ where impl InverseInto for ArrayBase where A: Scalar + Lapack, - S: DataMut, + S: DataMut + RawDataClone, { type Output = Self; @@ -408,7 +409,7 @@ where impl Determinant for LUFactorized where A: Scalar + Lapack, - S: Data, + S: Data + RawDataClone, { fn sln_det(&self) -> Result<(A, A::Real)> { self.a.ensure_square()?; @@ -419,7 +420,7 @@ where impl DeterminantInto for LUFactorized where A: Scalar + Lapack, - S: Data, + S: Data + RawDataClone, { fn sln_det_into(self) -> Result<(A, A::Real)> { self.a.ensure_square()?; @@ -448,7 +449,7 @@ where impl DeterminantInto for ArrayBase where A: Scalar + Lapack, - S: DataMut, + S: DataMut + RawDataClone, { fn sln_det_into(self) -> Result<(A, A::Real)> { self.ensure_square()?; @@ -494,7 +495,7 @@ pub trait ReciprocalConditionNumInto { impl ReciprocalConditionNum for LUFactorized where A: Scalar + Lapack, - S: Data, + S: Data + RawDataClone, { fn rcond(&self) -> Result { unsafe { A::rcond(self.a.layout()?, self.a.as_allocated()?, self.a.opnorm_one()?) } @@ -504,7 +505,7 @@ where impl ReciprocalConditionNumInto for LUFactorized where A: Scalar + Lapack, - S: Data, + S: Data + RawDataClone, { fn rcond_into(self) -> Result { self.rcond() @@ -524,7 +525,7 @@ where impl ReciprocalConditionNumInto for ArrayBase where A: Scalar + Lapack, - S: DataMut, + S: DataMut + RawDataClone, { fn rcond_into(self) -> Result { self.factorize_into()?.rcond_into()