public class QRDecomposition
extends java.lang.Object
The QR decomposition always exists, even if the matrix does not have
full rank. The primary use of the QR decomposition is in the least squares
solution of non-square systems of simultaneous linear equations, where
isFullColumnRank() has to be true.
QR decomposition is also the basis for a particular eigenvalue algorithm, the QR algorithm.
| Constructor and Description |
|---|
QRDecomposition(DenseMatrix A)
Constructor.
|
QRDecomposition(double[][] A)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
DenseMatrix |
getH()
Returns the Householder vectors.
|
DenseMatrix |
getQ()
Returns the orthogonal factor.
|
DenseMatrix |
getR()
Returns the upper triangular factor.
|
DenseMatrix |
inverse()
Returns the matrix pseudo inverse.
|
boolean |
isFullColumnRank()
Returns true if the matrix is full column rank.
|
boolean |
isSingular()
Returns true if the matrix is singular.
|
void |
solve(DenseMatrix B)
Solve the least squares A * X = B.
|
void |
solve(DenseMatrix B,
DenseMatrix X)
Solve the least squares A * X = B.
|
void |
solve(double[] b,
double[] x)
Solve the least squares A*x = b.
|
CholeskyDecomposition |
toCholesky()
Returns the Cholesky decomposition of A'A.
|
void |
update(double[] u,
double[] v)
Rank-1 update of the QR decomposition for A = A + u * v.
|
public QRDecomposition(double[][] A)
A - input matrixpublic QRDecomposition(DenseMatrix A)
A - input matrixpublic boolean isFullColumnRank()
public boolean isSingular()
public DenseMatrix getH()
public CholeskyDecomposition toCholesky()
public DenseMatrix getR()
public DenseMatrix getQ()
public DenseMatrix inverse()
public void solve(double[] b,
double[] x)
b - right hand side of linear system.x - the solution vector that minimizes the L2 norm of Q*R*x - b.java.lang.RuntimeException - if matrix is rank deficient.public void solve(DenseMatrix B)
B - right hand side of linear system. B will be overwritten with
the solution matrix on output.java.lang.RuntimeException - Matrix is rank deficient.public void solve(DenseMatrix B, DenseMatrix X)
B - right hand side of linear system.X - the solution matrix that minimizes the L2 norm of Q*R*X - B.java.lang.RuntimeException - Matrix is rank deficient.public void update(double[] u,
double[] v)