[petsc-users] [petsc4py] Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

Christian Staudt christian.staudt at ira.uka.de
Tue May 22 13:27:59 CDT 2012


Hi petsc4py users,

I am running into the following error:

>   File "/Users/cls/workspace/LAMG-Python/src/lamg/amg/setup.py", line 945, in buildInternal
>     Acc = A[c, c]
>   File "Mat.pyx", line 185, in petsc4py.PETSc.Mat.__getitem__ (src/petsc4py.PETSc.c:71407)
>   File "petscmat.pxi", line 862, in petsc4py.PETSc.mat_getitem (src/petsc4py.PETSc.c:22442)
>   File "petscmat.pxi", line 773, in petsc4py.PETSc.matgetvalues (src/petsc4py.PETSc.c:21226)
>   File "arraynpy.pxi", line 123, in petsc4py.PETSc.iarray_i (src/petsc4py.PETSc.c:5284)
>   File "arraynpy.pxi", line 117, in petsc4py.PETSc.iarray (src/petsc4py.PETSc.c:5192)
> TypeError: Cannot cast array data from dtype('int64') to dtype('int32') according to the rule 'safe'

I am indexing the PETSc.Mat A with an array c ( numpy.ndarray with dtype('int64')).  I assume there is a simple solution (allowing the cast, making everything  32 or 64 bit...). Can you point me in the right direction? Thanks.

Chris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120522/dad02e66/attachment-0001.html>


More information about the petsc-users mailing list