TNT::Linear_Algebra::QR< Real > Class Template Reference

#include <tnt_linalg.h>

Collaboration diagram for TNT::Linear_Algebra::QR< Real >:
[legend]

List of all members.

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

Private Attributes

Matrix< Real > QR_
int m
int n
Vector< Real > Rdiag


Detailed Description

template<class Real>
class TNT::Linear_Algebra::QR< Real >

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).

Definition at line 1565 of file tnt_linalg.h.


Constructor & Destructor Documentation

template<class Real >
TNT::Linear_Algebra::QR< Real >::QR ( const Matrix< Real > &  A  )  [inline]

Create a QR factorization object for A.

Parameters:
A rectangular (m>=n) matrix.

Definition at line 1593 of file tnt_linalg.h.


Member Function Documentation

template<class Real >
Matrix<Real> TNT::Linear_Algebra::QR< Real >::getHouseholder ( void   )  const [inline]

Retreive the Householder vectors from QR factorization

Returns:
lower trapezoidal matrix whose columns define the reflections

Definition at line 1660 of file tnt_linalg.h.

template<class Real >
Matrix<Real> TNT::Linear_Algebra::QR< Real >::getQ (  )  const [inline]

Returns:
Q the (ecnomy-sized) orthogonal factor (Q*R=A).

Definition at line 1712 of file tnt_linalg.h.

template<class Real >
Matrix<Real> TNT::Linear_Algebra::QR< Real >::getR (  )  const [inline]

Return the upper triangular factor, R, of the QR factorization

Returns:
R

Definition at line 1687 of file tnt_linalg.h.

template<class Real >
int TNT::Linear_Algebra::QR< Real >::isFullRank (  )  const [inline]

Flag to denote the matrix is of full rank.

Returns:
1 if matrix is full rank, 0 otherwise.

Definition at line 1641 of file tnt_linalg.h.

template<class Real >
Matrix<Real> TNT::Linear_Algebra::QR< Real >::solve ( const Matrix< Real > &  B  )  const [inline]

Least squares solution of A*X = B

Parameters:
B m x k Array (must conform).
Returns:
X n x k Array that minimizes the two norm of Q*R*X-B. If B is non-conformant, or if QR.isFullRank() is false, the routine returns a null (Real(0.0)) array.

Definition at line 1797 of file tnt_linalg.h.

template<class Real >
Vector<Real> TNT::Linear_Algebra::QR< Real >::solve ( const Vector< Real > &  b  )  const [inline]

Least squares solution of A*x = b

Parameters:
b right hand side (m-length vector).
Returns:
x n-length vector that minimizes the two norm of Q*R*X-B. If B is non-conformant, or if QR.isFullRank() is false, the routine returns a null (0-length) vector.

Definition at line 1746 of file tnt_linalg.h.


Member Data Documentation

template<class Real >
int TNT::Linear_Algebra::QR< Real >::m [private]

Definition at line 1578 of file tnt_linalg.h.

template<class Real >
int TNT::Linear_Algebra::QR< Real >::n [private]

Definition at line 1578 of file tnt_linalg.h.

template<class Real >
Matrix<Real> TNT::Linear_Algebra::QR< Real >::QR_ [private]

Definition at line 1572 of file tnt_linalg.h.

template<class Real >
Vector<Real> TNT::Linear_Algebra::QR< Real >::Rdiag [private]

Definition at line 1583 of file tnt_linalg.h.


The documentation for this class was generated from the following file:

Generated on Fri Feb 6 13:30:19 2009 for CorAL by  doxygen 1.5.8