<div dir="ltr">Are you sure you built petsc4py with a PETSc build with complex scalars? Whats the output of "print(PETSc.ScalarType)" ?<div><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 26 September 2016 at 07:47, Aurelien Ponte <span dir="ltr"><<a href="mailto:aurelien.ponte@ifremer.fr" target="_blank">aurelien.ponte@ifremer.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am trying to solve a linear problem whose operator has complex coefficients via petsc4py<br>
but keep running into the following error:<br>
<br>
File "/Users/aponte/Current_project<wbr>s/people/kraig_marine/wd_<wbr>response/solver/set_L.py", line 52, in set_L<br>
L.setValueStencil(row, col, value)<br>
File "PETSc/Mat.pyx", line 882, in petsc4py.PETSc.Mat.setValueSte<wbr>ncil (src/petsc4py.PETSc.c:124785)<br>
File "PETSc/petscmat.pxi", line 1017, in petsc4py.PETSc.matsetvaluesten<wbr>cil (src/petsc4py.PETSc.c:31469)<br>
File "PETSc/arraynpy.pxi", line 140, in petsc4py.PETSc.iarray_s (src/petsc4py.PETSc.c:8811)<br>
File "PETSc/arraynpy.pxi", line 121, in petsc4py.PETSc.iarray (src/petsc4py.PETSc.c:8542)<br>
TypeError: can't convert complex to float<br>
<br>
The code looks like:<br>
<br>
for j in range(ys, ye):<br>
for i in range(xs, xe):<br>
row.index = (i, j, kx)<br>
row.field = 0<br>
col.index = (i, j, kx) col.field=0<br>
L.setValueStencil(row, col, 1j)<br>
<br>
Any idea about what am I doing wrong?<br>
<br>
cheers<span class="HOEnZb"><font color="#888888"><br>
<br>
aurelien<br>
<br>
<br>
<br>
-- <br>
Aurélien Ponte<br>
Tel: (+33) 2 98 22 40 73<br>
Fax: (+33) 2 98 22 44 96<br>
UMR 6523, IFREMER<br>
ZI de la Pointe du Diable<br>
CS 10070<br>
29280 Plouzané<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Lisandro Dalcin<br>============<br>Research Scientist<br>Computer, Electrical and Mathematical Sciences & Engineering (CEMSE)<br>Extreme Computing Research Center (ECRC)<br>King Abdullah University of Science and Technology (KAUST)<br><a href="http://ecrc.kaust.edu.sa/" target="_blank">http://ecrc.kaust.edu.sa/</a><br><br>4700 King Abdullah University of Science and Technology<br>al-Khawarizmi Bldg (Bldg 1), Office # 0109<br>Thuwal 23955-6900, Kingdom of Saudi Arabia<br><a href="http://www.kaust.edu.sa" target="_blank">http://www.kaust.edu.sa</a><br><br>Office Phone: +966 12 808-0459</div>
</div>