1 //------------------------------------------------------------------------------ 2 // GB_cplusplus.h: definitions for C++ 3 //------------------------------------------------------------------------------ 4 5 // SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. 6 // SPDX-License-Identifier: Apache-2.0 7 8 //------------------------------------------------------------------------------ 9 10 // These macros allow GraphBLAS to be compiled with a C++ compiler. See: 11 // https://www.drdobbs.com/complex-arithmetic-in-the-intersection-o/184401628# 12 13 #ifndef GB_CPLUSPLUS_H 14 #define GB_CPLUSPLUS_H 15 16 #if defined ( __cplusplus ) 17 18 using namespace std ; 19 20 #define crealf(x) real(x) 21 #define creal(x) real(x) 22 23 #define cimagf(x) imag(x) 24 #define cimag(x) imag(x) 25 26 #define cpowf(x,y) pow(x,y) 27 #define cpow(x,y) pow(x,y) 28 #define powf(x,y) pow(x,y) 29 30 #define cexpf(x) exp(x) 31 #define cexp(x) exp(x) 32 #define expf(x) exp(x) 33 34 #define clogf(x) log(x) 35 #define clog(x) log(x) 36 #define logf(x) log(x) 37 38 #define cabsf(x) abs(x) 39 #define cabs(x) abs(x) 40 #define absf(x) abs(x) 41 42 #define csqrtf(x) sqrt(x) 43 #define csqrt(x) sqrt(x) 44 #define sqrtf(x) sqrt(x) 45 46 #define conjf(x) conj(x) 47 48 #define cargf(x) arg(x) 49 #define carg(x) arg(x) 50 51 #define csinf(x) sin(x) 52 #define csin(x) sin(x) 53 #define sinf(x) sin(x) 54 55 #define ccosf(x) cos(x) 56 #define ccos(x) cos(x) 57 #define cosf(x) cos(x) 58 59 #define ctanf(x) tan(x) 60 #define ctan(x) tan(x) 61 #define tanf(x) tan(x) 62 63 #define casinf(x) asin(x) 64 #define casin(x) asin(x) 65 #define asinf(x) asin(x) 66 67 #define cacosf(x) acos(x) 68 #define cacos(x) acos(x) 69 #define acosf(x) acos(x) 70 71 #define catanf(x) atan(x) 72 #define catan(x) atan(x) 73 #define atanf(x) atan(x) 74 75 #define csinhf(x) sinh(x) 76 #define csinh(x) sinh(x) 77 #define sinhf(x) sinh(x) 78 79 #define ccoshf(x) cosh(x) 80 #define ccosh(x) cosh(x) 81 #define coshf(x) cosh(x) 82 83 #define ctanhf(x) tanh(x) 84 #define ctanh(x) tanh(x) 85 #define tanhf(x) tanh(x) 86 87 #define casinhf(x) asinh(x) 88 #define casinh(x) asinh(x) 89 #define asinhf(x) asinh(x) 90 91 #define cacoshf(x) acosh(x) 92 #define cacosh(x) acosh(x) 93 #define acoshf(x) acosh(x) 94 95 #define catanhf(x) atanh(x) 96 #define catanh(x) atanh(x) 97 #define atanhf(x) atanh(x) 98 99 #endif 100 #endif 101