15 #include <emmintrin.h> 18 #include <smmintrin.h> 33 _val = _mm_add_pd(_val, other.
_val);
39 _val = _mm_sub_pd(_val, other.
_val);
44 return _mm_add_pd(_mm_mul_pd(_mm_shuffle_pd(_val, _val, 1), _mm_shuffle_pd((-other.
_val), other.
_val, 3)),
45 _mm_mul_pd(_val, _mm_shuffle_pd(other.
_val, other.
_val, 0)));
49 _val = _mm_add_pd(_mm_mul_pd(_mm_shuffle_pd(_val, _val, 1), _mm_shuffle_pd((-other.
_val), other.
_val, 3)),
50 _mm_mul_pd(_val, _mm_shuffle_pd(other.
_val, other.
_val, 0)));
57 double nrm = _mm_cvtsd_f64(_mm_dp_pd(other.
_val, other.
_val, 0xf1));
59 __v2df temp = (__v2df)_mm_mul_pd(other.
_val, other.
_val);
60 double nrm = (temp[0] + temp[1]);
63 _mm_add_pd(_mm_mul_pd(_mm_shuffle_pd(_val, _val, 1), _mm_shuffle_pd(other.
_val, -(other.
_val), 3)),
64 _mm_mul_pd(_val, _mm_shuffle_pd(other.
_val, other.
_val, 0))),
70 double nrm = _mm_cvtsd_f64(_mm_dp_pd(other.
_val, other.
_val, 0xf1));
72 __v2df temp = (__v2df)_mm_mul_pd(other.
_val, other.
_val);
73 double nrm = (temp[0] + temp[1]);
76 _mm_add_pd(_mm_mul_pd(_mm_shuffle_pd(_val, _val, 1), _mm_shuffle_pd(other.
_val, -(other.
_val), 3)),
77 _mm_mul_pd(_val, _mm_shuffle_pd(other.
_val, other.
_val, 0))),
84 _val = _mm_div_pd(_val, _mm_set1_pd(rhs));
90 _val = _mm_mul_pd(_val, _mm_set1_pd(other));
95 __v2df vec = (__v2df)(_val == rhs.
_val);
96 return vec[0] && vec[1];
100 __v2df vec = (__v2df)(_val != rhs.
_val);
101 return vec[0] && vec[1];
107 return _mm_mul_pd(_mm_set1_pd(lhs), rhs.
_val);
111 __v2df temp = (__v2df)_mm_mul_pd(rhs.
_val, rhs.
_val);
112 double denom = temp[0] + temp[1];
113 temp = (__v2df)_mm_div_pd(_mm_mul_pd(rhs.
_val, _mm_set1_pd(lhs)), _mm_set1_pd(denom));
124 return atan2(
imag(cmplx),
real(cmplx));
128 return _mm_shuffle_pd(cmplx.
_val, _mm_sub_pd(_mm_set1_pd(0.0), cmplx.
_val), 2);
133 return _mm_cvtsd_f64(_mm_dp_pd(cmplx.
_val, cmplx.
_val, 0xf1));
135 __v2df temp = (__v2df)_mm_mul_pd(cmplx.
_val, cmplx.
_val);
136 return (temp[0] + temp[1]);
142 return _mm_set1_pd(rho) * _mm_set_pd(sin(theta), cos(theta));
Complex16Simd operator/(const Complex16Simd &other) const
Definition: complex16simd.hpp:54
Complex16Simd operator/=(const double rhs)
Definition: complex16simd.hpp:82
Complex16Simd operator*(const Complex16Simd &other) const
Definition: complex16simd.hpp:42
Complex16Simd(const __m128d &v)
Definition: complex16simd.hpp:28
Complex16Simd operator*=(const double &other)
Definition: complex16simd.hpp:88
Complex16Simd(const double &real, const double &imag)
Definition: complex16simd.hpp:29
Complex16Simd operator/(const double rhs) const
Definition: complex16simd.hpp:81
double arg(const Complex16Simd &cmplx)
Definition: complex16simd.hpp:120
double imag(const Complex16Simd &cmplx)
Definition: complex16simd.hpp:118
bool operator==(const Complex16Simd &rhs) const
Definition: complex16simd.hpp:93
bool operator!=(const Complex16Simd &rhs) const
Definition: complex16simd.hpp:98
Complex16Simd operator+(const Complex16Simd &other) const
Definition: complex16simd.hpp:30
double abs(const Complex16Simd &cmplx)
Definition: complex16simd.hpp:139
Complex16Simd operator*(const double rhs) const
Definition: complex16simd.hpp:53
Complex16Simd conj(const Complex16Simd &cmplx)
Definition: complex16simd.hpp:126
double real(const Complex16Simd &cmplx)
Definition: complex16simd.hpp:117
Complex16Simd operator-(const Complex16Simd &other) const
Definition: complex16simd.hpp:36
__m128d _val
Definition: complex16simd.hpp:25
Complex16Simd operator*=(const Complex16Simd &other)
Definition: complex16simd.hpp:47
double norm(const Complex16Simd &cmplx)
Definition: complex16simd.hpp:130
SIMD implementation of the double precision complex type.
Definition: complex16simd.hpp:24
Complex16Simd polar(const double rho, const double theta=0)
Definition: complex16simd.hpp:140
Complex16Simd operator/=(const Complex16Simd &other)
Definition: complex16simd.hpp:67
Definition: complex16simd.hpp:21
Complex16Simd operator+=(const Complex16Simd &other)
Definition: complex16simd.hpp:31
Complex16Simd operator-() const
Definition: complex16simd.hpp:87
Complex16Simd operator-=(const Complex16Simd &other)
Definition: complex16simd.hpp:37
Complex16Simd()
Definition: complex16simd.hpp:27