lu
LU decomposition.
Syntax
LU = lu(A)
[L,U] = lu(A)
[L,U,P] = lu(A)
Inputs
- A
 - The matrix to decompose.
 
Outputs
- LU
 - The combined decomposition in one matrix, with the diagonal belonging to the upper triangular matrix.
 - L
 - Lower triangular matrix.
 - U
 - Upper triangular matrix.
 - P
 - Permutation matrix.
 
Example
[L,U,P] = lu([5,6,7,8;15,54,73,81;10,21,24,27])
      L = [Matrix] 3 x 3
1.00000  0.00000  0.00000
0.66667  1.00000  0.00000
0.33333  0.80000  1.00000
U = [Matrix] 3 x 4
15.00000   54.00000   73.00000   81.00000
 0.00000  -15.00000  -24.66667  -27.00000
 0.00000    0.00000    2.40000    2.60000
P = [Matrix] 3 x 3
0  1  0
0  0  1
1  0  0
    Comments
[L,U] = lu(A) computes matrices L and U such that A = LU.
[L,U,P] = lu(A) computes matrices L, U and P such that PA = LU.
lu uses the LAPACK routines 'dgetrf' for real matrices and 'zgetrf' for complex matrices.