From 598c217d759c77b8e92d03f899eb4d041d6dec86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Thu, 25 Feb 2021 13:28:42 +0100 Subject: [PATCH] Move the col_piv_qr method to the decomposition module. --- src/linalg/col_piv_qr.rs | 13 ------------- src/linalg/decomposition.rs | 21 +++++++++++++++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/linalg/col_piv_qr.rs b/src/linalg/col_piv_qr.rs index 3f8ecda1..4fa97482 100644 --- a/src/linalg/col_piv_qr.rs +++ b/src/linalg/col_piv_qr.rs @@ -331,16 +331,3 @@ where res * self.p.determinant() } } - -impl, C: Dim, S: Storage> Matrix -where - DefaultAllocator: Allocator - + Allocator - + Allocator> - + Allocator<(usize, usize), DimMinimum>, -{ - /// Computes the QR decomposition (with column pivoting) of this matrix. - pub fn col_piv_qr(self) -> ColPivQR { - ColPivQR::new(self.into_owned()) - } -} diff --git a/src/linalg/decomposition.rs b/src/linalg/decomposition.rs index 67cc4c6a..7890748c 100644 --- a/src/linalg/decomposition.rs +++ b/src/linalg/decomposition.rs @@ -1,8 +1,8 @@ use crate::storage::Storage; use crate::{ - Allocator, Bidiagonal, Cholesky, ComplexField, DefaultAllocator, Dim, DimDiff, DimMin, - DimMinimum, DimSub, FullPivLU, Hessenberg, Matrix, Schur, SymmetricEigen, SymmetricTridiagonal, - LU, QR, SVD, U1, + Allocator, Bidiagonal, Cholesky, ColPivQR, ComplexField, DefaultAllocator, Dim, DimDiff, + DimMin, DimMinimum, DimSub, FullPivLU, Hessenberg, Matrix, Schur, SymmetricEigen, + SymmetricTridiagonal, LU, QR, SVD, U1, }; /// # Rectangular matrix decomposition @@ -13,8 +13,9 @@ use crate::{ /// | Decomposition | Factors | Details | /// | -------------------------|---------------------|--------------| /// | 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 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. | impl> Matrix { /// Computes the bidiagonalization using householder reflections. @@ -60,6 +61,18 @@ impl> Matrix { QR::new(self.into_owned()) } + /// Computes the QR decomposition (with column pivoting) of this matrix. + pub fn col_piv_qr(self) -> ColPivQR + where + R: DimMin, + DefaultAllocator: Allocator + + Allocator + + Allocator> + + Allocator<(usize, usize), DimMinimum>, + { + ColPivQR::new(self.into_owned()) + } + /// Computes the Singular Value Decomposition using implicit shift. pub fn svd(self, compute_u: bool, compute_v: bool) -> SVD where