[petsc-users] complex number issues

RenZhengYong renzhengyong at gmail.com
Wed May 19 13:50:50 CDT 2010


Hi,  PETSc team,
I wrote a C++ code dealing with electromagnetic problems, which can smoothly
call PETSc complied by using " --with-scalar-type=complex
--with-clanguage=cxx" .
To improve the performances of the C++ code, I changed the complex number of
type from std::complex<double> to double _Complex (C99 standard, roughly
30~50 times faster compared to std::complex<double>). But when I find that
the C99 complex number head file <complex.h> will lead to the following
kinds of errors"

/usr/include/c++/4.3/complex:57: error: expected identifier before
‘__complex__’
/usr/include/c++/4.3/complex:58: error: expected identifier before
‘__complex__’
/usr/include/c++/4.3/complex:58: error: expected unqualified-id before ‘<’
token
/usr/include/c++/4.3/complex:59: error: expected identifier before
‘__complex__’
/usr/include/c++/4.3/complex:59: error: expected unqualified-id before ‘<’
token
/usr/include/c++/4.3/complex:60: error: expected identifier before
‘__complex__’
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:157: error:
expected unqualified-id before ‘__complex__’
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:306: error:
‘PetscScalar’ does not name a type
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:339: error:
‘PetscScalar’ does not name a type
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: warning:
‘PetscGlobalSum’ initialized and declared ‘extern’
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:
‘PetscScalar’ was not declared in this scope
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:
expected primary-expression before ‘,’ token
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:
‘PetscScalar’ was not declared in this scope
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:
expected primary-expression before ‘,’ token
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:
expected primary-expression before ‘)’ token
/home/Zhengyong/packages/petsc-3.1-p1/include/petscmath.h:469: error:
initializer expression list treated as compound expression


Could you please give me some idea to deal with these problems?

Kind regards,
Zhengyong Ren

-- 
Zhengyong Ren
AUG Group, Institute of Geophysics
Department of Geosciences, ETH Zurich
NO H 47 Sonneggstrasse 5
CH-8092, Zürich, Switzerland
Tel: +41 44 633 37561
e-mail: zhengyong.ren at aug.ig.erdw.ethz.ch
Gmail: renzhengyong at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100519/0bb38c13/attachment.htm>


More information about the petsc-users mailing list