static __inline cuComplex cuCfmaf(cuComplex x, cuComplex y, cuComplex d) { float real_res; float imag_res; real_res = cuCrealf(x) * cuCrealf(y) + cuCrealf(d); imag_res = cuCrealf(x) * cuCimagf(y) + cuCimagf(d); real_res = -(cuCimagf(x) * cuCimagf(y)) + real_res; imag_res = cuCimagf(x) * cuCrealf(y) + imag_res; return make_cuComplex(real_res, imag_res); }
static __inline cuFloatComplex cuCdivf(cuFloatComplex x, cuFloatComplex y) { cuFloatComplex quot; float s = fabsf(cuCrealf(y)) + fabsf(cuCimagf(y)); float oos = 1.000000000000000000000000e+00f / s; float ars = cuCrealf(x) * oos; float ais = cuCimagf(x) * oos; float brs = cuCrealf(y) * oos; float bis = cuCimagf(y) * oos; s = brs * brs + bis * bis; oos = 1.000000000000000000000000e+00f / s; quot = make_cuFloatComplex((ars * brs + ais * bis) * oos, (ais * brs - ars * bis) * oos); return quot; }
static __inline float cuCabsf(cuFloatComplex x) { float v; float w; float t; float a = cuCrealf(x); float b = cuCimagf(x); a = fabsf(a); b = fabsf(b); if (a > b) { v = a; w = b; } else { v = b; w = a; } t = w / v; t = 1.000000000000000000000000e+00f + t * t; t = v * sqrtf(t); if ((v == 0.000000000000000000000000e+00f || v > 3.402823466385288598117042e+38f) || w > 3.402823466385288598117042e+38f) { t = v + w; } return t; }
__SDH__ float imag(cfloat c) { return cuCimagf(c); }
static __inline cuDoubleComplex cuComplexFloatToDouble(cuFloatComplex c) { return make_cuDoubleComplex((double)cuCrealf(c), (double)cuCimagf(c)); }
static __inline cuFloatComplex cuCmulf(cuFloatComplex x, cuFloatComplex y) { cuFloatComplex prod; prod = make_cuFloatComplex(cuCrealf(x) * cuCrealf(y) - cuCimagf(x) * cuCimagf(y), cuCrealf(x) * cuCimagf(y) + cuCimagf(x) * cuCrealf(y)); return prod; }
static __inline cuFloatComplex cuCsubf(cuFloatComplex x, cuFloatComplex y) { return make_cuFloatComplex(cuCrealf(x) - cuCrealf(y), cuCimagf(x) - cuCimagf(y)); }
static __inline cuFloatComplex cuConjf(cuFloatComplex x) { return make_cuFloatComplex(cuCrealf(x), -cuCimagf(x)); }