Sunday, September 1, 2013

Lost in translation with nice results

Last week I spend reimplementing the IC(0) Fortran routines by Mark T. Jones and Paul E. Plassmann (see my last blog post) in C++. This effort was done, because

  • Octave is naively C++. Thus it is possible to adapt the code to more sophisticated data types (especially I think in complex sparse data types) so it will be able to handle more general input.
  • I am much more familiar with C++. This makes it easier for me to extend the code with features like the Modified Incomplete Cholesky Factorization (MIC) option and diagonal shifting.
The result is accessible from my repository:
  • ichol0.cc - The standard IC(0) routine
  • ichol0jp.cc - IC(0) with Jones and Plassmann strategy (preserve number of non-zeros per row/column, but take the largest ones)
For testing the implementation, I took the two examples from the last post and added one example test case from http://www.mathworks.com/help/matlab/ref/ichol.html. The m-files are available from here.

Octaves output


Test Problem 1

  err_ichol0   =  0.0197360236512918
  err_ichol0jp =  0.0197548896386716
Test Problem 2
  err_ichol0   =  0.0840790133633081
  err_ichol0jp =  0.0846790338305638
Test Problem 3
  err_ichol0   =  0.0915989875674983
  err_ichol0jp =  0.0926062848306512


MATLAB (R2012b) output

Test Problem 1
  err_ichol = 0.019736023651292

Test Problem 2
  err_ichol = 0.084079013363308

Test Problem 3
  err_ichol = 0.091598987567498

Interesting was to observe, that the results of the standard IC(0) match very well with those of MATLAB. The Jones and Plassmann strategy does not differ that much from the standard IC(0), but according to their paper, it should speed up the preconditioned solution. So it will be offered as an additional options.type='jp' for example.

No comments:

Post a Comment