[petsc-users] petsc4py and numpy

Christian Staudt christian.staudt at ira.uka.de
Tue May 8 10:00:21 CDT 2012


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()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120508/15d46a47/attachment.htm>


More information about the petsc-users mailing list