class LUDecomposition (View source)

For an m-by-n matrix A with m >= n, the LU decomposition is an m-by-n unit lower triangular matrix L, an n-by-n upper triangular matrix U, and a permutation vector piv of length m so that A(piv,:) = L*U.

If m < n, then L is m-by-m and U is m-by-n.

The LU decompostion with pivoting always exists, even if the matrix is singular, so the constructor will never fail. The primary use of the LU decomposition is in the solution of square systems of simultaneous linear equations. This will fail if isNonsingular() returns false.

Constants

MATRIX_SINGULAR_EXCEPTION

MATRIX_SQUARE_EXCEPTION

Methods

__construct(Matrix $A)

LU Decomposition constructor.

getL()

Get lower triangular factor.

getU()

Get upper triangular factor.

array
getPivot()

Return pivot permutation vector.

getDoublePivot()

Alias for getPivot.

bool
isNonsingular()

Is the matrix nonsingular?

array
det()

Count determinants.

solve(mixed $B)

Solve A*X = B.

Details

__construct(Matrix $A)

LU Decomposition constructor.

Parameters

Matrix $A Rectangular matrix

Matrix getL()

Get lower triangular factor.

Return Value

Matrix Lower triangular factor

Matrix getU()

Get upper triangular factor.

Return Value

Matrix Upper triangular factor

array getPivot()

Return pivot permutation vector.

Return Value

array Pivot vector

getDoublePivot()

Alias for getPivot.

see getPivot

bool isNonsingular()

Is the matrix nonsingular?

Return Value

bool true if U, and hence A, is nonsingular

array det()

Count determinants.

Return Value

array d matrix deterninat

Matrix solve(mixed $B)

Solve A*X = B.

Parameters

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

Return Value

Matrix X so that LUX = B(piv,:)

Exceptions

Exception illegalArgumentException Matrix row dimensions must agree
Exception runtimeException Matrix is singular