14 #if defined(__CUDA_ARCH__) 16 #include <math_constants.h> 19 #if EIGEN_COMP_ICC>=1600 && __cplusplus >= 201103L 46 #if EIGEN_COMP_ICC>=1600 && __cplusplus >= 201103L 47 typedef std::intptr_t
IntPtr;
57 template<
bool Condition,
typename Then,
typename Else>
60 template<
typename Then,
typename Else>
63 template<
typename T,
typename U>
struct is_same {
enum {
value = 0 }; };
75 template <
class T>
struct remove_const<const T[]> {
typedef T type[]; };
76 template <
class T,
unsigned int Size>
struct remove_const<const T[Size]> {
typedef T type[Size]; };
125 template<
typename From,
typename To>
135 struct no {
int a[2];};
137 static yes test(
const To&,
int);
142 #ifdef __INTEL_COMPILER 144 #pragma warning ( disable : 2259 ) 146 enum {
value =
sizeof(test(ms_from, 0))==
sizeof(
yes) };
147 #ifdef __INTEL_COMPILER 152 template<
typename From,
typename To>
162 template<
bool Condition,
typename T=
void>
struct enable_if;
167 #if defined(__CUDA_ARCH__) 168 #if !defined(__FLT_EPSILON__) 169 #define __FLT_EPSILON__ FLT_EPSILON 170 #define __DBL_EPSILON__ DBL_EPSILON 175 template<
typename T>
struct numeric_limits
178 static T
epsilon() {
return 0; }
179 static T (
max)() { assert(
false &&
"Highest not supported for this type"); }
180 static T (
min)() { assert(
false &&
"Lowest not supported for this type"); }
181 static T infinity() { assert(
false &&
"Infinity not supported for this type"); }
182 static T quiet_NaN() { assert(
false &&
"quiet_NaN not supported for this type"); }
184 template<>
struct numeric_limits<float>
187 static float epsilon() {
return __FLT_EPSILON__; }
189 static float (
max)() {
return CUDART_MAX_NORMAL_F; }
191 static float (
min)() {
return FLT_MIN; }
193 static float infinity() {
return CUDART_INF_F; }
195 static float quiet_NaN() {
return CUDART_NAN_F; }
197 template<>
struct numeric_limits<double>
200 static double epsilon() {
return __DBL_EPSILON__; }
202 static double (
max)() {
return DBL_MAX; }
204 static double (
min)() {
return DBL_MIN; }
206 static double infinity() {
return CUDART_INF; }
208 static double quiet_NaN() {
return CUDART_NAN; }
210 template<>
struct numeric_limits<int>
213 static int epsilon() {
return 0; }
215 static int (
max)() {
return INT_MAX; }
217 static int (
min)() {
return INT_MIN; }
219 template<>
struct numeric_limits<unsigned int>
222 static unsigned int epsilon() {
return 0; }
224 static unsigned int (
max)() {
return UINT_MAX; }
226 static unsigned int (
min)() {
return 0; }
228 template<>
struct numeric_limits<long>
231 static long epsilon() {
return 0; }
233 static long (
max)() {
return LONG_MAX; }
235 static long (
min)() {
return LONG_MIN; }
237 template<>
struct numeric_limits<unsigned long>
240 static unsigned long epsilon() {
return 0; }
242 static unsigned long (
max)() {
return ULONG_MAX; }
244 static unsigned long (
min)() {
return 0; }
246 template<>
struct numeric_limits<long long>
249 static long long epsilon() {
return 0; }
251 static long long (
max)() {
return LLONG_MAX; }
253 static long long (
min)() {
return LLONG_MIN; }
255 template<>
struct numeric_limits<unsigned long long>
258 static unsigned long long epsilon() {
return 0; }
260 static unsigned long long (
max)() {
return ULLONG_MAX; }
262 static unsigned long long (
min)() {
return 0; }
275 EIGEN_DEVICE_FUNC
const noncopyable& operator=(
const noncopyable&);
288 #if EIGEN_HAS_STD_RESULT_OF 290 typedef typename std::result_of<T>::type type1;
300 template<
typename Func,
typename ArgType,
int SizeOf=sizeof(has_none)>
303 template<
typename Func,
typename ArgType>
306 template<
typename Func,
typename ArgType>
309 template<
typename Func,
typename ArgType>
314 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType)>::
type const * = 0);
318 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
322 template<
typename Func,
typename ArgType0,
typename ArgType1,
int SizeOf=sizeof(has_none)>
325 template<
typename Func,
typename ArgType0,
typename ArgType1>
327 {
typedef typename Func::result_type
type;};
329 template<
typename Func,
typename ArgType0,
typename ArgType1>
331 {
typedef typename Func::template result<Func(ArgType0,ArgType1)>::type
type;};
333 template<
typename Func,
typename ArgType0,
typename ArgType1>
338 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType0,ArgType1)>::
type const * = 0);
342 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
346 template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2,
int SizeOf=sizeof(has_none)>
349 template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
351 {
typedef typename Func::result_type
type;};
353 template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
355 {
typedef typename Func::template result<Func(ArgType0,ArgType1,ArgType2)>::type
type;};
357 template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
362 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType0,ArgType1,ArgType2)>::
type const * = 0);
366 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
375 template <
typename T>
378 template <
typename C>
static meta_yes testFunctor(
typename C::ReturnType
const *);
379 template <
typename C>
static meta_no testFunctor(...);
386 template <
typename T,
typename IndexType=Index>
389 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(return_ptr<C>()->
operator()())>0)>::type * = 0);
390 static meta_no testFunctor(...);
392 enum {
value =
sizeof(testFunctor(static_cast<T*>(0))) ==
sizeof(
meta_yes) };
395 template <
typename T,
typename IndexType=Index>
398 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(return_ptr<C>()->
operator()(IndexType(0)))>0)>::type * = 0);
399 static meta_no testFunctor(...);
401 enum {
value =
sizeof(testFunctor(static_cast<T*>(0))) ==
sizeof(
meta_yes) };
404 template <
typename T,
typename IndexType=Index>
407 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(return_ptr<C>()->
operator()(IndexType(0),IndexType(0)))>0)>::type * = 0);
408 static meta_no testFunctor(...);
410 enum {
value =
sizeof(testFunctor(static_cast<T*>(0))) ==
sizeof(
meta_yes) };
418 int SupX = ((Y==1) ? 1 : Y/2),
419 bool Done = ((SupX-InfX)<=1 ?
true : ((SupX*SupX <= Y) && ((SupX+1)*(SupX+1) > Y))) >
424 MidX = (InfX+SupX)/2,
425 TakeInf = MidX*MidX > Y ? 1 : 0,
426 NewInf =
int(TakeInf) ? InfX : int(MidX),
427 NewSup = int(TakeInf) ? int(MidX) : SupX
433 template<
int Y,
int InfX,
int SupX>
434 class meta_sqrt<Y, InfX, SupX, true> {
public:
enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
441 template<
int A,
int B,
int K=1,
bool Done = ((A*K)%B)==0>
446 template<
int A,
int B,
int K>
455 enum { Defined = 0 };
468 #if defined(__CUDA_ARCH__) 469 template<
typename T> EIGEN_DEVICE_FUNC
void swap(T &a, T &
b) { T tmp =
b; b = a; a = tmp; }
474 #if defined(__CUDA_ARCH__) 475 using internal::device::numeric_limits;
477 using std::numeric_limits;
492 #endif // EIGEN_META_H
#define EIGEN_STRONG_INLINE
remove_all< T >::type type
EIGEN_DEVICE_FUNC ~noncopyable()
Func::template result< Func(ArgType)>::type type
Func::template result< Func(ArgType0, ArgType1)>::type type
remove_all< T >::type type
#define EIGEN_DEFAULT_DENSE_INDEX_TYPE
remove_all< T >::type type
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC half() max(const half &a, const half &b)
remove_all< T >::type type
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
T div_ceil(const T &a, const T &b)
ternary_result_of_select< Func, ArgType0, ArgType1, ArgType2, FunctorType >::type type
Func::template result< Func(ArgType0, ArgType1, ArgType2)>::type type
EIGEN_DEVICE_FUNC noncopyable()
unary_result_of_select< Func, ArgType, FunctorType >::type type
EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex
internal::remove_all< ArgType0 >::type type
internal::remove_all< ArgType >::type type
remove_all< T >::type type
binary_result_of_select< Func, ArgType0, ArgType1, FunctorType >::type type
EIGEN_DEVICE_FUNC const Scalar & b
internal::remove_all< ArgType0 >::type type
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
void swap(scoped_array< T > &a, scoped_array< T > &b)