dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #12194
Re: access to CSR data in python
----- Original Message ----
> From: A Navaei <axnavaei@xxxxxxxxxxxxxx>
> To: N <tenpoundwalleye@xxxxxxxxx>
> Cc: dolfin-dev@xxxxxxxxxx
> Sent: Monday, February 16, 2009 4:56:21 PM
> Subject: Re: [DOLFIN-dev] access to CSR data in python
>
> 2009/2/16 N :
> >
> > 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?
>
> A.array() returns numpy.ndarray.
>
This returns an ndarray for the dense matrix. I'm looking for the CSR data.
Nate
References