dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #12193
Re: access to CSR data in python
2009/2/16 N <tenpoundwalleye@xxxxxxxxx>:
>
> 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.
-Ali
>
> Thanks.
>
> Nate
>
>
>
> _______________________________________________
> DOLFIN-dev mailing list
> DOLFIN-dev@xxxxxxxxxx
> http://www.fenics.org/mailman/listinfo/dolfin-dev
>
Follow ups
References