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

Aron Ahmadia aron.ahmadia at kaust.edu.sa
Sat May 26 08:17:06 CDT 2012


Dear Chris,

Sorry, Lisandro and I missed this.  I answered your question over on
scicomp: http://scicomp.stackexchange.com/a/2356/9

Thanks for the persistence!

Regards,
Aron

On Tue, May 22, 2012 at 9:27 PM, Christian Staudt
<christian.staudt at ira.uka.de> wrote:
> 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
>
>


More information about the petsc-users mailing list