ILU0 using and sparse matrix operations

May 27, 2016 at 1:46 PM
Hello. I have some problems with solving system of linear equations. Really I have matrix about 20000*20000. I create Sparse Matrix A, Initialized it and created right hand side - vector B.

There is my code:
        var solver = new BiCgStab();

        var preconditioner = new ILU0Preconditioner();
        var X = A_sparse.SolveIterative(BB, solver,monitor, preconditioner).ToArray();
But it work more than 30 minutes, I have never waited for it finish. When I use MILU0Preconditioner, solver do it very fast (5 -10 seconds) but the result is not that I need. I tryied in Matlab same algorithm and same matrix (I used bicg and LU preconditioner). Without preconditioner bicg in Matlab get similar result. But with LU preconditioner Matlab get very good results, unlike Math Net. I can't understand why, maybe somebody have experience with ILU0 preconditioner in Math Met Numerics
May 27, 2016 at 5:38 PM
Edited May 28, 2016 at 8:42 AM
MILU0Preconditioner is the only preconditioner optimized for sparse storage and hence the only one that will improve performance.

It implements both the standard and the modified ILU0 algorithm (default is the modified one). Have you tried both? Use the UseModified property or the constructor overload to choose between the two versions.

What's the status of the iterator after solving the system (check the monitor.Status property)?

EDIT: To have more control over the iteration process, you might want to setup the iterator by yourself:
int iterationsLimit = 500;
double tolerance = 1e-8;

var iterator = new Iterator<double>(
    new IterationCountStopCriterion<double>(iterationsLimit),
    new ResidualStopCriterion<double>(tolerance),
    new DivergenceStopCriterion<double>()

var solver = new BiCgStab();
var preconditioner = new MILU0Preconditioner(true);


solver.Solve(matrix, b, x, iterator, preconditioner);