Essentia
2.1-beta6-dev
|
#include <jama_qr.h>
Public Member Functions | |
QR (const TNT::Array2D< Real > &A) | |
int | isFullRank () const |
TNT::Array2D< Real > | getHouseholder (void) const |
TNT::Array2D< Real > | getR () const |
TNT::Array2D< Real > | getQ () const |
TNT::Array1D< Real > | solve (const TNT::Array1D< Real > &b) const |
TNT::Array2D< Real > | solve (const TNT::Array2D< Real > &B) const |
Private Attributes | |
TNT::Array2D< Real > | QR_ |
int | m |
int | n |
TNT::Array1D< Real > | Rdiag |
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).
|
inline |
Create a QR factorization object for A.
A | rectangular (m>=n) matrix. |
References Array2D< T >::copy(), Array2D< T >::dim1(), Array2D< T >::dim2(), TNT::hypot(), QR< Real >::m, QR< Real >::n, QR< Real >::QR_, and QR< Real >::Rdiag.
|
inline |
Retreive the Householder vectors from QR factorization
References QR< Real >::m, QR< Real >::n, and QR< Real >::QR_.
|
inline |
Generate and return the (economy-sized) orthogonal factor
Q | the (ecnomy-sized) orthogonal factor (Q*R=A). |
References QR< Real >::m, QR< Real >::n, and QR< Real >::QR_.
|
inline |
Return the upper triangular factor, R, of the QR factorization
References QR< Real >::n, QR< Real >::QR_, and QR< Real >::Rdiag.
|
inline |
Flag to denote the matrix is of full rank.
References QR< Real >::n, and QR< Real >::Rdiag.
Referenced by QR< Real >::solve().
|
inline |
Least squares solution of A*x = b
B | m-length array (vector). |
References Array1D< T >::copy(), Array1D< T >::dim1(), QR< Real >::isFullRank(), QR< Real >::m, QR< Real >::n, QR< Real >::QR_, and QR< Real >::Rdiag.
|
inline |
Least squares solution of A*X = B
B | m x k Array (must conform). |
References Array2D< T >::copy(), Array2D< T >::dim1(), Array2D< T >::dim2(), QR< Real >::isFullRank(), QR< Real >::m, QR< Real >::n, QR< Real >::QR_, and QR< Real >::Rdiag.
|
private |
Row and column dimensions. @serial column dimension. @serial row dimension.
Referenced by QR< Real >::getHouseholder(), QR< Real >::getQ(), QR< Real >::QR(), and QR< Real >::solve().
|
private |
|
private |
Array for internal storage of decomposition. @serial internal array storage.
Referenced by QR< Real >::getHouseholder(), QR< Real >::getQ(), QR< Real >::getR(), QR< Real >::QR(), and QR< Real >::solve().
|
private |
Array for internal storage of diagonal of R. @serial diagonal of R.
Referenced by QR< Real >::getR(), QR< Real >::isFullRank(), QR< Real >::QR(), and QR< Real >::solve().