10 #ifndef EIGEN_COMPLEX_CUDA_H 11 #define EIGEN_COMPLEX_CUDA_H 19 #if defined(__CUDACC__) && defined(EIGEN_USE_GPU) 28 template<
typename T>
struct scalar_sum_op<const
std::complex<T>, const std::complex<T> > : binary_op_base<const std::complex<T>, const std::complex<T> > {
29 typedef typename std::complex<T> result_type;
31 EIGEN_EMPTY_STRUCT_CTOR(scalar_sum_op)
32 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> operator() (
const std::complex<T>& a,
const std::complex<T>& b)
const {
33 return std::complex<T>(numext::real(a) + numext::real(b),
34 numext::imag(a) + numext::imag(b));
38 template<
typename T>
struct scalar_sum_op<
std::complex<T>, std::complex<T> > : scalar_sum_op<const std::complex<T>, const std::complex<T> > {};
42 template<
typename T>
struct scalar_difference_op<const std::complex<T>, const std::complex<T> > : binary_op_base<const std::complex<T>, const std::complex<T> > {
43 typedef typename std::complex<T> result_type;
45 EIGEN_EMPTY_STRUCT_CTOR(scalar_difference_op)
46 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> operator() (
const std::complex<T>& a,
const std::complex<T>& b)
const {
47 return std::complex<T>(numext::real(a) - numext::real(b),
48 numext::imag(a) - numext::imag(b));
52 template<
typename T>
struct scalar_difference_op<std::complex<T>, std::complex<T> > : scalar_difference_op<const std::complex<T>, const std::complex<T> > {};
56 template<
typename T>
struct scalar_product_op<const std::complex<T>, const std::complex<T> > : binary_op_base<const std::complex<T>, const std::complex<T> > {
58 Vectorizable = packet_traits<std::complex<T>>::HasMul
60 typedef typename std::complex<T> result_type;
62 EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op)
63 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> operator() (
const std::complex<T>& a,
const std::complex<T>& b)
const {
64 const T a_real = numext::real(a);
65 const T a_imag = numext::imag(a);
66 const T b_real = numext::real(b);
67 const T b_imag = numext::imag(b);
68 return std::complex<T>(a_real * b_real - a_imag * b_imag,
69 a_real * b_imag + a_imag * b_real);
73 template<
typename T>
struct scalar_product_op<std::complex<T>, std::complex<T> > : scalar_product_op<const std::complex<T>, const std::complex<T> > {};
77 template<
typename T>
struct scalar_quotient_op<const std::complex<T>, const std::complex<T> > : binary_op_base<const std::complex<T>, const std::complex<T> > {
79 Vectorizable = packet_traits<std::complex<T>>::HasDiv
81 typedef typename std::complex<T> result_type;
83 EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op)
84 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE std::complex<T> operator() (
const std::complex<T>& a,
const std::complex<T>& b)
const {
85 const T a_real = numext::real(a);
86 const T a_imag = numext::imag(a);
87 const T b_real = numext::real(b);
88 const T b_imag = numext::imag(b);
89 const T norm = T(1) / (b_real * b_real + b_imag * b_imag);
90 return std::complex<T>((a_real * b_real + a_imag * b_imag) * norm,
91 (a_imag * b_real - a_real * b_imag) * norm);
95 template<
typename T>
struct scalar_quotient_op<std::complex<T>, std::complex<T> > : scalar_quotient_op<const std::complex<T>, const std::complex<T> > {};
103 #endif // EIGEN_COMPLEX_CUDA_H Namespace containing all symbols from the Eigen library.
Definition: Core:287
Definition: Eigen_Colamd.h:50