diff options
author | Gael Guennebaud <g.gael@free.fr> | 2013-08-01 16:26:57 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2013-08-01 16:26:57 +0200 |
commit | ddf775363147fc7ee778b42c21b642f085193f55 (patch) | |
tree | dc08320f7a4dd5812599a84f0c8fa2c31a70e210 /Eigen/src/Core/util/Meta.h | |
parent | 55b57fcba6e56bea5c084cc756b50a447985e5c2 (diff) |
Add nvcc support for small eigenvalues decompositions and workaround lack of support for std::swap and std::numeric_limits
Diffstat (limited to 'Eigen/src/Core/util/Meta.h')
-rw-r--r-- | Eigen/src/Core/util/Meta.h | 24 |
1 files changed, 24 insertions, 0 deletions
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<bool Condition, typename T> struct enable_if; template<typename T> struct enable_if<true,T> { typedef T type; }; +#if defined(__CUDA_ARCH__) +template<typename T> EIGEN_DEVICE_FUNC void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; } +namespace device { +template<typename T> struct numeric_limits +{ + EIGEN_DEVICE_FUNC + static T epsilon() { return 0; } +}; +template<> struct numeric_limits<float> +{ + EIGEN_DEVICE_FUNC + static float epsilon() { return __FLT_EPSILON__; } +}; +template<> struct numeric_limits<double> +{ + EIGEN_DEVICE_FUNC + static double epsilon() { return __DBL_EPSILON__; } +}; + +} + +#else +template<typename T> 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. |