Contents Previous Next Subchapters

Computing The LU Factorization Of A Matrix
Syntax [L,U] = lu(X)
[L,UP] = lu(X)
See Also qred , svd , schur

Description
Computes matrices L and U such that
     X = L * U
where X is a real, double-precision or complex square matrix .

L
is a matrix with the same type and dimension as X. If the argument P is present, L is a lower triangular matrix with ones along the diagonal. If the argument P is not present, there is a permutation matrix P such that P * L is lower triangular with ones along the diagonal.

U
is an upper triangular matrix with the same type and dimension as X.

P
If the argument P is present, it is a permutation matrix and
     P * X = L * U
(Note that this equation can also be written as X = (P' * X) * U and P' corresponds to the permutation matrix mentioned for the case where the argument P is not present.)

Example
If you enter
     x = {[1., .5], [.5, 1.]}
     [l, u] = lu(x)
     print l * u
O-Matrix will respond
     {
     [ 1 , .5 ]
     [ .5 , 1 ]
     }
which is equal to the matrix x. If you continue by entering
     print l
O-Matrix will respond
     {
     [  1 , 0 ]
     [ .5 , 1 ]
     }
If you then enter
     print u
O-Matrix will respond
     {
     [ 1 , .5 ]
     [ 0 , .75 ]
     }