# SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.algebra.linear.matrix.doubles.factorization.qr

## Interface QRDecomposition

• All Known Implementing Classes:
GramSchmidt, HouseholderQR, QR

public interface 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.
Alternatively, we can have A = sqQ * tallR, where
• sqQ is a square m x m orthogonal matrix;
• tallR is a m x n matrix.
Wikipedia: QR decomposition
• ### Method Summary

All Methods
Modifier and Type Method and 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

PermutationMatrix P()
Get P, the pivoting matrix in the QR decomposition.
Returns:
P
• #### Q

Matrix Q()
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.
Returns:
Q
• #### R

UpperTriangularMatrix R()
Get the upper triangular matrix R in the QR decomposition, A = QR. The dimension of R is n x n, a square matrix.
Returns:
R
• #### rank

int rank()
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.
Returns:
the rank of A
• #### squareQ

Matrix squareQ()
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.
Returns:
the square Q matrix
• #### tallR

Matrix tallR()
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.
Returns:
the tall R matrix