Class QR
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.factorization.qr.QR
-
- All Implemented Interfaces:
QRDecomposition
public class QR extends Object implements QRDecomposition
QR decomposition of a matrix decomposes an 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.
- sqQ is a square m x m orthogonal matrix;
- tallR is a m x n matrix.
- See Also:
- Wikipedia: QR decomposition
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PermutationMatrix
P()
Get P, the pivoting matrix in the QR decomposition.Matrix
Q()
Get the orthogonal Q matrix in the QR decomposition, A = QR.UpperTriangularMatrix
R()
Get the upper triangular matrix R in the QR decomposition, A = QR.int
rank()
Get the numerical rank of A as computed by the QR decomposition.Matrix
squareQ()
Get the square Q matrix.Matrix
tallR()
Get the tall R matrix.
-
-
-
Method Detail
-
P
public PermutationMatrix P()
Description copied from interface:QRDecomposition
Get P, the pivoting matrix in the QR decomposition.- Specified by:
P
in interfaceQRDecomposition
- Returns:
- P
-
Q
public Matrix Q()
Description copied from interface:QRDecomposition
Get the orthogonal Q matrix in the QR decomposition, A = QR. The dimension of Q is m x n, the same as A, the matrix to be orthogonalized.- Specified by:
Q
in interfaceQRDecomposition
- Returns:
- Q
-
R
public UpperTriangularMatrix R()
Description copied from interface:QRDecomposition
Get the upper triangular matrix R in the QR decomposition, A = QR. The dimension of R is n x n, a square matrix.- Specified by:
R
in interfaceQRDecomposition
- Returns:
- R
-
rank
public int rank()
Description copied from interface:QRDecomposition
Get the numerical rank of A as computed by the QR decomposition. Numerical determination of rank requires a criterion to decide when a value should be treated as zero, hence a precision parameter. 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.- Specified by:
rank
in interfaceQRDecomposition
- Returns:
- the rank of A
-
squareQ
public Matrix squareQ()
Description copied from interface:QRDecomposition
Get the square Q matrix. This is an arbitrary orthogonal completion of the Q matrix in the QR decomposition. The dimension is m x m (square). We have A = sqQ * tallR.- Specified by:
squareQ
in interfaceQRDecomposition
- Returns:
- the square Q matrix
-
tallR
public Matrix tallR()
Description copied from interface:QRDecomposition
Get the tall R matrix. This is completed by binding zero rows beneath the square upper triangular matrix R in the QR decomposition. The dimension is m x n. It may not be square. We have A = sqQ * tallR.- Specified by:
tallR
in interfaceQRDecomposition
- Returns:
- the tall R matrix
-
-