mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
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 2a69290ddb
, which mentions OSX (I guess because it uses libc++ too).
This commit is contained in:
parent
775766d175
commit
39c2cba810
@ -238,7 +238,7 @@ struct imag_ref_retval
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
|
template<typename Scalar, bool IsComplex = NumTraits<Scalar>::IsComplex>
|
||||||
struct conj_impl
|
struct conj_default_impl
|
||||||
{
|
{
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline Scalar run(const Scalar& x)
|
static inline Scalar run(const Scalar& x)
|
||||||
@ -248,7 +248,7 @@ struct conj_impl
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct conj_impl<Scalar,true>
|
struct conj_default_impl<Scalar,true>
|
||||||
{
|
{
|
||||||
EIGEN_DEVICE_FUNC
|
EIGEN_DEVICE_FUNC
|
||||||
static inline Scalar run(const Scalar& x)
|
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>
|
template<typename Scalar>
|
||||||
struct conj_retval
|
struct conj_retval
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user