Re: [petsc-dev] c++, float128 and complex patch
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. 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@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;
participants (1)
-
Satish Balay