This project has moved. For the latest updates, please go here.

Iterative Solver Problem

Jan 30, 2013 at 7:22 PM
var p3 = new double[,] { { 1, 1, 1 }, { 1, 2, 3 }, { 1, 3, 6 } };
var pascal3 = new DenseMatrix(p3);
var u = new double[] { 3, 1, 4 };
var uVec = new DenseVector(u);
var sl2 = new MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative.BiCgStab();
var ans = sl2.Solve(pascal3, uVec);
var sl3 = new MathNet.Numerics.LinearAlgebra.Double.Solvers.Iterative.MlkBiCgStab();
ans = sl3.Solve(pascal3, uVec);

Can anyone here tell why the answers using two methods are different?
Coordinator
Jan 30, 2013 at 7:40 PM

Just for reference, its the first one (BiCgStab) that is off, as verified with:

pascal3.LU().Solve(uVec);
pascal3.QR().Solve(uVec);

Jan 30, 2013 at 7:52 PM
cdrnet wrote:

Just for reference, its the first one (BiCgStab) that is off, as verified with:

 

pascal3.LU().Solve(uVec);
pascal3.QR().Solve(uVec);

 

Thank you, Christoph for your instant response. Do you know why the Iterative.BiCgStab() is off by such a large number?

Coordinator
Jan 30, 2013 at 8:28 PM
Edited Jan 30, 2013 at 8:42 PM

I actually don't know that much about our iterative solvers and how they (are supposed to) behave numerically myself, but some quick experiments show that it suddenly converges if we increase the iteration count stop criterium or modify the maximum residual of the residual stop criterium to anything other than its default (1e-12), e.g. 1e-10 or 1e-14:

var monitor = new Iterator(new IIterationStopCriterium[]
   {
       new IterationCountStopCriterium(1000),
       new ResidualStopCriterium(1e-13),
       new DivergenceStopCriterium(),
       new FailureStopCriterium()
   });

var sl2 = new BiCgStab(monitor);

Thanks,
Christoph 

NB: monitor.Status is set to CalculationConverged if it converged, but in the failing case above it is CalculationStoppedWithoutConvergence, indicating the failure.