mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 01:59:38 +08:00
Added a specialization of Eigen::numext::real and Eigen::numext::imag for std::complex<T> to be used when compiling a cuda kernel. This is unfortunately necessary to be able to process complex numbers from a CUDA kernel on MacOS.
This commit is contained in:
parent
3946768916
commit
2a69290ddb
@ -97,6 +97,19 @@ struct real_default_impl<Scalar,true>
|
|||||||
|
|
||||||
template<typename Scalar> struct real_impl : real_default_impl<Scalar> {};
|
template<typename Scalar> struct real_impl : real_default_impl<Scalar> {};
|
||||||
|
|
||||||
|
#ifdef __CUDA_ARCH__
|
||||||
|
template<typename T>
|
||||||
|
struct real_impl<std::complex<T> >
|
||||||
|
{
|
||||||
|
typedef T RealScalar;
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
static inline T run(const std::complex<T>& x)
|
||||||
|
{
|
||||||
|
return x.real();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct real_retval
|
struct real_retval
|
||||||
{
|
{
|
||||||
@ -132,6 +145,19 @@ struct imag_default_impl<Scalar,true>
|
|||||||
|
|
||||||
template<typename Scalar> struct imag_impl : imag_default_impl<Scalar> {};
|
template<typename Scalar> struct imag_impl : imag_default_impl<Scalar> {};
|
||||||
|
|
||||||
|
#ifdef __CUDA_ARCH__
|
||||||
|
template<typename T>
|
||||||
|
struct imag_impl<std::complex<T> >
|
||||||
|
{
|
||||||
|
typedef T RealScalar;
|
||||||
|
EIGEN_DEVICE_FUNC
|
||||||
|
static inline T run(const std::complex<T>& x)
|
||||||
|
{
|
||||||
|
return x.imag();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
template<typename Scalar>
|
template<typename Scalar>
|
||||||
struct imag_retval
|
struct imag_retval
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user