[petsc-dev] [petsc-maint #129715] __float128 complex

Jed Brown jedbrown at mcs.anl.gov
Thu Aug 23 11:13:29 CDT 2012


On Thu, Aug 23, 2012 at 11:02 AM, Jose E. Roman <jroman at dsic.upv.es> wrote:

>
> El 22/08/2012, a las 18:52, Jose E. Roman escribió:
>
> > f2cblaslapack is more or less prepared for this case already (it is not
> much tested though, we will make some tests for the w* subroutines
> tomorrow).
> >
> > What is not ready is PETSc itself. Some definitions are missing. For
> instance, PetscScalar is undefined, so one should add the following to
> petscmath.h:106:
> >
> > #elif defined(PETSC_USE_REAL___FLOAT128)
> > typedef __complex128 PetscScalar;
> >
> > #define PetscRealPart(a)      crealq(a)
> > #define PetscImaginaryPart(a) cimagq(a)
> > #define PetscAbsScalar(a)     cabsq(a)
> > #define PetscConj(a)          conjq(a)
> > #define PetscSqrtScalar(a)    csqrtq(a)
> > #define PetscPowScalar(a,b)   cpowq(a,b)
> > #define PetscExpScalar(a)     cexpq(a)
> > #define PetscLogScalar(a)     clogq(a)
> > #define PetscSinScalar(a)     csinq(a)
> > #define PetscCosScalar(a)     ccosq(a)
> >
> > Similarly, MPIU_SCALAR should be defined. Maybe other as well.
> >
> > Jose
>
> I have pushed a change to petsc-dev that allows to configure
> --with-precision=__float128 --with-scalar-type=complex
>
> I have tested this with src/ksp/ksp/examples/tutorials/ex12.c with 1 and 2
> processes. It seems to work.
>
> Please review the change, since I had to modify pinit.c
>

It looks good to me. Thanks.


>
> A couple of comments:
>
> 1) The f2cblaslapack interface to quad precision subroutines (q* and w*)
> is defined only in the case of "uscore" mangling. Maybe a test in configure
> should assure this.
>

Don't we just need to copy and update the list of defines to the different
mangling conventions? Seems easier to do than to test/document that it
doesn't work.


>
> 2) I could not make it work --with-clanguage=c++ - I get compilation
> errors like this. Any idea?
>

C++, in all it's template metaprogramming glory, standardized that
std::complex may *only* be used with float, double, and long double. Using
std::complex<anything_else> is invalid. Just one of a very long list of
reasons why std::complex should not be used.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20120823/a1025ced/attachment.html>


More information about the petsc-dev mailing list