Re: [eigen] Getting to a solution from sparse matrices, Eigen3

[ Thread Index | Date Index | More Archives ]


I've quickly updated the documentation page to mention the current
sparse solving possibilities. It should be available within a few
hours there:

in the meantime here it is (without formatting):


Using the direct solvers

To solve a sparse problem you currently have to use one or multiple of
the following "unsupported" module:

SparseExtra module
solvers: SparseLLT<SparseMatrixType>, SparseLDLT<SparseMatrixType>
(include <Eigen/SparseExtra>)
notes: built-in basic LLT and LDLT solvers

Cholmod Support module
solver: SparseLLT<SparseMatrixType, Cholmod> (include <Eigen/CholmodSupport>)
notes: LLT solving using Cholmod, requires a SparseMatrix object.
(recommended for symmetric/selfadjoint problems)

UmfPack support module
solver: SparseLU<SparseMatrixType, UmfPack> (include <Eigen/UmfPackSupport>)
notes: LU solving using UmfPack, requires a SparseMatrix object
(recommended for squared matrices)

Super LU support
solver: SparseLU<SparseMatrixType, SuperLU> (include <Eigen/SuperLUSupport>)
notes: (LU solving using SuperLU, requires a SparseMatrix object,
recommended for squared matrices)

Taucs support module
solver: SparseLLT<SparseMatrixType, Taucs> (include <Eigen/TaucsSupport>)
notes: LLT solving using Taucs, requires a SparseMatrix object (not recommended)

Those modules are currently considered to be "unsupported" because 1)
they are not documented, and 2) their API is likely to change in the

Here is a typical example:

#include <Eigen/UmfPackSupport>
// ...
SparseMatrix<double> A;
// fill A
VectorXd b, x;
// fill b
// solve Ax = b using UmfPack:
SparseLU<SparseMatrix<double>,UmfPack> lu_of_A(A);
if(!lu_of_A.succeeded()) {
  // decomposiiton failed
if(!lu_of_A.solve(b,&x)) {
  // solving failed

See also the class SparseLLT, class SparseLU, and class SparseLDLT.



On Tue, Aug 17, 2010 at 8:27 PM, FMDSPAM <fmdspam@xxxxxxxxx> wrote:
> Am 17.08.2010 15:59, schrieb Will S:
> ... So far the
> only way through the API I've seen to solve is to first call
> sparse.toDense() then solve, but I'm wondering if there is a way to
> solve a sparse matrix without calling .toDense() first in Eigen 3
> To quote the docs  "To summarize, it is recommanded to use a SparseMatrix
> whenever this is possible, and reserve the use of DynamicSparseMatrix for
> matrix assembly purpose when a SparseMatrix is not flexible enough."
> and
> "Then the DynamicSparseMatrix object can be converted to a compact
> SparseMatrix to be used"
> I presume your sneaking suspision: Converting a (dynamic)sparsematrix into a
> densematrix is really pointless.
> cheers
> Frank

Mail converted by MHonArc 2.6.19+