Plots the sensitivity of a decomposition algorithm.
spilu_plotparameter(A,pname,pmatrix,fundecomp,perm) pNorm = spilu_plotparameter(...) [pNorm,pNnz] = spilu_plotparameter(...)
a n-by-n sparse matrix
a 1-by-1 matrix of strings, the name of the parameter
a N-by-1 matrix of doubles, the values of the parameter
a list, the decomposition algorithm
: a N-by-1 matrix of booleans, set perm=%t if the algorithm has permutation, set perm=%f if not.
a N-by-1 matrix of doubles, the value of norm(A-L*U,"inf")/norm(A,"inf") if perm==%f, the value of norm(P*A-L*U,"inf")/norm(A,"inf") if perm==%t
a N-by-1 matrix of doubles, the value of nnz(L)+nnz(U)
For one particular matrix, plots the norm(A-L*U) and nnz(L)+nnz(U), depending on p for the given decomposition algorithm.
The function fundecomp is a list (f,a1,a2,...,an), where the first element f is a function with header:
[pNorm,pNnz] = f(A,p,a1,a2,...,an)
where A is the sparse matrix, p is the current value of the parameter, pNorm is the current value of the norm, pNnz is the current value of nnz(L)+nnz(U) and a1, a2, ..., an are extra-arguments which are automatically added to the calling sequence of f. The value of pNorm should be norm(A-L*U,"inf")/norm(A,"inf") if perm==%f, norm(P*A-L*U,"inf")/norm(A,"inf") if perm==%t.
function [pNorm, pNnz]=iludDecompAlpha(A, alpha) instr = "[L,U]=spilu_ilud(A,alpha)"; ierr = execstr(instr,"errcatch"); if (ierr<>0) then pNorm = %inf pNnz = nnz(A) else pNorm = norm(A-L*U,"inf"); pNnz = nnz(L) + nnz(U) end endfunction A = [ 34. 4. -10. 0. -3. 4. 24. -8. 0. 0. -10. -8. 36. 0. 0. 0. 0. 0. 1. 0. -3. 0. 0. 0. 6. ]; A = sparse(A); N = 100; alpha = linspace(0,1,N)'; scf(); [pNorm,pNnz] = spilu_plotparameter(A,"alpha",alpha,.. list(iludDecompAlpha),%f); | ![]() | ![]() |