|
NumericAL
A header-only C++20 lexer built on REAL
|
A QR factorisation with column pivoting A P = Q R of an m × n matrix, as scipy.linalg.qr(a, pivoting=True) (LAPACK's geqp3): at each step the column of largest remaining norm moved first, so R's diagonal does not grow in modulus down the diagonal and reveals A's numerical rank; the norms downdated as LAPACK's laqp2 downdates them, recomputed where the downdate has lost too much (√ε). Householder reflectors as larfg forms them; R's diagonal then made real and non-negative, as qr_decomposition's (Q's columns taking the phases), where LAPACK's may be negative.
More...
#include <factorizations.hpp>
Public Member Functions | |
| pivoted_qr_decomposition (const matrix< T > &a, qr_mode mode=qr_mode::reduced) | |
Factorises a: Q m × k and R k × n (k = min(m, n)), or Q m × m and R m × n (mode complete). | |
| const matrix< T > & | q () const noexcept |
Q, orthonormal columns: m × k, or m × m complete. | |
| const matrix< T > & | r () const noexcept |
R, upper trapezoidal, its diagonal real, non-negative and not increasing: k × n, or m × n. | |
| const std::vector< std::size_t > & | permutation () const noexcept |
The column permutation: column j of A P is column permutation()[j] of A, as SciPy's P. | |
Private Member Functions | |
| std::size_t | factor_block (buffer< T > &w, std::size_t m, std::size_t n, std::size_t start, std::size_t width, buffer< double > ¤t, buffer< double > &reference, std::vector< buffer< T > > &reflectors, std::vector< T > &taus) |
Up to width steps from column start of the column-major m × n w, as LAPACK's laqps: the reflections kept aside in F (A ← A − V Fᴴ, F(j, ·) = τ A(:, j)ᴴ v less the earlier reflectors' share), each step's pivot column and pivot row brought up to date alone, the rest of the matrix by one product at the end; a column whose norm downdate lost too much (√ε) ends the block, its norm recomputed after the product. | |
Private Attributes | |
| matrix< T > | q_ |
| Q. | |
| matrix< T > | r_ |
| R. | |
| std::vector< std::size_t > | permutation_ |
| P, by its columns' origins. | |
Static Private Attributes | |
| static constexpr std::size_t | pivoted_qr_block {32} |
geqp3's block of columns (NB). | |
| static constexpr std::size_t | pivoted_qr_crossover {128} |
The columns geqp3 leaves to the unblocked steps (NX). | |
| static constexpr std::size_t | pivoted_qr_band {16} |
| The columns one thread takes of a block's updates. | |
A QR factorisation with column pivoting A P = Q R of an m × n matrix, as scipy.linalg.qr(a, pivoting=True) (LAPACK's geqp3): at each step the column of largest remaining norm moved first, so R's diagonal does not grow in modulus down the diagonal and reveals A's numerical rank; the norms downdated as LAPACK's laqp2 downdates them, recomputed where the downdate has lost too much (√ε). Householder reflectors as larfg forms them; R's diagonal then made real and non-negative, as qr_decomposition's (Q's columns taking the phases), where LAPACK's may be negative.
Definition at line 4016 of file factorizations.hpp.
|
inlineexplicit |
Factorises a: Q m × k and R k × n (k = min(m, n)), or Q m × m and R m × n (mode complete).
| non_finite_error | If an entry is infinite or NaN. |
Definition at line 4025 of file factorizations.hpp.
|
inlineprivate |
Up to width steps from column start of the column-major m × n w, as LAPACK's laqps: the reflections kept aside in F (A ← A − V Fᴴ, F(j, ·) = τ A(:, j)ᴴ v less the earlier reflectors' share), each step's pivot column and pivot row brought up to date alone, the rest of the matrix by one product at the end; a column whose norm downdate lost too much (√ε) ends the block, its norm recomputed after the product.
Definition at line 4161 of file factorizations.hpp.
|
inlinenoexcept |
The column permutation: column j of A P is column permutation()[j] of A, as SciPy's P.
Definition at line 4143 of file factorizations.hpp.
|
inlinenoexcept |
Q, orthonormal columns: m × k, or m × m complete.
Definition at line 4131 of file factorizations.hpp.
|
inlinenoexcept |
R, upper trapezoidal, its diagonal real, non-negative and not increasing: k × n, or m × n.
Definition at line 4137 of file factorizations.hpp.
|
private |
P, by its columns' origins.
Definition at line 4289 of file factorizations.hpp.
|
staticconstexprprivate |
The columns one thread takes of a block's updates.
Definition at line 4152 of file factorizations.hpp.
|
staticconstexprprivate |
geqp3's block of columns (NB).
Definition at line 4150 of file factorizations.hpp.
|
staticconstexprprivate |
The columns geqp3 leaves to the unblocked steps (NX).
Definition at line 4151 of file factorizations.hpp.
|
private |
Q.
Definition at line 4287 of file factorizations.hpp.
|
private |
R.
Definition at line 4288 of file factorizations.hpp.