12 #ifndef _MAGMA_OPERATORS_H_
13 #define _MAGMA_OPERATORS_H_
19 __host__ __device__
static __inline__ cuDoubleComplex
22 return make_cuDoubleComplex(-a.x, -a.y);
25 __host__ __device__
static __inline__ cuDoubleComplex
26 operator+(
const cuDoubleComplex a,
const cuDoubleComplex b)
28 return make_cuDoubleComplex(a.x + b.x, a.y + b.y);
31 __host__ __device__
static __inline__
void
34 a.x += b.x; a.y += b.y;
37 __host__ __device__
static __inline__ cuDoubleComplex
38 operator-(
const cuDoubleComplex a,
const cuDoubleComplex b)
40 return make_cuDoubleComplex(a.x - b.x, a.y - b.y);
43 __host__ __device__
static __inline__
void
46 a.x -= b.x; a.y -= b.y;
49 __host__ __device__
static __inline__ cuDoubleComplex
50 operator*(
const cuDoubleComplex a,
const cuDoubleComplex b)
52 return make_cuDoubleComplex(a.x * b.x - a.y * b.y, a.y * b.x + a.x * b.y);
55 __host__ __device__
static __inline__ cuDoubleComplex
58 return make_cuDoubleComplex(a.x * s, a.y * s);
61 __host__ __device__
static __inline__ cuDoubleComplex
64 return make_cuDoubleComplex(a.x * s, a.y * s);
67 __host__ __device__
static __inline__
void
70 double tmp = a.y * b.x + a.x * b.y;
71 a.x = a.x * b.x - a.y * b.y;
75 __host__ __device__
static __inline__
void
85 __host__ __device__
static __inline__ cuFloatComplex
88 return make_cuFloatComplex(-a.x, -a.y);
91 __host__ __device__
static __inline__ cuFloatComplex
92 operator+(
const cuFloatComplex a,
const cuFloatComplex b)
94 return make_cuFloatComplex(a.x + b.x, a.y + b.y);
97 __host__ __device__
static __inline__
void
100 a.x += b.x; a.y += b.y;
103 __host__ __device__
static __inline__ cuFloatComplex
104 operator-(
const cuFloatComplex a,
const cuFloatComplex b)
106 return make_cuFloatComplex(a.x - b.x, a.y - b.y);
109 __host__ __device__
static __inline__
void
112 a.x -= b.x; a.y -= b.y;
115 __host__ __device__
static __inline__ cuFloatComplex
116 operator*(
const cuFloatComplex a,
const cuFloatComplex b)
118 return make_cuFloatComplex(a.x * b.x - a.y * b.y, a.y * b.x + a.x * b.y);
121 __host__ __device__
static __inline__ cuFloatComplex
124 return make_cuFloatComplex(a.x * s, a.y * s);
127 __host__ __device__
static __inline__ cuFloatComplex
130 return make_cuFloatComplex(a.x * s, a.y * s);
133 __host__ __device__
static __inline__
void
136 float tmp = a.y * b.x + a.x * b.y;
137 a.x = a.x * b.x - a.y * b.y;
141 __host__ __device__
static __inline__
void