39 __device__
static inline hipFloatComplex make_hipFloatComplex(
float a,
float b){
54 return z.x * z.x + z.y * z.y;
58 return make_hipFloatComplex(p.x + q.x, p.y + q.y);
62 return make_hipFloatComplex(p.x - q.x, p.y - q.y);
66 return make_hipFloatComplex(p.x * q.x - p.y * q.y, p.y * q.x + p.x * q.y);
70 float sqabs = hipCsqabsf(q);
72 ret.x = (p.x * q.x + p.y * q.y)/sqabs;
73 ret.y = (p.y * q.x - p.x * q.y)/sqabs;
78 return sqrtf(hipCsqabsf(z));
95 __device__
static inline hipDoubleComplex make_hipDoubleComplex(
double a,
double b){
110 return z.x * z.x + z.y * z.y;
114 return make_hipDoubleComplex(p.x + q.x, p.y + q.y);
118 return make_hipDoubleComplex(p.x - q.x, p.y - q.y);
122 return make_hipDoubleComplex(p.x * q.x - p.y * q.y, p.y * q.x + p.x * q.y);
126 double sqabs = hipCsqabs(q);
128 ret.x = (p.x * q.x + p.y * q.y)/sqabs;
129 ret.y = (p.y * q.x - p.x * q.y)/sqabs;
134 return sqrtf(hipCsqabs(z));
139 __device__
static inline hipComplex make_hipComplex(
float x,
141 return make_hipFloatComplex(x, y);
146 return make_hipFloatComplex((
float)z.x, (
float)z.y);
151 return make_hipDoubleComplex((
double)z.x, (
double)z.y);
154 __device__
static inline hipComplex hipCfmaf(hipComplex p, hipComplex q, hipComplex r){
155 float real = (p.x * q.x) + r.x;
156 float imag = (q.x * p.y) + r.y;
158 real = -(p.y * q.y) + real;
159 imag = (p.x * q.y) + imag;
161 return make_hipComplex(real, imag);
165 float real = (p.x * q.x) + r.x;
166 float imag = (q.x * p.y) + r.y;
168 real = -(p.y * q.y) + real;
169 imag = (p.x * q.y) + imag;
171 return make_hipDoubleComplex(real, imag);
Definition: hip_complex.h:26
Definition: hip_complex.h:82