[eigen] new API for Cholmod |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: [eigen] new API for Cholmod
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 26 Oct 2010 16:12:02 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:from:date :message-id:subject:to:content-type; bh=KaQWJqi2wBKCCvYYwt/XTvjV5VCNigBPvTDSf7AP8FA=; b=kA2Fzjrm3lydyDAxjZcaYUWi12qTT7midko9Mq3hQ0/SLYZhRhnfvqgiC9Hg/nL+JD fgacfwwRpF7iPF5OnPa0iH5DLkdsxGgO1pHiF7lrd8043F95PpoHT139vlyt+DxzFPHt Bwe1egX08ygdNcERllUldfJPPplpZcAHm55RY=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; b=ZNj/1GJhXQsiU+n/G57D1kiBTjMup+CjqK4DjXccDkuyO7hh8GfYbXf76FwR1xx5i3 qj3pN7D7NOShoSUIjsvn5g4KRPzXnoCdOX2Ch20ZhCLBs4Bcm8DvDyEPJGPT/wgTDAi+ ZlkBgk+91eboZzl+m1Tc0wvrsAz9YVE6eanLI=
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