Hi,
first off: I’m using FEniCS 2019.1.0 for Python from ppa:fenics-packages/fenics on Ubuntu 18.04.2 LTS.
How can I convert assembled matrices to the SciPy sparse format without using the Eigen backend?
Using parameters[‘linear_algebra_backend’] = ‘Eigen’ at the beginning of my program and then assembling a matrix via, e.g., A = assemble(a), I can later export a sparse matrix with
import scipy.io
row,col,val = as_backend_type(A).data()
A = scipy.sparse.csr_matrix((val,col,row))
scipy.io.savemat('data.mat',mdict={'A':A})
However, I would like to keep the default linear algebra backend. There, the command as_backend_type(A).data() fails.