OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
JAMA::QR< Real > Class Template Reference

#include <QR.hpp>

Public Member Functions

 for (k=0;k< n;k++)
 
int isFullRank () const
 Flag to denote the matrix is of full rank.
 
DynamicRectMatrix< Real > getHouseholder (void) const
 Retreive the Householder vectors from QR factorization.
 
DynamicRectMatrix< Real > getR () const
 Return the upper triangular factor, R, of the QR factorization.
 
DynamicRectMatrix< Real > getQ () const
 Generate and return the (economy-sized) orthogonal factor.
 
DynamicVector< Real > solve (const DynamicVector< Real > &b) const
 Least squares solution of A*x = b.
 
DynamicRectMatrix< Real > solve (const DynamicRectMatrix< Real > &B) const
 Least squares solution of A*X = B.
 

Public Attributes

 m = A.getNRow()
 Create a QR factorization object for A.
 
 n = A.getNCol()
 
 Rdiag = DynamicVector<Real>(n)
 
int i = 0
 
int j = 0
 
int k = 0
 

Detailed Description

template<class Real>
class JAMA::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 37 of file QR.hpp.

Member Function Documentation

◆ for()

template<class Real >
JAMA::QR< Real >::for ( )
inline

Definition at line 70 of file QR.hpp.

◆ getHouseholder()

template<class Real >
DynamicRectMatrix< Real > JAMA::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 118 of file QR.hpp.

◆ getQ()

template<class Real >
DynamicRectMatrix< Real > JAMA::QR< Real >::getQ ( ) const
inline

Generate and return the (economy-sized) orthogonal factor.

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

Definition at line 159 of file QR.hpp.

◆ getR()

template<class Real >
DynamicRectMatrix< Real > JAMA::QR< Real >::getR ( ) const
inline

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

Returns
R

Definition at line 139 of file QR.hpp.

◆ isFullRank()

template<class Real >
int JAMA::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 106 of file QR.hpp.

Referenced by JAMA::QR< Real >::solve(), and JAMA::QR< Real >::solve().

◆ solve() [1/2]

template<class Real >
DynamicRectMatrix< Real > JAMA::QR< Real >::solve ( const DynamicRectMatrix< Real > & B) const
inline

Least squares solution of A*X = B.

Parameters
Bm 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 (0x0) array.

Definition at line 234 of file QR.hpp.

References JAMA::QR< Real >::isFullRank().

◆ solve() [2/2]

template<class Real >
DynamicVector< Real > JAMA::QR< Real >::solve ( const DynamicVector< Real > & b) const
inline

Least squares solution of A*x = b.

Parameters
bm-length array (vector).
Returns
x n-length array (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 190 of file QR.hpp.

References JAMA::QR< Real >::isFullRank().

Member Data Documentation

◆ i

template<class Real >
int JAMA::QR< Real >::i = 0

Definition at line 67 of file QR.hpp.

◆ j

template<class Real >
int JAMA::QR< Real >::j = 0

Definition at line 67 of file QR.hpp.

◆ k

template<class Real >
int JAMA::QR< Real >::k = 0

Definition at line 67 of file QR.hpp.

◆ m

template<class Real >
JAMA::QR< Real >::m = A.getNRow()

Create a QR factorization object for A.

Parameters
Arectangular (m>=n) matrix.

Definition at line 64 of file QR.hpp.

◆ n

template<class Real >
JAMA::QR< Real >::n = A.getNCol()

Definition at line 65 of file QR.hpp.

◆ Rdiag

template<class Real >
JAMA::QR< Real >::Rdiag = DynamicVector<Real>(n)

Definition at line 66 of file QR.hpp.


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