QR factorization using Householder reflectors.
Vector R_diag
Contains the diagonal elements of R.
std::ostream & operator<<(std::ostream &os, const HouseholderQR &qr)
Print the Q and R matrices of a HouseholderQR object.
HouseholderQR()=default
Default constructor.
void apply_QT_inplace(Matrix &B) const
Compute the product QᵀB, overwriting B with the result.
void get_Q_inplace(SquareMatrix &Q) const
Compute the unitary matrix Q and copy it to the given matrix.
Matrix solve(const Matrix &B) const
Solve the system AX = B or QRX = B.
Matrix apply_Q(const Matrix &X) const
Compute the product QB.
Matrix get_R() const &
Get a copy of the upper-triangular matrix R.
const Vector & get_R_diag() const &
Get the internal storage of the diagonal elements of R.
Vector && get_R_diag() &&
Get the internal storage of the diagonal elements of R.
Matrix && steal_R()
Get the upper-triangular matrix R, reusing the internal storage.
enum HouseholderQR::State state
void back_subs(const Matrix &B, Matrix &X) const
Back substitution algorithm for solving upper-triangular systems RX = B.
Matrix RW
Result of a Householder QR factorization: stores the strict upper-triangular part of matrix R and the...
Matrix apply_QT(const Matrix &B) const
Compute the product QᵀB.
void solve_inplace(Matrix &B) const
Solve the system AX = B or QRX = B.
bool is_factored() const
Check if this object contains a valid factorization.
void compute_factorization()
The actual QR factorization algorithm.
SquareMatrix get_Q() const
Compute the unitary matrix Q.
HouseholderQR(Matrix &&matrix)
Factorize the given matrix.
const Matrix & get_RW() const &
Get the internal storage of the strict upper-triangular part of R and the Householder reflector vecto...
HouseholderQR(const Matrix &matrix)
Factorize the given matrix.
void compute(Matrix &&matrix)
Perform the QR factorization of the given matrix.
void get_R_inplace(Matrix &R) const
Copy the upper-triangular matrix R to the given matrix.
Matrix && get_RW() &&
Get the internal storage of the strict upper-triangular part of R and the Householder reflector vecto...
void apply_Q_inplace(Matrix &X) const
Compute the product QB, overwriting B with the result.
A column vector (n×1 matrix).