aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2018-03-23 00:59:15 +0000
committerGravatar Benoit Steiner <benoit.steiner.goog@gmail.com>2018-03-23 00:59:15 +0000
commitd2631ef61d621eee4c97270b207ed1d2beb1b1f8 (patch)
treedac7fc1c60b6e01d7069d811135abc840b68e2b4 /Eigen
parent8fcbd6d4c943635f6299e65f304e989e31e2120a (diff)
parent42a83346683861e7a58e8c9aa407eb001d56befa (diff)
Merged in facaiy/eigen/ENH/exp_support_complex_for_gpu (pull request PR-359)
ENH: exp supports complex type for cuda
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Core/MathFunctions.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h
index 5ba5293a0..1b864a405 100644
--- a/Eigen/src/Core/MathFunctions.h
+++ b/Eigen/src/Core/MathFunctions.h
@@ -1289,6 +1289,22 @@ float exp(const float &x) { return ::expf(x); }
template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
double exp(const double &x) { return ::exp(x); }
+
+template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
+std::complex<float> exp(const std::complex<float>& x) {
+ auto com = ::expf(x.real());
+ auto res_real = com * ::cosf(x.imag());
+ auto res_imag = com * ::sinf(x.imag());
+ return std::complex<float>(res_real, res_imag);
+}
+
+template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE
+std::complex<double> exp(const std::complex<double>& x) {
+ auto com = ::exp(x.real());
+ auto res_real = com * ::cos(x.imag());
+ auto res_imag = com * ::sin(x.imag());
+ return std::complex<double>(res_real, res_imag);
+}
#endif
template<typename Scalar>