[petsc-dev] c++, float128 and complex patch

Michael Gegg michael.gegg at tu-berlin.de
Thu Sep 7 10:37:21 CDT 2017



Am 07.09.2017 um 17:26 schrieb Satish Balay:
> On Thu, 7 Sep 2017, Michael Gegg wrote:
>
>> Thank you very much, that does it. One more question: Could you include this
>> patch in the official petsc release in the future?
> Yes - once tested in next - it would go into master - and next release
> (3.8) of petsc.
ok thank you, I think that should be fine.
Michael

> I can also it to maint - which will go into next 3.7.7 patch
> release.. [will have to backport - due to code changes between
> maint/master]
>
> Satish
>
>> I would really appreciate
>> that: I wrote a c++ library for quantum optical master equations based on
>> petsc (https://github.com/modmido/psiquasp), which is available on github and
>> sometimes extended precision is necessary (complex is mandatory). I now
>> included a patch there, so that people can use this, but this is only a
>> momentary fix.
>>
>> Thank you. Michael
>>
>>
>>
>> Am 06.09.2017 um 20:03 schrieb Satish Balay:
>>> On Wed, 6 Sep 2017, Satish Balay wrote:
>>>
>>>>> So, could you give me a hint on how I should configure petsc so that
>>>>> this
>>>>> works? Is there a way to enforce the c99 complex numbers even when
>>>>> calling
>>>>> petsc from c++?
>>>> Perhaps this is the change you need?
>>> Looks like I need one more change..
>>>
>>> Satish
>>>
>>> ---------
>>> balay at asterix /home/balay/petsc (master *=)
>>> $ git diff
>>> diff --git a/include/petscmath.h b/include/petscmath.h
>>> index a63f1f4977..a201c3093e 100644
>>> --- a/include/petscmath.h
>>> +++ b/include/petscmath.h
>>> @@ -214,7 +214,7 @@ PETSC_EXTERN MPI_Datatype MPIU___COMPLEX128;
>>>    #endif  /* PETSC_USE_REAL_ */
>>>    #endif  /* ! PETSC_SKIP_COMPLEX */
>>>    -#elif !defined(__cplusplus) && defined(PETSC_HAVE_C99_COMPLEX) &&
>>> !defined(PETSC_USE_REAL___FP16)
>>> +#elif defined(PETSC_HAVE_C99_COMPLEX) && !defined(PETSC_USE_REAL___FP16)
>>>    #if !defined(PETSC_SKIP_COMPLEX)
>>>    #define PETSC_HAVE_COMPLEX 1
>>>    #include <complex.h>
>>> @@ -414,7 +414,7 @@ PETSC_EXTERN PetscComplex PETSC_i;
>>>    */
>>>    PETSC_STATIC_INLINE PetscComplex PetscCMPLX(PetscReal x, PetscReal y)
>>>    {
>>> -#if   defined(__cplusplus)
>>> +#if   defined(__cplusplus) && !defined(PETSC_USE_REAL___FLOAT128)
>>>      return PetscComplex(x,y);
>>>    #elif defined(_Imaginary_I)
>>>      return x + y * _Imaginary_I;
>>



More information about the petsc-dev mailing list