public class QRDecomposition extends Object implements QR
m >= n
, the QR decomposition is an m x n
orthogonal matrix Q and an n x n upper triangular matrix R so that
A = Q*R.
The QR decomposition 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 non-square systems of simultaneous linear equations. This will fail if isFullRank() returns false.
Constructor and Description |
---|
QRDecomposition(Matrix a)
Constructs and returns a new QR decomposition object; computed by Householder reflections; The
decomposed matrices can be retrieved via instance methods of the returned decomposition
object.
|
Modifier and Type | Method and Description |
---|---|
Matrix |
getQ()
Generates and returns the (economy-sized) orthogonal factor Q.
|
Matrix |
getR()
Returns the upper triangular factor, R.
|
boolean |
hasFullRank()
Returns whether the matrix A has full rank.
|
Matrix |
solve(Matrix B)
Least squares solution of A*X = B; returns X.
|
String |
toString()
Returns a rough string rendition of a QR.
|
public QRDecomposition(Matrix a)
a
- A rectangular matrix.IllegalArgumentException
- if A.rows() < A.columns()
.public Matrix getQ()
public Matrix getR()
public boolean hasFullRank()
hasFullRank
in interface QR
public Matrix solve(Matrix B)
solve
in interface QR
B
- A matrix with as many rows as A and any number of columns.IllegalArgumentException
- if B.rows() != A.rows().Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.