← Back to team overview

dolfin team mailing list archive

Re: [Question #158688]: the inverse and elements of stiffness matrix on C++

 

Question #158688 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/158688

    Status: Open => Answered

James Avery proposed the following answer:
Are you certain that you really want to take the inverse of the matrix?

The problem with doing that is that taking the inverse of a sparse
matrix does not result in a sparse matrix. While the sparse matrix uses
O(N) memory for N degrees of freedom, a dense one uses O(N^2), and so
you restrict yourself to very coarse meshes if you do take the inverse.

Usually, you will instead want to apply a preconditioner (for example
SSOR) to the matrix to improve efficiency of solving linear systems, and
then solve each system Ax = b individually using a sparse linear solver.

If you really, really want to take the inverse, you can use the
uBLASSparseMatrix class instead of the Matrix class. I.e.

uBLASSparseMatrix T;
assemble(T,stiffness);
T.invert();

Please see also my answer to the same question at the bottom of this
thread: https://answers.launchpad.net/dolfin/+question/158315

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.