static __inline cuDoubleComplex cuCfma(cuDoubleComplex x, cuDoubleComplex y, cuDoubleComplex d) { double real_res; double imag_res; real_res = cuCreal(x) * cuCreal(y) + cuCreal(d); imag_res = cuCreal(x) * cuCimag(y) + cuCimag(d); real_res = -(cuCimag(x) * cuCimag(y)) + real_res; imag_res = cuCimag(x) * cuCreal(y) + imag_res; return make_cuDoubleComplex(real_res, imag_res); }
static __inline cuDoubleComplex cuCdiv(cuDoubleComplex x, cuDoubleComplex y) { cuDoubleComplex quot; double s = fabs(cuCreal(y)) + fabs(cuCimag(y)); double oos = 1.00000000000000000000000000000000000000000000000000000e+00 / s; double ars = cuCreal(x) * oos; double ais = cuCimag(x) * oos; double brs = cuCreal(y) * oos; double bis = cuCimag(y) * oos; s = brs * brs + bis * bis; oos = 1.00000000000000000000000000000000000000000000000000000e+00 / s; quot = make_cuDoubleComplex((ars * brs + ais * bis) * oos, (ais * brs - ars * bis) * oos); return quot; }
static __inline double cuCabs(cuDoubleComplex x) { double v; double w; double t; double a = cuCreal(x); double b = cuCimag(x); a = fabs(a); b = fabs(b); if (a > b) { v = a; w = b; } else { v = b; w = a; } t = w / v; t = 1.00000000000000000000000000000000000000000000000000000e+00 + t * t; t = v * sqrt(t); if ((v == 0.00000000000000000000000000000000000000000000000000000e+00 || v > 1.79769313486231570814527423731704356798070567525844997e+308) || w > 1.79769313486231570814527423731704356798070567525844997e+308) { t = v + w; } return t; }
__SDH__ double imag(cdouble c) { return cuCimag(c); }
static __inline cuFloatComplex cuComplexDoubleToFloat(cuDoubleComplex c) { return make_cuFloatComplex((float)cuCreal(c), (float)cuCimag(c)); }
static __inline cuDoubleComplex cuCmul(cuDoubleComplex x, cuDoubleComplex y) { cuDoubleComplex prod; prod = make_cuDoubleComplex(cuCreal(x) * cuCreal(y) - cuCimag(x) * cuCimag(y), cuCreal(x) * cuCimag(y) + cuCimag(x) * cuCreal(y)); return prod; }
static __inline cuDoubleComplex cuCsub(cuDoubleComplex x, cuDoubleComplex y) { return make_cuDoubleComplex(cuCreal(x) - cuCreal(y), cuCimag(x) - cuCimag(y)); }
static __inline cuDoubleComplex cuConj(cuDoubleComplex x) { return make_cuDoubleComplex(cuCreal(x), -cuCimag(x)); }