17namespace isce3::matchtemplate::pycuampcor {
35inline int2 make_int2(
int x,
int y) {
39inline float2 make_float2(
float x,
float y) {
43inline double2 make_double2(
double x,
double y) {
47inline float3 make_float3(
float x,
float y,
float z) {
51inline __host__ __device__
void zero(
float2 &a) { a.x = 0.0f; a.y = 0.0f; }
56 return make_float2(-a.x, -a.y);
62 return make_float2(a.x, -a.y);
68 return make_float2(a.x + b.x, a.y + b.y);
70inline __host__ __device__
void operator+=(
float2 &a,
float2 b)
76inline __host__ __device__
float2 operator+(
float2 a,
float b)
78 return make_float2(a.x + b, a.y);
80inline __host__ __device__
void operator+=(
float2 &a,
float b)
95 return make_float2(a.x - b.x, a.y - b.y);
97inline __host__ __device__
void operator-=(
float2 &a,
float2 b)
102inline __host__ __device__
float2 operator-(
float2 a,
float b)
104 return make_float2(a.x - b, a.y);
106inline __host__ __device__
void operator-=(
float2 &a,
float b)
114 return make_float2(a.x*b.x - a.y*b.y, a.y*b.x + a.x*b.y);
116inline __host__ __device__
void operator*=(
float2 &a,
float2 b)
118 a.x = a.x*b.x - a.y*b.y;
119 a.y = a.y*b.x + a.x*b.y;
121inline __host__ __device__
float2 operator*(
float2 a,
float b)
123 return make_float2(a.x * b, a.y * b);
125inline __host__ __device__
void operator*=(
float2 &a,
float b)
130inline __host__ __device__
float2 operator*(
float2 a,
int b)
132 return make_float2(a.x * b, a.y * b);
134inline __host__ __device__
void operator*=(
float2 &a,
int b)
145 return make_float2(a.x*b.x + a.y*b.y, a.y*b.x - a.x*b.y);
148inline __host__ __device__
float2 operator/(
float2 a,
float b)
150 return make_float2(a.x / b, a.y / b);
152inline __host__ __device__
void operator/=(
float2 &a,
float b)
159inline __host__ __device__
float complexAbs(
float2 a)
161 return sqrtf(a.x*a.x+a.y*a.y);
163inline __host__ __device__
float complexArg(
float2 a)
165 return atan2f(a.y, a.x);
169inline __host__ __device__
float2 complexExp(
float arg)
171 return make_float2(cosf(arg), sinf(arg));