Move the col_piv_qr method to the decomposition module.

This commit is contained in:
Crozet Sébastien 2021-02-25 13:28:42 +01:00
parent 693e6d0035
commit 598c217d75
2 changed files with 17 additions and 17 deletions

View File

@ -331,16 +331,3 @@ where
res * self.p.determinant() res * self.p.determinant()
} }
} }
impl<N: ComplexField, R: DimMin<C>, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S>
where
DefaultAllocator: Allocator<N, R, C>
+ Allocator<N, R>
+ Allocator<N, DimMinimum<R, C>>
+ Allocator<(usize, usize), DimMinimum<R, C>>,
{
/// Computes the QR decomposition (with column pivoting) of this matrix.
pub fn col_piv_qr(self) -> ColPivQR<N, R, C> {
ColPivQR::new(self.into_owned())
}
}

View File

@ -1,8 +1,8 @@
use crate::storage::Storage; use crate::storage::Storage;
use crate::{ use crate::{
Allocator, Bidiagonal, Cholesky, ComplexField, DefaultAllocator, Dim, DimDiff, DimMin, Allocator, Bidiagonal, Cholesky, ColPivQR, ComplexField, DefaultAllocator, Dim, DimDiff,
DimMinimum, DimSub, FullPivLU, Hessenberg, Matrix, Schur, SymmetricEigen, SymmetricTridiagonal, DimMin, DimMinimum, DimSub, FullPivLU, Hessenberg, Matrix, Schur, SymmetricEigen,
LU, QR, SVD, U1, SymmetricTridiagonal, LU, QR, SVD, U1,
}; };
/// # Rectangular matrix decomposition /// # Rectangular matrix decomposition
@ -13,8 +13,9 @@ use crate::{
/// | Decomposition | Factors | Details | /// | Decomposition | Factors | Details |
/// | -------------------------|---------------------|--------------| /// | -------------------------|---------------------|--------------|
/// | QR | `Q * R` | `Q` is an unitary matrix, and `R` is upper-triangular. | /// | QR | `Q * R` | `Q` is an unitary matrix, and `R` is upper-triangular. |
/// | QR with column pivoting | `Q * R * P⁻¹` | `Q` is an unitary matrix, and `R` is upper-triangular. `P` is a permutation matrix. |
/// | LU with partial pivoting | `P⁻¹ * L * U` | `L` is lower-triangular with a diagonal filled with `1` and `U` is upper-triangular. `P` is a permutation matrix. | /// | LU with partial pivoting | `P⁻¹ * L * U` | `L` is lower-triangular with a diagonal filled with `1` and `U` is upper-triangular. `P` is a permutation matrix. |
/// | LU with full pivoting | `P⁻¹ * L * U ~ Q⁻¹` | `L` is lower-triangular with a diagonal filled with `1` and `U` is upper-triangular. `P` and `Q` are permutation matrices. | /// | LU with full pivoting | `P⁻¹ * L * U * Q⁻¹` | `L` is lower-triangular with a diagonal filled with `1` and `U` is upper-triangular. `P` and `Q` are permutation matrices. |
/// | SVD | `U * Σ * Vᵀ` | `U` and `V` are two orthogonal matrices and `Σ` is a diagonal matrix containing the singular values. | /// | SVD | `U * Σ * Vᵀ` | `U` and `V` are two orthogonal matrices and `Σ` is a diagonal matrix containing the singular values. |
impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> { impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
/// Computes the bidiagonalization using householder reflections. /// Computes the bidiagonalization using householder reflections.
@ -60,6 +61,18 @@ impl<N: ComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
QR::new(self.into_owned()) QR::new(self.into_owned())
} }
/// Computes the QR decomposition (with column pivoting) of this matrix.
pub fn col_piv_qr(self) -> ColPivQR<N, R, C>
where
R: DimMin<C>,
DefaultAllocator: Allocator<N, R, C>
+ Allocator<N, R>
+ Allocator<N, DimMinimum<R, C>>
+ Allocator<(usize, usize), DimMinimum<R, C>>,
{
ColPivQR::new(self.into_owned())
}
/// Computes the Singular Value Decomposition using implicit shift. /// Computes the Singular Value Decomposition using implicit shift.
pub fn svd(self, compute_u: bool, compute_v: bool) -> SVD<N, R, C> pub fn svd(self, compute_u: bool, compute_v: bool) -> SVD<N, R, C>
where where