Package org.apache.commons.math.linear
Class QRDecompositionImpl
java.lang.Object
org.apache.commons.math.linear.QRDecompositionImpl
- All Implemented Interfaces:
QRDecomposition
Calculates the QR-decomposition of a matrix.
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.
This class compute the decomposition using Householder reflectors.
For efficiency purposes, the decomposition in packed form is transposed. This allows inner loop to iterate inside rows, which is much more cache-efficient in Java.
- Since:
- 1.2
- Version:
- $Revision: 990655 $ $Date: 2010-08-29 23:49:40 +0200 (dim. 29 août 2010) $
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionQRDecompositionImpl
(RealMatrix matrix) Calculates the QR-decomposition of the given matrix. -
Method Summary
Modifier and TypeMethodDescriptiongetH()
Returns the Householder reflector vectors.getQ()
Returns the matrix Q of the decomposition.getQT()
Returns the transpose of the matrix Q of the decomposition.getR()
Returns the matrix R of the decomposition.Get a solver for finding the A × X = B solution in least square sense.
-
Constructor Details
-
QRDecompositionImpl
Calculates the QR-decomposition of the given matrix.- Parameters:
matrix
- The matrix to decompose.
-
-
Method Details
-
getR
Returns the matrix R of the decomposition.R is an upper-triangular matrix
- Specified by:
getR
in interfaceQRDecomposition
- Returns:
- the R matrix
-
getQ
Returns the matrix Q of the decomposition.Q is an orthogonal matrix
- Specified by:
getQ
in interfaceQRDecomposition
- Returns:
- the Q matrix
-
getQT
Returns the transpose of the matrix Q of the decomposition.Q is an orthogonal matrix
- Specified by:
getQT
in interfaceQRDecomposition
- Returns:
- the Q matrix
-
getH
Returns the Householder reflector vectors.H is a lower trapezoidal matrix whose columns represent each successive Householder reflector vector. This matrix is used to compute Q.
- Specified by:
getH
in interfaceQRDecomposition
- Returns:
- a matrix containing the Householder reflector vectors
-
getSolver
Get a solver for finding the A × X = B solution in least square sense.- Specified by:
getSolver
in interfaceQRDecomposition
- Returns:
- a solver
-