ILU(0) preconditioning (macro).
[L,U] = spilu_ilu0M(A)
n-by-n sparse real matrix of doubles
n-by-n sparse real matrix of doubles, lower triangular matrix
n-by-n sparse real matrix of doubles, upper triangular matrix
Builds an incomplete LU factorization of the sparse matrix A
.
The nonzero pattern in L is the same as the nonzero pattern of the lower part of A. The nonzero pattern in U is the same as the nonzero pattern of the upper part of A.
ILU0 is not recommended for realistic problems. It is only provided for comparison purposes.
All the diagonal elements of the input matrix must be nonzero.
Uses ikj variant of Gaussian Elimination.
This function is a macro. The purpose of this function is to reproduce the spilu_ilu0 function for small sparse matrices with a simple script. This function is a Scilab port of Youcef Saad's Matlab ilu0 function.
// A small 3-by-3 matrix // nnz(A)=7 A = [ 1 2 0 3 4 5 0 6 7 ]; B = sparse(A); [L,U]=spilu_ilu0M(B); full(L) full(U) Lexpected = [ 1 0 0 3 1 0 0 -3 1 ]; Uexpected = [ 1 2 0 0 -2 5 0 0 22 ]; // Preconditioning of a 237-by-237 matrix. // nnz(A)=1017 path = spilu_getpath ( ); filename = fullfile(path,"tests","matrices","nos1.mtx"); A=mmread(filename); [L,U]=spilu_ilu0M(A); norm(A-L*U) // To edit the code edit spilu_ilu0M | ![]() | ![]() |