ILU preconditioning with level of fill-in of k (macro).
[L, U] = spilu_ilukM(A) [L, U] = spilu_ilukM(A,lfil)
n-by-n sparse real matrix of doubles
a 1-by-1 matrix of doubles, integer value, positive, the fill-in parameter (default: lfil=floor(1+nnz(A)/n), i.e. the average number of nonzero elements of the matrix A by line). Entries whose levels-of-fill exceed lfil during the ILU process are dropped.
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
,
that is, computes a lower triangular matrix L
and
an upper triangular matrix U
such that
A ≈ L*U
This function uses an ILU with level of fill-in of K (ILU(k)).
If lfil==0
, then spilu_ilukM produces the
same output as spilu_ilu0M.
This function is a macro. The purpose of this function is to reproduce the spilu_iluk function for small sparse matrices with a simple script. This function is a Scilab port of Youcef Saad's iluk Matlab function.
// A 6-by-6 matrix A=[ -1. 3. 0. 0. 4. 0. 2. -5. 0. 0. 0. 1. 0. 0. -2. 3. 0. 0. 0. 0. 7. -1. 0. 0. -3. 0. 0. 4. 6. 0. 0. 5. 0. 0. -7. 8. ]; A=sparse(A); [L,U]=spilu_ilukM(A,lfil) // See the norm of the residual matrix norm(A-L*U) // Configure level of fill n = size(A,"r"); lfil=floor(1+nnz(A)/n); [L,U]=spilu_ilukM(A,lfil) // Decompose a 237-by-237 sparse matrix. path = spilu_getpath ( ); filename = fullfile(path,"tests","matrices","nos1.mtx"); A=mmread(filename); [L,U]=spilu_ilukM(A,10); norm(A-L*U) // To edit the code edit spilu_ilukM | ![]() | ![]() |