public class QRDecomposition extends 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(double[][] A)
Constructor.
|
QRDecomposition(double[][] A,
boolean overwrite)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double[][] |
getH()
Returns the Householder vectors.
|
double[][] |
getQ()
Returns the orthogonal factor.
|
double[][] |
getR()
Returns the upper triangular factor.
|
double[][] |
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(double[] b)
Solve the least squares A * x = b.
|
void |
solve(double[][] B)
Solve the least squares A * X = B.
|
void |
solve(double[][] B,
double[][] 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 - rectangular matrixpublic QRDecomposition(double[][] A,
boolean overwrite)
A - rectangular matrixoverwrite - true if the decomposition will be taken in place. If true,
the decomposition will be stored in the input matrix to save space. It
is very useful in practice if the matrix is huge. Otherwise, a new
matrix will created to store the decomposition.public boolean isFullColumnRank()
public boolean isSingular()
public double[][] getH()
public CholeskyDecomposition toCholesky()
public double[][] getR()
public double[][] getQ()
public double[][] inverse()
public void solve(double[] b)
b - right hand side of linear system. On output, b will be
overwritten with the solution vector.RuntimeException - if matrix is rank deficient.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.RuntimeException - if matrix is rank deficient.public void solve(double[][] B)
B - right hand side of linear system. B will be overwritten with
the solution matrix on output.RuntimeException - Matrix is rank deficient.public void solve(double[][] B,
double[][] X)
B - right hand side of linear system.X - the solution matrix that minimizes the L2 norm of Q*R*X - B.RuntimeException - Matrix is rank deficient.public void update(double[] u,
double[] v)
Copyright © 2015. All rights reserved.