[petsc-users] Inserting -nan+iG at matrix entry problem

张国熙 altriaex86 at gmail.com
Wed May 7 04:01:53 CDT 2014


Hi,all

I got a "Inserting -nan+iG error" at function MatSetValues.

My code like this:

I first use code below to change a double into PETScScalar (I am using
Complex version).
*for(i=0;i<nz;i++)temp[i] = Ax[i] + Az[i] * PETSC_i;*
Then I use code below to insert values into matrix.
*ierr = MatSetValues(A,n,Conlumn_ptr,n,Ai,temp,INSERT_VALUES);*

Here is how problem happens:

I compile my PETSc code into a .so lib and test it with a simple matrix and*
it passed*. So I link it with the other part of my program.

However, it keeps telling me

*Inserting -nan+iG at matrix entry (2,3)!*

The (2,3) is zero actually, and I could print it with std::cerr which tells
me it is zero. The other part of my program,with which generates actual
matrix I will deal, is correct.(I could use ARPACK with it.)

I was confused about why PETSc recognize a zero into -nan. In my simple
test, there is also zero entry, at (0,0) however. For the other part is
compiled itself, I guess there might be some problem with compiling
options. But I have no idea about it. Could anybody help me?


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


More information about the petsc-users mailing list