#include <tnt_linalg.h>
Public Member Functions | |
QR (const Matrix< Real > &A) | |
int | isFullRank () const |
Matrix< Real > | getHouseholder (void) const |
Matrix< Real > | getR () const |
Matrix< Real > | getQ () const |
Vector< Real > | solve (const Vector< Real > &b) const |
Matrix< Real > | solve (const Matrix< Real > &B) const |
Classical QR Decompisition: for an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n orthogonal matrix Q and an n-by-n upper triangular matrix R so that A = Q*R.
The QR decompostion always exists, even if the matrix does not have full rank, so the constructor will never fail. The primary use of the QR decomposition is in the least squares solution of nonsquare systems of simultaneous linear equations. This will fail if isFullRank() returns 0 (false).
The Q and R factors can be retrived via the getQ() and getR() methods. Furthermore, a solve() method is provided to find the least squares solution of Ax=b using the QR factors.
(Adapted from JAMA, a Java Matrix Library, developed by jointly by the Mathworks and NIST; see http://math.nist.gov/javanumerics/jama).
TNT::Linear_Algebra::QR< Real >::QR | ( | const Matrix< Real > & | A | ) | [inline] |
Create a QR factorization object for A.
A | rectangular (m>=n) matrix. |
Matrix<Real> TNT::Linear_Algebra::QR< Real >::getHouseholder | ( | void | ) | const [inline] |
Retreive the Householder vectors from QR factorization
Matrix<Real> TNT::Linear_Algebra::QR< Real >::getQ | ( | ) | const [inline] |
Matrix<Real> TNT::Linear_Algebra::QR< Real >::getR | ( | ) | const [inline] |
Return the upper triangular factor, R, of the QR factorization
int TNT::Linear_Algebra::QR< Real >::isFullRank | ( | ) | const [inline] |
Flag to denote the matrix is of full rank.
Matrix<Real> TNT::Linear_Algebra::QR< Real >::solve | ( | const Matrix< Real > & | B | ) | const [inline] |
Least squares solution of A*X = B
B | m x k Array (must conform). |
Vector<Real> TNT::Linear_Algebra::QR< Real >::solve | ( | const Vector< Real > & | b | ) | const [inline] |
Least squares solution of A*x = b
b | right hand side (m-length vector). |