14#if defined(__CUDA_ARCH__)
16#include <math_constants.h>
19#if EIGEN_COMP_ICC>=1600 && __cplusplus >= 201103L
25typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex;
33typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE
Index;
46#if EIGEN_COMP_ICC>=1600 && __cplusplus >= 201103L
47typedef std::intptr_t IntPtr;
48typedef std::uintptr_t UIntPtr;
50typedef std::ptrdiff_t IntPtr;
51typedef std::size_t UIntPtr;
54struct true_type {
enum { value = 1 }; };
55struct false_type {
enum { value = 0 }; };
57template<
bool Condition,
typename Then,
typename Else>
58struct conditional {
typedef Then type; };
60template<
typename Then,
typename Else>
61struct conditional <false, Then, Else> {
typedef Else type; };
63template<
typename T,
typename U>
struct is_same {
enum { value = 0 }; };
64template<
typename T>
struct is_same<T,T> {
enum { value = 1 }; };
66template<
typename T>
struct remove_reference {
typedef T type; };
67template<
typename T>
struct remove_reference<T&> {
typedef T type; };
69template<
typename T>
struct remove_pointer {
typedef T type; };
70template<
typename T>
struct remove_pointer<T*> {
typedef T type; };
71template<
typename T>
struct remove_pointer<T*
const> {
typedef T type; };
73template <
class T>
struct remove_const {
typedef T type; };
74template <
class T>
struct remove_const<const T> {
typedef T type; };
75template <
class T>
struct remove_const<const T[]> {
typedef T type[]; };
76template <
class T,
unsigned int Size>
struct remove_const<const T[Size]> {
typedef T type[Size]; };
78template<
typename T>
struct remove_all {
typedef T type; };
79template<
typename T>
struct remove_all<const T> {
typedef typename remove_all<T>::type type; };
80template<
typename T>
struct remove_all<T const&> {
typedef typename remove_all<T>::type type; };
81template<
typename T>
struct remove_all<T&> {
typedef typename remove_all<T>::type type; };
82template<
typename T>
struct remove_all<T const*> {
typedef typename remove_all<T>::type type; };
83template<
typename T>
struct remove_all<T*> {
typedef typename remove_all<T>::type type; };
85template<
typename T>
struct is_arithmetic {
enum { value =
false }; };
86template<>
struct is_arithmetic<float> {
enum { value =
true }; };
87template<>
struct is_arithmetic<double> {
enum { value =
true }; };
88template<>
struct is_arithmetic<long double> {
enum { value =
true }; };
89template<>
struct is_arithmetic<bool> {
enum { value =
true }; };
90template<>
struct is_arithmetic<char> {
enum { value =
true }; };
91template<>
struct is_arithmetic<signed char> {
enum { value =
true }; };
92template<>
struct is_arithmetic<unsigned char> {
enum { value =
true }; };
93template<>
struct is_arithmetic<signed short> {
enum { value =
true }; };
94template<>
struct is_arithmetic<unsigned short>{
enum { value =
true }; };
95template<>
struct is_arithmetic<signed int> {
enum { value =
true }; };
96template<>
struct is_arithmetic<unsigned int> {
enum { value =
true }; };
97template<>
struct is_arithmetic<signed long> {
enum { value =
true }; };
98template<>
struct is_arithmetic<unsigned long> {
enum { value =
true }; };
100template<
typename T>
struct is_integral {
enum { value =
false }; };
101template<>
struct is_integral<bool> {
enum { value =
true }; };
102template<>
struct is_integral<char> {
enum { value =
true }; };
103template<>
struct is_integral<signed char> {
enum { value =
true }; };
104template<>
struct is_integral<unsigned char> {
enum { value =
true }; };
105template<>
struct is_integral<signed short> {
enum { value =
true }; };
106template<>
struct is_integral<unsigned short> {
enum { value =
true }; };
107template<>
struct is_integral<signed int> {
enum { value =
true }; };
108template<>
struct is_integral<unsigned int> {
enum { value =
true }; };
109template<>
struct is_integral<signed long> {
enum { value =
true }; };
110template<>
struct is_integral<unsigned long> {
enum { value =
true }; };
112template <
typename T>
struct add_const {
typedef const T type; };
113template <
typename T>
struct add_const<T&> {
typedef T& type; };
115template <
typename T>
struct is_const {
enum { value = 0 }; };
116template <
typename T>
struct is_const<T const> {
enum { value = 1 }; };
118template<
typename T>
struct add_const_on_value_type {
typedef const T type; };
119template<
typename T>
struct add_const_on_value_type<T&> {
typedef T
const& type; };
120template<
typename T>
struct add_const_on_value_type<T*> {
typedef T
const* type; };
121template<
typename T>
struct add_const_on_value_type<T*
const> {
typedef T
const*
const type; };
122template<
typename T>
struct add_const_on_value_type<T const*
const> {
typedef T
const*
const type; };
125template<
typename From,
typename To>
126struct is_convertible_impl
129 struct any_conversion
131 template <
typename T> any_conversion(
const volatile T&);
132 template <
typename T> any_conversion(T&);
134 struct yes {
int a[1];};
135 struct no {
int a[2];};
137 static yes test(
const To&,
int);
138 static no test(any_conversion, ...);
142#ifdef __INTEL_COMPILER
144 #pragma warning ( disable : 2259 )
146 enum { value =
sizeof(test(ms_from, 0))==
sizeof(yes) };
147#ifdef __INTEL_COMPILER
152template<
typename From,
typename To>
155 enum { value = is_convertible_impl<typename remove_all<From>::type,
156 typename remove_all<To >::type>::value };
162template<
bool Condition,
typename T=
void>
struct enable_if;
164template<
typename T>
struct enable_if<true,T>
167#if defined(__CUDA_ARCH__)
168#if !defined(__FLT_EPSILON__)
169#define __FLT_EPSILON__ FLT_EPSILON
170#define __DBL_EPSILON__ DBL_EPSILON
175template<
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"); }
184template<>
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; }
197template<>
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; }
210template<>
struct numeric_limits<int>
213 static int epsilon() {
return 0; }
215 static int (max)() {
return INT_MAX; }
217 static int (min)() {
return INT_MIN; }
219template<>
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; }
228template<>
struct numeric_limits<long>
231 static long epsilon() {
return 0; }
233 static long (max)() {
return LONG_MAX; }
235 static long (min)() {
return LONG_MIN; }
237template<>
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; }
246template<>
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; }
255template<>
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; }
274 EIGEN_DEVICE_FUNC noncopyable(
const noncopyable&);
275 EIGEN_DEVICE_FUNC
const noncopyable& operator=(
const noncopyable&);
277 EIGEN_DEVICE_FUNC noncopyable() {}
278 EIGEN_DEVICE_FUNC ~noncopyable() {}
288#if EIGEN_HAS_STD_RESULT_OF
289template<
typename T>
struct result_of {
290 typedef typename std::result_of<T>::type type1;
291 typedef typename remove_all<type1>::type type;
294template<
typename T>
struct result_of { };
296struct has_none {
int a[1];};
297struct has_std_result_type {
int a[2];};
298struct has_tr1_result {
int a[3];};
300template<
typename Func,
typename ArgType,
int SizeOf=sizeof(has_none)>
301struct unary_result_of_select {
typedef typename internal::remove_all<ArgType>::type type;};
303template<
typename Func,
typename ArgType>
304struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {
typedef typename Func::result_type type;};
306template<
typename Func,
typename ArgType>
307struct unary_result_of_select<Func, ArgType, sizeof(has_tr1_result)> {
typedef typename Func::template result<Func(ArgType)>::type type;};
309template<
typename Func,
typename ArgType>
310struct result_of<Func(ArgType)> {
312 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
314 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType)>::type
const * = 0);
315 static has_none testFunctor(...);
318 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
319 typedef typename unary_result_of_select<Func, ArgType, FunctorType>::type type;
322template<
typename Func,
typename ArgType0,
typename ArgType1,
int SizeOf=sizeof(has_none)>
323struct binary_result_of_select {
typedef typename internal::remove_all<ArgType0>::type type;};
325template<
typename Func,
typename ArgType0,
typename ArgType1>
326struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_std_result_type)>
327{
typedef typename Func::result_type type;};
329template<
typename Func,
typename ArgType0,
typename ArgType1>
330struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_tr1_result)>
331{
typedef typename Func::template result<Func(ArgType0,ArgType1)>::type type;};
333template<
typename Func,
typename ArgType0,
typename ArgType1>
334struct result_of<Func(ArgType0,ArgType1)> {
336 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
338 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType0,ArgType1)>::type
const * = 0);
339 static has_none testFunctor(...);
342 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
343 typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
346template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2,
int SizeOf=sizeof(has_none)>
347struct ternary_result_of_select {
typedef typename internal::remove_all<ArgType0>::type type;};
349template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
350struct ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, sizeof(has_std_result_type)>
351{
typedef typename Func::result_type type;};
353template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
354struct ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, sizeof(has_tr1_result)>
355{
typedef typename Func::template result<Func(ArgType0,ArgType1,ArgType2)>::type type;};
357template<
typename Func,
typename ArgType0,
typename ArgType1,
typename ArgType2>
358struct result_of<Func(ArgType0,ArgType1,ArgType2)> {
360 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
362 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType0,ArgType1,ArgType2)>::type
const * = 0);
363 static has_none testFunctor(...);
366 enum {FunctorType =
sizeof(testFunctor(
static_cast<Func*
>(0)))};
367 typedef typename ternary_result_of_select<Func, ArgType0, ArgType1, ArgType2, FunctorType>::type type;
371struct meta_yes {
char a[1]; };
372struct meta_no {
char a[2]; };
378 template <
typename C>
static meta_yes testFunctor(
typename C::ReturnType
const *);
379 template <
typename C>
static meta_no testFunctor(...);
381 enum { value =
sizeof(testFunctor<T>(0)) ==
sizeof(meta_yes) };
384template<
typename T>
const T& return_ref();
386template <
typename T,
typename IndexType=Index>
387struct has_nullary_operator
389 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(return_ref<C>().
operator()())>0)>::type * = 0);
390 static meta_no testFunctor(...);
392 enum { value =
sizeof(testFunctor(
static_cast<T*
>(0))) ==
sizeof(meta_yes) };
395template <
typename T,
typename IndexType=Index>
396struct has_unary_operator
398 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(return_ref<C>().
operator()(IndexType(0)))>0)>::type * = 0);
399 static meta_no testFunctor(...);
401 enum { value =
sizeof(testFunctor(
static_cast<T*
>(0))) ==
sizeof(meta_yes) };
404template <
typename T,
typename IndexType=Index>
405struct has_binary_operator
407 template <
typename C>
static meta_yes testFunctor(C
const *,
typename enable_if<(
sizeof(return_ref<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
430 enum { ret = meta_sqrt<Y,NewInf,NewSup>::ret };
433template<
int Y,
int InfX,
int SupX>
434class meta_sqrt<Y, InfX, SupX, true> {
public:
enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
441template<
int A,
int B,
int K=1,
bool Done = ((A*K)%B)==0>
442struct meta_least_common_multiple
444 enum { ret = meta_least_common_multiple<A,B,K+1>::ret };
446template<
int A,
int B,
int K>
447struct meta_least_common_multiple<A,B,K,true>
453template<
typename T,
typename U>
struct scalar_product_traits
455 enum { Defined = 0 };
468#if defined(__CUDA_ARCH__)
469template<
typename T> EIGEN_DEVICE_FUNC
void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
471template<
typename T> EIGEN_STRONG_INLINE
void swap(T &a, T &b) { std::swap(a,b); }
474#if defined(__CUDA_ARCH__)
475using internal::device::numeric_limits;
477using std::numeric_limits;
483T div_ceil(
const T &a,
const T &b)
Namespace containing all symbols from the Eigen library.
Definition: Core:287
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33