[eigen] new API for Cholmod

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi,

I've started to rework our sparse solvers/backends with Cholmod. The
old API is still available.

The first difference is that there is no SparssLLT or SparseLDLT or so
base classes which was really confusing to use.

Instead, you directly use the relevant wrapper class,
CholmodDecomposition<MatrixType,UpLo>:

The shortest way:

X = CholmodDecomposition<MySparseMatrix,Lower>(A).solve(B);

As for dense objects you can do:

CholmodDecomposition<MySparseMatrix,Lower> chol;

while(1) {

  chol.compute(A);
  if(chol.info()!=Success)
  {
    // handle failure
  }

  X = chol.solve(B);
  if(chol.info()!=Success)
  {
    // handle failure
  }
}




and if the sparsity does no change:



CholmodDecomposition<MySparseMatrix,Lower> chol;

chol.analyzePattern(A);

while(1) {

  chol.factorize(A);
  if(chol.info()!=Success)
  {
    // handle failure
  }

  X = chol.solve(B);
  if(chol.info()!=Success)
  {
    // handle failure
  }
}


You can also configure the underlying decomposition with:

chol.setMode(mode);

where mode = CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt,
or CholmodLDLt

default is CholmodAuto.



And if you are a power user you can control everything through the
cholmod() method which returns a reference to the cholmod_common
object.


It is not that much changes but I think this approach is much cleaner
and easier to use.


I plane to write all solvers/wrappers using the same model, so it is
perfect time to give your opinion on what would be the best API for
them. The constraint is that we must be as close as possible to the
dense API, but it is perfectly reasonable to add convenient methods
with more runtime facilities....

Then we could imagine to have a meta solver built on top of them with
runtime registration of backends, priority rules, etc. but that's
another story.

gael



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/