25 struct true_type {
enum { value = 1 }; };
26 struct false_type {
enum { value = 0 }; };
28 template<
bool Condition,
typename Then,
typename Else>
29 struct conditional {
typedef Then type; };
31 template<
typename Then,
typename Else>
32 struct conditional <false, Then, Else> {
typedef Else type; };
34 template<
typename T,
typename U>
struct is_same {
enum { value = 0 }; };
35 template<
typename T>
struct is_same<T,T> {
enum { value = 1 }; };
37 template<
typename T>
struct remove_reference {
typedef T type; };
38 template<
typename T>
struct remove_reference<T&> {
typedef T type; };
40 template<
typename T>
struct remove_pointer {
typedef T type; };
41 template<
typename T>
struct remove_pointer<T*> {
typedef T type; };
42 template<
typename T>
struct remove_pointer<T*
const> {
typedef T type; };
44 template <
class T>
struct remove_const {
typedef T type; };
45 template <
class T>
struct remove_const<const T> {
typedef T type; };
46 template <
class T>
struct remove_const<const T[]> {
typedef T type[]; };
47 template <
class T,
unsigned int Size>
struct remove_const<const T[Size]> {
typedef T type[Size]; };
49 template<
typename T>
struct remove_all {
typedef T type; };
50 template<
typename T>
struct remove_all<const T> {
typedef typename remove_all<T>::type type; };
51 template<
typename T>
struct remove_all<T const&> {
typedef typename remove_all<T>::type type; };
52 template<
typename T>
struct remove_all<T&> {
typedef typename remove_all<T>::type type; };
53 template<
typename T>
struct remove_all<T const*> {
typedef typename remove_all<T>::type type; };
54 template<
typename T>
struct remove_all<T*> {
typedef typename remove_all<T>::type type; };
56 template<
typename T>
struct is_arithmetic {
enum { value =
false }; };
57 template<>
struct is_arithmetic<float> {
enum { value =
true }; };
58 template<>
struct is_arithmetic<double> {
enum { value =
true }; };
59 template<>
struct is_arithmetic<long double> {
enum { value =
true }; };
60 template<>
struct is_arithmetic<bool> {
enum { value =
true }; };
61 template<>
struct is_arithmetic<char> {
enum { value =
true }; };
62 template<>
struct is_arithmetic<signed char> {
enum { value =
true }; };
63 template<>
struct is_arithmetic<unsigned char> {
enum { value =
true }; };
64 template<>
struct is_arithmetic<signed short> {
enum { value =
true }; };
65 template<>
struct is_arithmetic<unsigned short>{
enum { value =
true }; };
66 template<>
struct is_arithmetic<signed int> {
enum { value =
true }; };
67 template<>
struct is_arithmetic<unsigned int> {
enum { value =
true }; };
68 template<>
struct is_arithmetic<signed long> {
enum { value =
true }; };
69 template<>
struct is_arithmetic<unsigned long> {
enum { value =
true }; };
71 template <
typename T>
struct add_const {
typedef const T type; };
72 template <
typename T>
struct add_const<T&> {
typedef T& type; };
74 template <
typename T>
struct is_const {
enum { value = 0 }; };
75 template <
typename T>
struct is_const<T const> {
enum { value = 1 }; };
77 template<
typename T>
struct add_const_on_value_type {
typedef const T type; };
78 template<
typename T>
struct add_const_on_value_type<T&> {
typedef T
const& type; };
79 template<
typename T>
struct add_const_on_value_type<T*> {
typedef T
const* type; };
80 template<
typename T>
struct add_const_on_value_type<T*
const> {
typedef T
const*
const type; };
81 template<
typename T>
struct add_const_on_value_type<T const*
const> {
typedef T
const*
const type; };
84 template<
typename From,
typename To>
85 struct is_convertible_impl
90 template <
typename T> any_conversion(
const volatile T&);
91 template <
typename T> any_conversion(T&);
93 struct yes {
int a[1];};
94 struct no {
int a[2];};
96 static yes test(
const To&,
int);
97 static no test(any_conversion, ...);
101 enum { value =
sizeof(test(ms_from, 0))==
sizeof(yes) };
104 template<
typename From,
typename To>
105 struct is_convertible
107 enum { value = is_convertible_impl<typename remove_all<From>::type,
108 typename remove_all<To >::type>::value };
114 template<
bool Condition,
typename T>
struct enable_if;
116 template<
typename T>
struct enable_if<true,T>
119 #if defined(__CUDA_ARCH__)
120 #if !defined(__FLT_EPSILON__)
121 #define __FLT_EPSILON__ FLT_EPSILON
122 #define __DBL_EPSILON__ DBL_EPSILON
127 template<
typename T>
struct numeric_limits
130 static T epsilon() {
return 0; }
131 static T (max)() { assert(
false &&
"Highest not supported for this type"); }
132 static T (min)() { assert(
false &&
"Lowest not supported for this type"); }
134 template<>
struct numeric_limits<float>
137 static float epsilon() {
return __FLT_EPSILON__; }
139 static float (max)() {
return CUDART_MAX_NORMAL_F; }
141 static float (min)() {
return __FLT_EPSILON__; }
143 template<>
struct numeric_limits<double>
146 static double epsilon() {
return __DBL_EPSILON__; }
148 static double (max)() {
return CUDART_INF; }
150 static double (min)() {
return __DBL_EPSILON__; }
152 template<>
struct numeric_limits<int>
155 static int epsilon() {
return 0; }
157 static int (max)() {
return INT_MAX; }
159 static int (min)() {
return INT_MIN; }
161 template<>
struct numeric_limits<long>
164 static long epsilon() {
return 0; }
166 static long (max)() {
return LONG_MAX; }
168 static long (min)() {
return LONG_MIN; }
170 template<>
struct numeric_limits<long long>
173 static long long epsilon() {
return 0; }
175 static long long (max)() {
return LLONG_MAX; }
177 static long long (min)() {
return LLONG_MIN; }
189 EIGEN_DEVICE_FUNC noncopyable(
const noncopyable&);
190 EIGEN_DEVICE_FUNC
const noncopyable& operator=(
const noncopyable&);
192 EIGEN_DEVICE_FUNC noncopyable() {}
193 EIGEN_DEVICE_FUNC ~noncopyable() {}
204 #ifdef EIGEN_HAS_STD_RESULT_OF
205 template<
typename T>
struct result_of {
206 typedef typename std::result_of<T>::type type1;
207 typedef typename remove_all<type1>::type type;
210 template<
typename T>
struct result_of { };
212 struct has_none {
int a[1];};
213 struct has_std_result_type {
int a[2];};
214 struct has_tr1_result {
int a[3];};
216 template<
typename Func,
typename ArgType,
int SizeOf=sizeof(has_none)>
217 struct unary_result_of_select {
typedef ArgType type;};
219 template<
typename Func,
typename ArgType>
220 struct unary_result_of_select<Func, ArgType, sizeof(has_std_result_type)> {
typedef typename Func::result_type type;};
222 template<
typename Func,
typename ArgType>
223 struct unary_result_of_select<Func, ArgType, sizeof(has_tr1_result)> {
typedef typename Func::template result<Func(ArgType)>::type type;};
225 template<
typename Func,
typename ArgType>
226 struct result_of<Func(ArgType)> {
228 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
230 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType)>::type
const * = 0);
231 static has_none testFunctor(...);
234 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
235 typedef typename unary_result_of_select<Func, ArgType, FunctorType>::type type;
238 template<
typename Func,
typename ArgType0,
typename ArgType1,
int SizeOf=sizeof(has_none)>
239 struct binary_result_of_select {
typedef ArgType0 type;};
241 template<
typename Func,
typename ArgType0,
typename ArgType1>
242 struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_std_result_type)>
243 {
typedef typename Func::result_type type;};
245 template<
typename Func,
typename ArgType0,
typename ArgType1>
246 struct binary_result_of_select<Func, ArgType0, ArgType1, sizeof(has_tr1_result)>
247 {
typedef typename Func::template result<Func(ArgType0,ArgType1)>::type type;};
249 template<
typename Func,
typename ArgType0,
typename ArgType1>
250 struct result_of<Func(ArgType0,ArgType1)> {
252 static has_std_result_type testFunctor(T
const *,
typename T::result_type
const * = 0);
254 static has_tr1_result testFunctor(T
const *,
typename T::template result<T(ArgType0,ArgType1)>::type
const * = 0);
255 static has_none testFunctor(...);
258 enum {FunctorType =
sizeof(testFunctor(static_cast<Func*>(0)))};
259 typedef typename binary_result_of_select<Func, ArgType0, ArgType1, FunctorType>::type type;
268 int SupX = ((Y==1) ? 1 : Y/2),
269 bool Done = ((SupX-InfX)<=1 ?
true : ((SupX*SupX <= Y) && ((SupX+1)*(SupX+1) > Y))) >
274 MidX = (InfX+SupX)/2,
275 TakeInf = MidX*MidX > Y ? 1 : 0,
276 NewInf =
int(TakeInf) ? InfX : int(MidX),
277 NewSup = int(TakeInf) ? int(MidX) : SupX
280 enum { ret = meta_sqrt<Y,NewInf,NewSup>::ret };
283 template<
int Y,
int InfX,
int SupX>
284 class meta_sqrt<Y, InfX, SupX, true> {
public:
enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; };
287 template<
typename T,
typename U>
struct scalar_product_traits
289 enum { Defined = 0 };
292 template<
typename T>
struct scalar_product_traits<T,T>
298 typedef T ReturnType;
301 template<
typename T>
struct scalar_product_traits<T,
std::complex<T> >
307 typedef std::complex<T> ReturnType;
310 template<
typename T>
struct scalar_product_traits<
std::complex<T>, T>
316 typedef std::complex<T> ReturnType;
329 #if defined(__CUDA_ARCH__)
330 template<
typename T> EIGEN_DEVICE_FUNC
void swap(T &a, T &b) { T tmp = b; b = a; a = tmp; }
332 template<
typename T> EIGEN_STRONG_INLINE
void swap(T &a, T &b) { std::swap(a,b); }
338 T div_ceil(
const T &a,
const T &b)
347 #endif // EIGEN_META_H
Definition: StdDeque.h:58
Definition: Eigen_Colamd.h:54