-
Notifications
You must be signed in to change notification settings - Fork 0
/
pycuda-complex_more.hpp
54 lines (38 loc) · 1.78 KB
/
pycuda-complex_more.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#ifndef PYCUDA_COMPLEX_HPP_MORE
#define PYCUDA_COMPLEX_HPP_MORE
#include <pycuda/pycuda-complex.hpp>
extern "C++" {
namespace pycuda{
/*
__device__ inline complex<double> operator+(const complex<double>& __z, const float& __x)
{return pycuda::complex<double>(__x + __z._M_re, __z._M_im);}
__device__ inline complex<double> operator+(const complex<float>& __z, const double& __x)
{return complex<double>(__x + __z._M_re, __z._M_im);}
*/
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator+(const complex<_Tp1>& __z, const _Tp2& __x)
{return complex<double>(__z._M_re + __x, __z._M_im);}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator+(const _Tp2& __x, const complex<_Tp1>& __z)
{return complex<double>(__x + __z._M_re, __z._M_im);}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator-(const complex<_Tp1>& __z, const _Tp2& __x)
{return complex<double>(__z._M_re - __x, __z._M_im);}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator-(const _Tp2& __x, const complex<_Tp1>& __z)
{return complex<double>(__x - __z._M_re, __z._M_im);}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator*(const complex<_Tp1>& __z, const _Tp2& __x)
{return (complex<double>)__z * __x;}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator*(const _Tp2& __x, const complex<_Tp1>& __z)
{return (complex<double>)__z * __x;}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator/(const complex<_Tp1>& __z, const _Tp2& __x)
{return (complex<double>)__z / __x;}
template <class _Tp1, class _Tp2>
__device__ inline complex<double> operator/(const _Tp2& __x, const complex<_Tp1>& __z)
{return __x / (complex<double>)__z;}
}
}
#endif