Add nvcc support for small eigenvalues decompositions and workaround lack of support for std::swap and std::numeric_limits

This commit is contained in:
Gael Guennebaud
2013-08-01 16:26:57 +02:00
parent 55b57fcba6
commit ddf7753631
14 changed files with 234 additions and 29 deletions

View File

@@ -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.