org.apache.commons.math.linear
Class QRDecompositionImpl

java.lang.Object
  extended by org.apache.commons.math.linear.QRDecompositionImpl
All Implemented Interfaces:
QRDecomposition

public class QRDecompositionImpl
extends java.lang.Object
implements QRDecomposition

Calculates the QR-decomposition of a matrix. In the QR-decomposition of a matrix A consists of two matrices Q and R that satisfy: A = QR, Q is orthogonal (QTQ = I), and R is upper triangular. If A is m×n, Q is m×m and R m×n.

Implemented using Householder reflectors.

Since:
1.2
Version:
$Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $
See Also:
MathWorld, Wikipedia

Field Summary
private  int m
          The row dimension of the given matrix.
private  int n
          The column dimension of the given matrix.
private  double[][] qr
          A packed representation of the QR decomposition.
private  double[] rDiag
          The diagonal elements of R.
 
Constructor Summary
QRDecompositionImpl(RealMatrix matrix)
          Calculates the QR decomposition of the given matrix.
 
Method Summary
 RealMatrix getQ()
          Returns the matrix Q of the QR-decomposition.
 RealMatrix getR()
          Returns the matrix R of the QR-decomposition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

qr

private double[][] qr
A packed representation of the QR decomposition. The elements above the diagonal are the elements of R, and the columns of the lower triangle are the Householder reflector vectors of which an explicit form of Q can be calculated.


rDiag

private double[] rDiag
The diagonal elements of R.


m

private int m
The row dimension of the given matrix. The size of Q will be m x m, the size of R will be m x n.


n

private int n
The column dimension of the given matrix. The size of R will be m x n.

Constructor Detail

QRDecompositionImpl

public QRDecompositionImpl(RealMatrix matrix)
Calculates the QR decomposition of the given matrix.

Parameters:
matrix - The matrix to decompose.
Method Detail

getR

public RealMatrix getR()
Returns the matrix R of the QR-decomposition.

Specified by:
getR in interface QRDecomposition
Returns:
the R matrix

getQ

public RealMatrix getQ()
Returns the matrix Q of the QR-decomposition.

Specified by:
getQ in interface QRDecomposition
Returns:
the Q matrix