Skip to content

lu

builtin · libnexusinterp/corefcn/lu-proprietary.cc

: Y = lu (A)
: [L, U] = lu (A)
: [L, U, P] = lu (A)
: [L, U, P] = lu (A, "vector")
: [L, U, P, Q] = lu (S)
: [L, U, P, Q, R] = lu (S)
: […] = lu (S, thresh)
: […] = lu (S, thresh, "vector")

Compute the LU factorization of a matrix with partial (row) pivoting.

For a full or sparse matrix A, [L, U, P] = lu (A) returns a unit lower triangular L, an upper triangular U and a permutation matrix P such that P*A = L*U. With only two outputs, L absorbs the permutation so that L*U = A. With a single output, Y packs both factors as L + U - eye (…).

The option "vector" returns the permutations as row index vectors instead of matrices; for p the relation is A(p,:) = L*U.

Sparse matrices additionally support a fill-reducing column permutation Q (fourth output) with P*S*Q = L*U, and a row scaling R (fifth output) with P*(R\S)*Q = L*U. The optional thresh is a pivot threshold in the range 0 to 1, or a two-element vector of pivot and diagonal thresholds.