[petsc-users] petsc4py and numpy
Matthew Knepley
knepley at gmail.com
Tue May 8 10:04:48 CDT 2012
On Tue, May 8, 2012 at 11:00 AM, Christian Staudt <
christian.staudt at ira.uka.de> wrote:
> Matthew Knepley <knepley at gmail.com> wrote:
>
> a) Is there an easy and efficient way to convert a numpy.ndarray to a
>
> PETSc.Vec or PETSc.Mat (and vice-versa)? (A PETSc.Vec.getArray() returns a
>
> numpy.ndarray, though I have found no such method for PETSc.Mat yet. )
>
>
>
> If you are using dense matrices (MATDENSE) then MatGetArray() works.
>
>
> I don't think this is implemented in petsc4py: At least, there's no method
> PETSc.Mat.getArray()
>
If you ask Lisandro for it, he will put it in.
Matt
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which their
experiments lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120508/a30e3332/attachment.htm>
More information about the petsc-users
mailing list