[petsc-users] petsc4py with complex numbers?
Lisandro Dalcin
dalcinl at gmail.com
Mon Sep 26 01:00:25 CDT 2016
Are you sure you built petsc4py with a PETSc build with complex scalars?
Whats the output of "print(PETSc.ScalarType)" ?
On 26 September 2016 at 07:47, Aurelien Ponte <aurelien.ponte at ifremer.fr>
wrote:
> Hi,
>
> I am trying to solve a linear problem whose operator has complex
> coefficients via petsc4py
> but keep running into the following error:
>
> File "/Users/aponte/Current_projects/people/kraig_marine/wd_response/solver/set_L.py",
> line 52, in set_L
> L.setValueStencil(row, col, value)
> File "PETSc/Mat.pyx", line 882, in petsc4py.PETSc.Mat.setValueStencil
> (src/petsc4py.PETSc.c:124785)
> File "PETSc/petscmat.pxi", line 1017, in petsc4py.PETSc.matsetvaluestencil
> (src/petsc4py.PETSc.c:31469)
> File "PETSc/arraynpy.pxi", line 140, in petsc4py.PETSc.iarray_s
> (src/petsc4py.PETSc.c:8811)
> File "PETSc/arraynpy.pxi", line 121, in petsc4py.PETSc.iarray
> (src/petsc4py.PETSc.c:8542)
> TypeError: can't convert complex to float
>
> The code looks like:
>
> for j in range(ys, ye):
> for i in range(xs, xe):
> row.index = (i, j, kx)
> row.field = 0
> col.index = (i, j, kx) col.field=0
> L.setValueStencil(row, col, 1j)
>
> Any idea about what am I doing wrong?
>
> cheers
>
> aurelien
>
>
>
> --
> Aurélien Ponte
> Tel: (+33) 2 98 22 40 73
> Fax: (+33) 2 98 22 44 96
> UMR 6523, IFREMER
> ZI de la Pointe du Diable
> CS 10070
> 29280 Plouzané
>
>
--
Lisandro Dalcin
============
Research Scientist
Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)
Extreme Computing Research Center (ECRC)
King Abdullah University of Science and Technology (KAUST)
http://ecrc.kaust.edu.sa/
4700 King Abdullah University of Science and Technology
al-Khawarizmi Bldg (Bldg 1), Office # 0109
Thuwal 23955-6900, Kingdom of Saudi Arabia
http://www.kaust.edu.sa
Office Phone: +966 12 808-0459
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160926/a64d29ac/attachment.html>
More information about the petsc-users
mailing list