lu
[L U P] = lu(X) applies lower upper decomposition on matrix X such that L*U = P*X with:
- L lower triangular
- U upper triangular
- P the permutation matrix
Examples
> X = [0 -1 4; 2 1 1; 1 1 -2]#
0 -1 4
2 1 1
1 1 -2
> [L U P] = lu(X)
[L:3x3 double]
[U:3x3 double]
[P:3x3 double]
> L#
1 0 0
0 1 0
0.5 -0.5 1
> U#
2 1 1
0 -1 4
0 0 -0.5
> P#
0 1 0
1 0 0
0 0 1