lu
LU decomposition (with partial pivoting).
Syntax
Section titled “Syntax”[L, U] = lu(A)[L, U, P] = lu(A)[L, U, P, Q] = lu(A) % sparse onlyY = lu(A) % packed compact formDescription
Section titled “Description”Decomposes A into a lower-triangular L, upper-triangular U, and permutation P such that P*A = L*U. With two outputs, returns L and U such that L*U = A and L is permuted-lower (psychologically lower).
For sparse matrices, an additional column-permutation Q and a row-scaling R may be returned. The single-output form returns the LU factors packed into one matrix (LAPACK packed storage).
Examples
Section titled “Examples”A = [1 2 3; 4 5 6; 7 8 10];[L, U] = lu(A);norm(L*U - A) % near-zero