Added NumTraits for type2index.

This commit is contained in:
Benoit Steiner 2016-03-30 18:36:36 -07:00
parent 4f1a7e51c1
commit 791e5cfb69

View File

@ -45,6 +45,23 @@ struct type2index {
}
};
template<DenseIndex n> struct NumTraits<type2index<n> >
{
typedef DenseIndex Real;
enum {
IsComplex = 0,
RequireInitialization = false,
ReadCost = 1,
AddCost = 1,
MulCost = 1
};
EIGEN_DEVICE_FUNC static inline Real epsilon() { return 0; }
EIGEN_DEVICE_FUNC static inline Real dummy_precision() { return 0; }
EIGEN_DEVICE_FUNC static inline Real highest() { return n; }
EIGEN_DEVICE_FUNC static inline Real lowest() { return n; }
};
namespace internal {
template <typename T>
EIGEN_DEVICE_FUNC void update_value(T& val, DenseIndex new_val) {