LU = ilu(A)
LU = ilu(A, opts)
[L, U] = ilu(A)
[L, U] = ilu(A, opts)
[L, U, P] = ilu(A, opts)
| Parameter | Description |
|---|---|
| A | a sparse real or complex floating-point square matrix. |
| opts | a scalar structure with optional fields type, droptol, fillfactor, udiag, and thresh. |
| Parameter | Description |
|---|---|
| LU | single sparse factor containing the strict lower part of L and the upper part of U. |
| L | sparse lower triangular incomplete LU factor. |
| U | sparse upper triangular incomplete LU factor. |
| P | sparse row permutation matrix. When returned, P * A is approximated by L * U. |
ilu computes sparse incomplete LU factors suitable for use as preconditioners.
opts.type can be 'nofill' or 'ilutp'. The default is 'nofill', which preserves the input sparsity pattern and performs no threshold dropping.
In 'ilutp' mode, opts.droptol drops small entries, opts.fillfactor limits retained row fill, opts.udiag allows zero pivots, and opts.thresh is a pivot threshold between 0 and 1. The default values are droptol = 1e-4, fillfactor = 10, udiag = false, and thresh = 1.
The 'ilutp' mode uses sparse row pivoting. With three outputs, P contains the row permutation and P * A is approximated by L * U. With one output, the packed sparse factor stores the strict lower part of L and the upper part of U.
Text option values such as opts.type can be character row vectors or string scalars.
Double, single, complex double, and complex single sparse matrices are supported. L and U keep the input numeric class; P is a sparse permutation matrix.
The factors can be used directly as preconditioners for Krylov solvers such as gmres, bicgstab, bicg, cgs, and qmr.
A = sparse([4 1 0; 2 3 1; 0 1 2]);
LU = ilu(A)
full(LU)
A = sparse([4 1 0; 2 3 1; 0 1 2]);
[L, U] = ilu(A)
full(L * U)
A = sparse([4 1 0; 2 3 1; 0 1 2]);
b = [1; 2; 3];
[L, U] = ilu(A);
x = bicgstab(A, b, 1e-12, 20, L, U)
A = sparse(single([0 1 + 2i; 3 - 1i 4]));
opts.type = 'ilutp';
opts.droptol = 0;
[L, U, P] = ilu(A, opts);
full(P * A - L * U)
A = sparse([0.2 1; 1 1]);
opts.type = 'ilutp';
opts.droptol = 0;
opts.fillfactor = 10;
opts.thresh = 0.25;
[L, U, P] = ilu(A, opts);
full(P * A - L * U)
| Version | Description |
|---|---|
| 2.0.0 | initial version |
| 2.0.0 | added single and complex single nofill, ilutp, pivoting, string scalar options, and preconditioner coverage |