<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Matthew Knepley&nbsp;&lt;<a href="mailto:knepley@gmail.com">knepley@gmail.com</a>&gt;&nbsp;wrote:</div><br><blockquote type="cite"><blockquote type="cite">a) Is there an easy and efficient way to convert a numpy.ndarray to a<br></blockquote><blockquote type="cite">PETSc.Vec or PETSc.Mat (and vice-versa)? &nbsp;(A PETSc.Vec.getArray() returns a<br></blockquote><blockquote type="cite">numpy.ndarray, though I have found no such method for PETSc.Mat yet. )<br></blockquote><blockquote type="cite"><br></blockquote><br>If you are using dense matrices (MATDENSE) then MatGetArray() works.</blockquote><div><br></div><div>I don't think this is implemented in petsc4py: At least, there's no method PETSc.Mat.getArray()</div></body></html>