[petsc-users] PETSC_i
Jin, Shuangshuang
Shuangshuang.Jin at pnnl.gov
Mon Jan 11 14:59:00 CST 2016
Thanks, I reinstalled the PETSc to make sure the PetscScalar type is complex, and it works fine now.
Shuangshuang
-----Original Message-----
From: Barry Smith [mailto:bsmith at mcs.anl.gov]
Sent: Monday, January 11, 2016 11:51 AM
To: Jin, Shuangshuang
Cc: petsc-users at mcs.anl.gov
Subject: Re: [petsc-users] PETSC_i
> On Jan 11, 2016, at 1:15 PM, Jin, Shuangshuang <Shuangshuang.Jin at pnnl.gov> wrote:
>
> Hi, I have the following codes (The version of Petsc installed on my machine has PetscScalar set to be complex number):
>
> double ival_re, ival_im;
> PetscScalar val;
> …
> val = ival_re + PETSC_i * ival_im;
>
> I got a compilation error below:
>
> error: cannot convert 'std::complex<double>' to 'PetscScalar {aka double}' in assignment
For sure something is wrong. It definitely believes that PetscScalar is a double when it will be std::complex<double> if all the ducks are in order. Did/does make test work after you installed PETSc?
Barry
>
> Even if I set “val = 1.0 * PETSC_i;”, the error stays the same.
>
> Can anyone help to evaluate the problem?
>
> Thanks,
> Shuangshuang
More information about the petsc-users
mailing list