Package org.biojava.nbio.structure.jama
Class QRDecomposition
- java.lang.Object
-
- org.biojava.nbio.structure.jama.QRDecomposition
-
- All Implemented Interfaces:
Serializable
public class QRDecomposition extends Object implements Serializable
QR Decomposition.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 false.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description QRDecomposition(Matrix A)
QR Decomposition, computed by Householder reflections. provides a data structure to access R and the Householder vectors and compute Q.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Matrix
getH()
Return the Householder vectorsMatrix
getQ()
Generate and return the (economy-sized) orthogonal factorMatrix
getR()
Return the upper triangular factorboolean
isFullRank()
Is the matrix full rank?Matrix
solve(Matrix B)
Least squares solution of A*X = B
-
-
-
Constructor Detail
-
QRDecomposition
public QRDecomposition(Matrix A)
QR Decomposition, computed by Householder reflections. provides a data structure to access R and the Householder vectors and compute Q.- Parameters:
A
- Rectangular matrix
-
-
Method Detail
-
isFullRank
public boolean isFullRank()
Is the matrix full rank?- Returns:
- true if R, and hence A, has full rank.
-
getH
public Matrix getH()
Return the Householder vectors- Returns:
- Lower trapezoidal matrix whose columns define the reflections
-
solve
public Matrix solve(Matrix B)
Least squares solution of A*X = B- Parameters:
B
- A Matrix with as many rows as A and any number of columns.- Returns:
- X that minimizes the two norm of Q*R*X-B.
- Throws:
IllegalArgumentException
- Matrix row dimensions must agree.RuntimeException
- Matrix is rank deficient.
-
-