I don't understand the code change - but if you want to use c99 complex - you can build petsc with:
--with-scalar-type=complex --with-clanguage=c [which is the default for clanguage] And no code-change needed for PETSc. However if your code uses c++ - you might have to address that.. Satish On Wed, 19 May 2010, RenZhengYong wrote: > 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 > >
