Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

# LA::QR Class Reference

`#include <LA_Qr_decomp.h>`

Collaboration diagram for LA::QR:

[legend]
List of all members.

## Public Member Functions
| QR (const Matrix &A)
| Create a QR factorization object for A.
bool | isFullRank () const
| Flag to denote the matrix is of full rank.
Matrix | getHouseholder () const
| Retreive the Householder vectors from QR factorization.
Matrix | getR () const
| Return the upper triangular factor, R, of the QR factorization.
Matrix | getQ () const
| Generate and return the (economy-sized) orthogonal factor.
Vector | solve (const Vector &b) const
| Least squares solution of A*x = b.
## Private Attributes
Matrix | QR_
int | m
int | n
Vector | Rdiag

## Detailed Description

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 41 of file LA_Qr_decomp.h.

## Constructor & Destructor Documentation

LA::QR::QR | ( | const Matrix & | A | ) |

  | Create a QR factorization object for A. Parameters:
  A | rectangular (rows>=columns) matrix.
Definition at line 9 of file LA_Qr_decomp.cpp. References LA::Vector::create(), QR_, and Rdiag.

Here is the call graph for this function:

## Member Function Documentation

bool LA::QR::isFullRank | ( |  | ) | const

| Flag to denote the matrix is of full rank. Returns: true if matrix is full rank, false otherwise. Definition at line 59 of file LA_Qr_decomp.cpp. References Rdiag. Referenced by solve().

Matrix LA::QR::getHouseholder | ( |  | ) | const

| Retreive the Householder vectors from QR factorization. Returns: lower trapezoidal matrix whose columns define the reflections Definition at line 69 of file LA_Qr_decomp.cpp. References QR_.

Matrix LA::QR::getR | ( |  | ) | const

| Return the upper triangular factor, R, of the QR factorization. Returns: R Definition at line 90 of file LA_Qr_decomp.cpp. References QR_, and Rdiag.

Matrix LA::QR::getQ | ( |  | ) | const

| Generate and return the (economy-sized) orthogonal factor. Returns: Q the (ecnomy-sized) orthogonal factor (Q*R=A). Definition at line 114 of file LA_Qr_decomp.cpp. References QR_.

Vector LA::QR::solve | ( | const Vector & | b | ) | const

  | Least squares solution of A*x = b. Parameters:
  b | m-length array (vector).
Returns: x n-length array (vector) that minimizes the two norm of Q*R*X-B. Definition at line 146 of file LA_Qr_decomp.cpp. References LA::Vector::dim(), isFullRank(), QR_, and Rdiag.

Here is the call graph for this function:

## Member Data Documentation

Matrix LA::QR::QR_`[private]`

| Definition at line 84 of file LA_Qr_decomp.h. Referenced by getHouseholder(), getQ(), getR(), QR(), and solve().

int LA::QR::m`[private]`

| Definition at line 85 of file LA_Qr_decomp.h.

int LA::QR::n`[private]`

| Definition at line 86 of file LA_Qr_decomp.h.

Vector LA::QR::Rdiag`[private]`

| Definition at line 87 of file LA_Qr_decomp.h. Referenced by getR(), isFullRank(), QR(), and solve().

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

- Tools/Math/LA_Qr_decomp.h
- Tools/Math/LA_Qr_decomp.cpp