From ddf775363147fc7ee778b42c21b642f085193f55 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Thu, 1 Aug 2013 16:26:57 +0200 Subject: Add nvcc support for small eigenvalues decompositions and workaround lack of support for std::swap and std::numeric_limits --- Eigen/src/Core/util/Meta.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Eigen/src/Core/util/Meta.h') diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 71d587108..aea168b46 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -88,7 +88,31 @@ template struct enable_if; template struct enable_if { typedef T type; }; +#if defined(__CUDA_ARCH__) +template EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; } +namespace device { +template struct numeric_limits +{ + EIGEN_DEVICE_FUNC + static T epsilon() { return 0; } +}; +template<> struct numeric_limits +{ + EIGEN_DEVICE_FUNC + static float epsilon() { return __FLT_EPSILON__; } +}; +template<> struct numeric_limits +{ + EIGEN_DEVICE_FUNC + static double epsilon() { return __DBL_EPSILON__; } +}; + +} + +#else +template EIGEN_STRONG_INLINE void swap(T &a, T &b) { std::swap(a,b); } +#endif /** \internal * A base class do disable default copy ctor and copy assignement operator. -- cgit v1.2.3