class QRDecomposition (View source)

For an m-by-n matrix A with m >= n, the QR decomposition is an m-by-n orthogonal matrix Q and an n-by-n upper triangular matrix R so that A = Q*R.

The QR decompostion 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 nonsquare systems of simultaneous linear equations. This will fail if isFullRank() returns false.

Constants

MATRIX_RANK_EXCEPTION

Methods

__construct(matrix $A)

QR Decomposition computed by Householder reflections.

bool
isFullRank()

Is the matrix full rank?

getH()

Return the Householder vectors.

getR()

Return the upper triangular factor.

getQ()

Generate and return the (economy-sized) orthogonal factor.

solve(Matrix $B)

Least squares solution of A*X = B.

Details

__construct(matrix $A)

QR Decomposition computed by Householder reflections.

Parameters

matrix $A Rectangular matrix

bool isFullRank()

Is the matrix full rank?

Return Value

bool true if R, and hence A, has full rank, else false

Matrix getH()

Return the Householder vectors.

Return Value

Matrix Lower trapezoidal matrix whose columns define the reflections

Matrix getR()

Return the upper triangular factor.

Return Value

Matrix upper triangular factor

Matrix getQ()

Generate and return the (economy-sized) orthogonal factor.

Return Value

Matrix orthogonal factor

Matrix solve(Matrix $B)

Least squares solution of A*X = B.

Parameters

Matrix $B a Matrix with as many rows as A and any number of columns

Return Value

Matrix matrix that minimizes the two norm of QRX-B