mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Add nvcc support for small eigenvalues decompositions and workaround lack of support for std::swap and std::numeric_limits
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user