14 #if defined(__CUDA_ARCH__)
16 #include <math_constants.h>
30 struct true_type {
enum { value = 1 }; };
31 struct false_type {
enum { value = 0 }; };
33 template<
bool Condition,
typename Then,
typename Else>
34 struct conditional {
typedef Then type; };
36 template<
typename Then,
typename Else>
37 struct conditional <false, Then, Else> {
typedef Else type; };
39 template<
typename T,
typename U>
struct is_same {
enum { value = 0 }; };
40 template<
typename T>
struct is_same<T,T> {
enum { value = 1 }; };
42 template<
typename T>
struct remove_reference {
typedef T type; };
43 template<
typename T>
struct remove_reference<T&> {
typedef T type; };
45 template<
typename T>
struct remove_pointer {
typedef T type; };
46 template<
typename T>
struct remove_pointer<T*> {
typedef T type; };
47 template<
typename T>
struct remove_pointer<T*
const> {
typedef T type; };
49 template <
class T>
struct remove_const {
typedef T type; };
50 template <
class T>
struct remove_const<const T> {
typedef T type; };
51 template <
class T>
struct remove_const<const T[]> {
typedef T type[]; };
52 template <
class T,
unsigned int Size>
struct remove_const<const T[Size]> {
typedef T type[Size]; };
54 template<
typename T>
struct remove_all {
typedef T type; };
55 template<
typename T>
struct remove_all<const T> {
typedef typename remove_all<T>::type type; };
56 template<
typename T>
struct remove_all<T const&> {
typedef typename remove_all<T>::type type; };
57 template<
typename T>
struct remove_all<T&> {
typedef typename remove_all<T>::type type; };
58 template<
typename T>
struct remove_all<T const*> {
typedef typename remove_all<T>::type type; };
59 template<
typename T>
struct remove_all<T*> {
typedef typename remove_all<T>::type type; };
61 template<
typename T>
struct is_arithmetic {
enum { value =
false }; };
62 template<>
struct is_arithmetic<float> {
enum { value =
true }; };
63 template<>
struct is_arithmetic<double> {
enum { value =
true }; };
64 template<>
struct is_arithmetic<long double> {
enum { value =
true }; };
65 template<>
struct is_arithmetic<bool> {
enum { value =
true }; };
66 template<>
struct is_arithmetic<char> {
enum { value =
true }; };
67 template<>
struct is_arithmetic<signed char> {
enum { value =
true }; };
68 template<>
struct is_arithmetic<unsigned char> {
enum { value =
true }; };
69 template<>
struct is_arithmetic<signed short> {
enum { value =
true }; };
70 template<>
struct is_arithmetic<unsigned short>{
enum { value =
true }; };
71 template<>
struct is_arithmetic<signed int> {
enum { value =
true }; };
72 template<>
struct is_arithmetic<unsigned int> {
enum { value =
true }; };
73 template<>
struct is_arithmetic<signed long> {
enum { value =
true }; };
74 template<>
struct is_arithmetic<unsigned long> {
enum { value =
true }; };
76 template<
typename T>
struct is_integral {
enum { value =
false }; };
77 template<>
struct is_integral<bool> {
enum { value =
true }; };
78 template<>
struct is_integral<char> {
enum { value =
true }; };
79 template<>
struct is_integral<signed char> {
enum { value =
true }; };
80 template<>
struct is_integral<unsigned char> {
enum { value =
true }; };
81 template<>
struct is_integral<signed short> {
enum { value =
true }; };
82 template<>
struct is_integral<unsigned short> {
enum { value =
true }; };
83 template<>
struct is_integral<signed int> {
enum { value =
true }; };
84 template<>
struct is_integral<unsigned int> {
enum { value =
true }; };
85 template<>
struct is_integral<signed long> {
enum { value =
true }; };
86 template<>
struct is_integral<unsigned long> {
enum { value =
true }; };
88 template <
typename T>
struct add_const {
typedef const T type; };
89 template <
typename T>
struct add_const<T&> {
typedef T& type; };
91 template <
typename T>
struct is_const {
enum { value = 0 }; };
92 template <
typename T>
struct is_const<T const> {
enum { value = 1 }; };
94 template<
typename T>
struct add_const_on_value_type {
typedef const T type; };
95 template<
typename T>
struct add_const_on_value_type<T&> {
typedef T
const& type; };
96 template<
typename T>
struct add_const_on_value_type<T*> {
typedef T
const* type; };
97 template<
typename T>
struct add_const_on_value_type<T*
const> {
typedef T
const*
const type; };
98 template<
typename T>
struct add_const_on_value_type<T const*
const> {
typedef T
const*
const type; };
101 template<
typename From,
typename To>
102 struct is_convertible_impl
105 struct any_conversion
107 template <
typename T> any_conversion(
const volatile T&);
108 template <
typename T> any_conversion(T&);
110 struct yes {
int a[1];};
111 struct no {
int a[2];};
113 static yes test(
const To&,
int);
114 static no test(any_conversion, ...);
118 enum { value =
sizeof(test(ms_from, 0))==
sizeof(yes) };
121 template<
typename From,
typename To>
122 struct is_convertible
124 enum { value = is_convertible_impl<typename remove_all<From>::type,
125 typename remove_all<To >::type>::value };
131 template<
bool Condition,
typename T>
struct enable_if;
133 template<
typename T>
struct enable_if<true,T>
136 #if defined(__CUDA_ARCH__)
137 #if !defined(__FLT_EPSILON__)
138 #define __FLT_EPSILON__ FLT_EPSILON
139 #define __DBL_EPSILON__ DBL_EPSILON
144 template<
typename T>
struct numeric_limits
147 static T epsilon() {
return 0; }
148 static T (max)() { assert(
false &&
"Highest not supported for this type"); }
149 static T (min)() { assert(
false &&
"Lowest not supported for this type"); }
151 template<>
struct numeric_limits<float>
154 static float epsilon() {
return __FLT_EPSILON__; }
156 static float (max)() {
return CUDART_MAX_NORMAL_F; }
158 static float (min)() {
return FLT_MIN; }
160 template<>
struct numeric_limits<double>
163 static double epsilon() {
return __DBL_EPSILON__; }
165 static double (max)() {
return DBL_MAX; }
167 static double (min)() {
return DBL_MIN; }
169 template<>
struct numeric_limits<int>
172 static int epsilon() {
return 0; }
174 static int (max)() {
return INT_MAX; }
176 static int (min)() {
return INT_MIN; }
178 template<>
struct numeric_limits<unsigned int>
181 static unsigned int epsilon() {
return 0; }
183 static unsigned int (max)() {
return UINT_MAX; }
185 static unsigned int (min)() {
return 0; }
187 template<>
struct numeric_limits<long>
190 static long epsilon() {
return 0; }
192 static long (max)() {
return LONG_MAX; }
194 static long (min)() {
return LONG_MIN; }
196 template<>
struct numeric_limits<unsigned long>
199 static unsigned long epsilon() {
return 0; }
201 static unsigned long (max)() {
return ULONG_MAX; }
203 static unsigned long (min)() {
return 0; }
205 template<>
struct numeric_limits<long long>
208 static long long epsilon() {
return 0; }
210 static long long (max)() {
return LLONG_MAX; }
212 static long long (min)() {
return LLONG_MIN; }
214 template<>
struct numeric_limits<unsigned long long>
217 static unsigned long long epsilon() {
return 0; }
219 static unsigned long long (max)() {
return ULLONG_MAX; }
221 static unsigned long long (min)() {
return 0; }
233 EIGEN_DEVICE_FUNC noncopyable(
const noncopyable&);
234 EIGEN_DEVICE_FUNC
const noncopyable& operator=(
const noncopyable&);
236 EIGEN_DEVICE_FUNC noncopyable() {}
237 EIGEN_DEVICE_FUNC ~noncopyable() {}
247 #ifdef EIGEN_HAS_STD_RESULT_OF
248 template<
typename T>
struct result_of {
249 typedef typename std::result_of<T>::type type1;
250 typedef typename remove_all<type1>::type type;
253 template<
typename T>
struct result_of { };
255 struct has_none {
int a[1];};
256 struct has_std_result_type {
int a[2];};
257 struct has_tr1_result {
int a[3];};
259 template<
typename Func,
typename ArgType,
int SizeOf=sizeof(has_none)>
260 struct unary_result_of_select {
typedef ArgType type;};
262 template<
typename Func,
typename ArgType>
263 struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {
typedef typename Func::result_type type;};
265 template<
typename Func,
typename ArgType>
266 struct unary_result_of_select<Func, ArgType, sizeof(has_tr1_result)> {
typedef typename Func::template result<Func(ArgType)>::type type;};
268 template<
typename Func,
typename ArgType>
269 struct result_of<Func(ArgType)> {
271 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
273 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType)>::type
const * = 0);
274 static has_none testFunctor(...);
277 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
278 typedef typename unary_result_of_select<Func, ArgType, FunctorType>::type type;
281 template<
typename Func,
typename ArgType0,
typename ArgType1,
int SizeOf=sizeof(has_none)>
282 struct binary_result_of_select {
typedef ArgType0 type;};
284 template<
typename Func,
typename ArgType0,
typename ArgType1>
285 struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_std_result_type)>
286 {
typedef typename Func::result_type type;};
288 template<
typename Func,
typename ArgType0,
typename ArgType1>
289 struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_tr1_result)>
290 {
typedef typename Func::template result<Func(ArgType0,ArgType1)>::type type;};
292 template<
typename Func,
typename ArgType0,
typename ArgType1>
293 struct result_of<Func(ArgType0,ArgType1)> {
295 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
297 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType0,ArgType1)>::type
const * = 0);
298 static has_none testFunctor(...);
301 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
302 typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
311 int SupX = ((Y==1) ? 1 : Y/2),
312 bool Done = ((SupX-InfX)<=1 ?
true : ((SupX*SupX <= Y) && ((SupX+1)*(SupX+1) > Y))) >
317 MidX = (InfX+SupX)/2,
318 TakeInf = MidX*MidX > Y ? 1 : 0,
319 NewInf =
int(TakeInf) ? InfX : int(MidX),
320 NewSup = int(TakeInf) ? int(MidX) : SupX
323 enum { ret = meta_sqrt<Y,NewInf,NewSup>::ret };
326 template<
int Y,
int InfX,
int SupX>
327 class meta_sqrt<Y, InfX, SupX, true> {
public:
enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
330 template<
typename T,
typename U>
struct scalar_product_traits
332 enum { Defined = 0 };
335 template<
typename T>
struct scalar_product_traits<T,T>
341 typedef T ReturnType;
344 template<
typename T>
struct scalar_product_traits<T,
std::complex<T> >
350 typedef std::complex<T> ReturnType;
353 template<
typename T>
struct scalar_product_traits<
std::complex<T>, T>
359 typedef std::complex<T> ReturnType;
372 #if defined(__CUDA_ARCH__)
373 template<
typename T> EIGEN_DEVICE_FUNC
void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
375 template<
typename T> EIGEN_STRONG_INLINE
void swap(T &a, T &b) { std::swap(a,b); }
381 T div_ceil(
const T &a,
const T &b)
390 #endif // EIGEN_META_H
Definition: StdDeque.h:58
Definition: Eigen_Colamd.h:54