aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Core/MathFunctions.h
diff options
context:
space:
mode:
authorGravatar nicolov <nicolo.valigi@gmail.com>2018-04-13 22:29:10 +0000
committerGravatar nicolov <nicolo.valigi@gmail.com>2018-04-13 22:29:10 +0000
commit39c2cba810a573ae4d0efd2b0b80e08c934b99b3 (patch)
treee28f96f1f1eb187673e77da776bc580b5b7c7a5d /Eigen/src/Core/MathFunctions.h
parent775766d175f52d4aa86268c6e6ff43cee374a56a (diff)
Add a specialization of Eigen::numext::conj for std::complex<T> to be used when compiling a cuda kernel. This fixes the compilation of TensorFlow 1.4 with clang 6.0 used as CUDA compiler with libc++.
This follows the previous change in https://bitbucket.org/eigen/eigen/commits/2a69290ddb165b7103c87ba8f5b257eca23f62aa , which mentions OSX (I guess because it uses libc++ too).
Diffstat (limited to 'Eigen/src/Core/MathFunctions.h')
-rw-r--r--Eigen/src/Core/MathFunctions.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/Eigen/src/Core/MathFunctions.h b/Eigen/src/Core/MathFunctions.h
index ac1b7a6a1..05462c5e1 100644
--- a/Eigen/src/Core/MathFunctions.h
+++ b/Eigen/src/Core/MathFunctions.h
@@ -238,7 +238,7 @@ struct imag_ref_retval
****************************************************************************/
template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
-struct conj_impl
+struct conj_default_impl
{
EIGEN_DEVICE_FUNC
static inline Scalar run(const Scalar& x)
@@ -248,7 +248,7 @@ struct conj_impl
};
template<typename Scalar>
-struct conj_impl<Scalar,true>
+struct conj_default_impl<Scalar,true>
{
EIGEN_DEVICE_FUNC
static inline Scalar run(const Scalar& x)
@@ -258,6 +258,20 @@ struct conj_impl<Scalar,true>
}
};
+template<typename Scalar> struct conj_impl : conj_default_impl<Scalar> {};
+
+#ifdef EIGEN_CUDA_ARCH
+template<typename T>
+struct conj_impl<std::complex<T> >
+{
+ EIGEN_DEVICE_FUNC
+ static inline std::complex<T> run(const std::complex<T>& x)
+ {
+ return std::complex<T>(x.real(), -x.imag());
+ }
+};
+#endif
+
template<typename Scalar>
struct conj_retval
{