← Back to team overview

dolfin team mailing list archive

access to CSR data in python

 

Take a simple example like

from dolfin import *
mesh = UnitSquare(4, 4)
V = FunctionSpace(mesh, "CG", 1)
v = TestFunction(V)
u = TrialFunction(V)
a = dot(grad(v), grad(u))*dx
A = assemble(a)

The matrix A (with boost as the linear algebra base) gives the following for attribute data:
    data(self) -> std::tr1::tuple<(p.q(const).std::size_t,p.q(const).std::size_t,p.q(const).double,int)>
    
    Return pointers to underlying compressed storage data. See
    GenericMatrix for documentation. 


How can this be used to gain access to the column data, row pointer, and data elements in the matrix?  I would like to have access to this data in Numpy arrays without copying the data.  Is this possible?

Thanks.

Nate


      


Follow ups