edu.mines.jtk.lapack
Class DMatrixQrd

java.lang.Object
  extended by edu.mines.jtk.lapack.DMatrixQrd

public class DMatrixQrd
extends java.lang.Object

QR decomposition of a matrix A. For an m-by-n matrix A, with m>=n, the QR decomposition is A = Q*R, where Q is an m-by-n orthogonal matrix, and R is an n-by-n upper-triangular matrix.

The QR decomposition is constructed even if the matrix A is rank deficient. However, the primary use of the QR decomposition is for least-squares solutions of non-square systems of linear equations, and such solutions are feasible only if the matrix A is of full rank.

Version:
2005.12.14
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
DMatrixQrd(DMatrix a)
          Constructs a QR decomposition for the specified matrix A.
 
Method Summary
 DMatrix getQ()
          Gets the m-by-n matrix factor Q.
 DMatrix getR()
          Gets the upper triangular n-by-n matrix factor R.
 boolean isFullRank()
          Determines whether the matrix A = Q*R is of full rank.
 DMatrix solve(DMatrix b)
          Returns the least-squares solution X of the system A*X = B.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DMatrixQrd

public DMatrixQrd(DMatrix a)
Constructs a QR decomposition for the specified matrix A.

Parameters:
a - the m-by-n matrix A with m>=n.
Method Detail

isFullRank

public boolean isFullRank()
Determines whether the matrix A = Q*R is of full rank.

Returns:
true, if full rank; false, otherwise.

getQ

public DMatrix getQ()
Gets the m-by-n matrix factor Q.

Returns:
the m-by-n matrix factor Q.

getR

public DMatrix getR()
Gets the upper triangular n-by-n matrix factor R.

Returns:
the n-by-n matrix factor R.

solve

public DMatrix solve(DMatrix b)
Returns the least-squares solution X of the system A*X = B. This solution exists only if the matrix A is of full rank.

Parameters:
b - a matrix of right-hand-side vectors. This matrix must have the same number (m) of rows as the matrix A, but may have any number of columns.
Returns:
the matrix X that minimizes the two-norm of A*X-B.
Throws:
java.lang.IllegalStateException - if A is rank-deficient.