This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

how to extract sparse matrix from assembled form

+2 votes

In Fenics 1.5.0, 'uBLAS' is no longer supported. What can I do to extract a sparse array that represents an assembled form?

More detailed, setting

dolfin.parameters.linear_algebra_backend = "Eigen"

the command that worked for "uBLAS"

rows, cols, values = A.data()

fails with AttributeError: 'Matrix' object has no attribute 'data'

What is the command or the backend to use here?

asked Mar 2, 2016 by Jan FEniCS User (8,290 points)

1 Answer

+4 votes
 
Best answer

Use:

as_backend_type(A).data()

or

as_backend_type(A).sparray()
answered Mar 2, 2016 by chris_richardson FEniCS Expert (31,740 points)
selected Mar 2, 2016 by Jan
...