|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.matrix.doubles.factorization.qr.QR
public class QR
QR decomposition of a matrix.
It decomposes a m x n matrix A so that
A = Q %*% R
Q is an m x n orthogonal matrix,R is a n x n upper triangular matrix
Alternatively, we can have
A = sqQ %*% tallR
where
sqQ is a square m x m orthogonal matrix,
tallR is a m x n matrix
This decomposition can be used to
| Nested Class Summary | |
|---|---|
static class |
QR.Method
the methods available to do the QR decomposition |
| Field Summary | |
|---|---|
double |
epsilon
a precision parameter: when a number |x| ≤ ε, it is considered 0 |
| Constructor Summary | |
|---|---|
QR(Matrix A)
Construct an instance of the QR decomposition. |
|
QR(Matrix A,
QR.Method method,
double epsilon)
Construct an instance of the QR decomposition. |
|
| Method Summary | |
|---|---|
PermutationMatrix |
P()
Get a copy of P, the pivoting matrix in the QR decomposition. |
Matrix |
Q()
Get a copy of the orthogonal Q matrix in the QR decomposition. |
UpperTriangularMatrix |
R()
Get a copy of the upper triangular matrix R in the QR decomposition. |
int |
rank()
Get the numerical rank of the matrix A as computed by the QR decomposition. |
Matrix |
squareQ()
Get a copy of the square Q matrix. |
Matrix |
tallR()
Get a copy of the tall R matrix. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public final double epsilon
| Constructor Detail |
|---|
public QR(Matrix A,
QR.Method method,
double epsilon)
QR.Method.
A - a matrixmethod - a QR algorithm implementationepsilon - a precision parameter: when a number |x| ≤ ε, it is considered 0public QR(Matrix A)
A - a matrix| Method Detail |
|---|
public Matrix Q()
QRDecompositionQ matrix in the QR decomposition.
A = QR
Dimension of Q is nrows x ncols, same as A, the matrix to orthogonalize.
Q in interface QRDecompositionQ matrix in the QR decompositionpublic UpperTriangularMatrix R()
QRDecompositionR in the QR decomposition.
A = QR
Dimension of R is ncols x ncols, a square matrix.
R in interface QRDecompositionR in the QR decompositionpublic PermutationMatrix P()
QRDecompositionP, the pivoting matrix in the QR decomposition.
P in interface QRDecompositionP pivoting matrix in the QR decompositionpublic int rank()
QRDecomposition
Get the numerical rank of the matrix A as computed by the QR decomposition.
Numerical determination of rank requires a criterion to decide when a value should be treated as zero.
This is a practical choice which depends on both the matrix and the application. For instance, for a matrix with a big first eigenvector, we should accordingly decrease the precision to compute the rank.
You may need to change the precision parameter to accurately compute the rank. See the test cases for example.
rank in interface QRDecompositionApublic Matrix squareQ()
QRDecompositionQ matrix.
This is an arbitrary orthogonal completion of the Q matrix in the QR decomposition.
Dimension is nrows x nrows (square).
A = square_Q %*% tall_R
squareQ in interface QRDecompositionQ matrixpublic Matrix tallR()
QRDecompositionR matrix.
This is completed by binding zero rows beneath the square upper triangular matrix R in the QR decomposition.
Dimension is nrows x ncols. Note that this may no longer be square.
A = square_Q %*% tall_R
tallR in interface QRDecompositionR matrix
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||