You cannot do it directly, but you can always calculate it using one of the sparse solvers. The idea is to solve A*X=I , where I am the identity matrix. If there is a solution, X will be your inverse matrix. In our own documentation there is a page about rare solvers and how to use them, but the main steps are as follows:
SolverClassName<SparseMatrix<double> > solver; solver.compute(A); SparseMatrix<double> I(n,n); I.setIdentity(); auto A_inv = solver.solve(I);
source share