11 #ifndef EIGEN_MACROS_H
12 #define EIGEN_MACROS_H
14 #define EIGEN_WORLD_VERSION 3
15 #define EIGEN_MAJOR_VERSION 2
16 #define EIGEN_MINOR_VERSION 7
18 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
19 (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
20 EIGEN_MINOR_VERSION>=z))))
22 #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
24 #define EIGEN_GNUC_AT_LEAST(x,y) 0
28 #define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
30 #define EIGEN_GNUC_AT_MOST(x,y) 0
33 #if EIGEN_GNUC_AT_MOST(4,3) && !defined(__clang__)
35 #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
37 #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
40 #if defined(__GNUC__) && (__GNUC__ <= 3)
41 #define EIGEN_GCC3_OR_OLDER 1
43 #define EIGEN_GCC3_OR_OLDER 0
53 #if defined(__GNUC__) && !(defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined(__ia64__))
54 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
56 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
60 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \
61 && !EIGEN_GCC3_OR_OLDER \
62 && !defined(__SUNPRO_CC) \
63 && !defined(__QNXNTO__)
64 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1
66 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0
69 #ifdef EIGEN_DONT_ALIGN
70 #ifndef EIGEN_DONT_ALIGN_STATICALLY
71 #define EIGEN_DONT_ALIGN_STATICALLY
80 #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT && !defined(EIGEN_DONT_ALIGN_STATICALLY)
81 #define EIGEN_ALIGN_STATICALLY 1
83 #define EIGEN_ALIGN_STATICALLY 0
84 #ifndef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
85 #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
89 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
90 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION RowMajor
92 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ColMajor
95 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
96 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
101 #ifndef __has_feature
102 # define __has_feature(x) 0
106 #if (__has_feature(cxx_rvalue_references) || \
107 defined(__GXX_EXPERIMENTAL_CXX0X__) || \
108 (defined(_MSC_VER) && _MSC_VER >= 1600))
109 #define EIGEN_HAVE_RVALUE_REFERENCES
115 # define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
117 # define EIGEN_HAS_BUILTIN(x) 0
125 #ifndef EIGEN_FAST_MATH
126 #define EIGEN_FAST_MATH 1
129 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
132 #define EIGEN_CAT2(a,b) a ## b
133 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
136 #define EIGEN_MAKESTRING2(a) #a
137 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
142 #if (defined _MSC_VER) || (defined __INTEL_COMPILER)
143 #define EIGEN_STRONG_INLINE __forceinline
145 #define EIGEN_STRONG_INLINE inline
155 #if EIGEN_GNUC_AT_LEAST(4,0)
156 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
158 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
161 #if (defined __GNUC__)
162 #define EIGEN_DONT_INLINE __attribute__((noinline))
163 #elif (defined _MSC_VER)
164 #define EIGEN_DONT_INLINE __declspec(noinline)
166 #define EIGEN_DONT_INLINE
169 #if (defined __GNUC__)
170 #define EIGEN_PERMISSIVE_EXPR __extension__
172 #define EIGEN_PERMISSIVE_EXPR
179 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
180 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
183 # ifndef EIGEN_NO_DEBUG
184 # define EIGEN_NO_DEBUG
189 #ifdef EIGEN_NO_DEBUG
190 #define eigen_plain_assert(x)
192 #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
195 inline bool copy_bool(
bool b) {
return b; }
198 #define eigen_plain_assert(x) assert(x)
209 EIGEN_DONT_INLINE
bool copy_bool(
bool b) {
return b; }
211 inline void assert_fail(
const char *condition,
const char *
function,
const char *file,
int line)
213 std::cerr <<
"assertion failed: " << condition <<
" in function " <<
function <<
" at " << file <<
":" << line << std::endl;
218 #define eigen_plain_assert(x) \
220 if(!Eigen::internal::copy_bool(x)) \
221 Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
228 #define eigen_assert(x) eigen_plain_assert(x)
231 #ifdef EIGEN_INTERNAL_DEBUGGING
232 #define eigen_internal_assert(x) eigen_assert(x)
234 #define eigen_internal_assert(x)
237 #ifdef EIGEN_NO_DEBUG
238 #define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
240 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
243 #ifndef EIGEN_NO_DEPRECATED_WARNING
244 #if (defined __GNUC__)
245 #define EIGEN_DEPRECATED __attribute__((deprecated))
246 #elif (defined _MSC_VER)
247 #define EIGEN_DEPRECATED __declspec(deprecated)
249 #define EIGEN_DEPRECATED
252 #define EIGEN_DEPRECATED
255 #if (defined __GNUC__)
256 #define EIGEN_UNUSED __attribute__((unused))
264 template<
typename T>
void ignore_unused_variable(
const T&) {}
267 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
269 #if !defined(EIGEN_ASM_COMMENT)
270 #if (defined __GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
271 #define EIGEN_ASM_COMMENT(X) __asm__("#" X)
273 #define EIGEN_ASM_COMMENT(X)
284 #if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__) || (defined __ARMCC_VERSION)
285 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
286 #elif (defined _MSC_VER)
287 #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
288 #elif (defined __SUNPRO_CC)
290 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
292 #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
295 #define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8)
296 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
298 #if EIGEN_ALIGN_STATICALLY
299 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n) EIGEN_ALIGN_TO_BOUNDARY(n)
300 #define EIGEN_USER_ALIGN16 EIGEN_ALIGN16
302 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n)
303 #define EIGEN_USER_ALIGN16
306 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
307 #define EIGEN_RESTRICT
309 #ifndef EIGEN_RESTRICT
310 #define EIGEN_RESTRICT __restrict
313 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
315 #define EIGEN_STACK_ALLOCATION_LIMIT 131072
318 #ifndef EIGEN_DEFAULT_IO_FORMAT
319 #ifdef EIGEN_MAKING_DOCS
322 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
324 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
331 #if defined(_MSC_VER) && (_MSC_VER < 1900) && (!defined(__INTEL_COMPILER))
332 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
333 using Base::operator =;
334 #elif defined(__clang__) // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
335 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
336 using Base::operator =; \
337 EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
338 template <typename OtherDerived> \
339 EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; }
341 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
342 using Base::operator =; \
343 EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
345 Base::operator=(other); \
354 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
364 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
365 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
366 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
367 typedef typename Base::CoeffReturnType CoeffReturnType; \
368 typedef typename Eigen::internal::nested<Derived>::type Nested; \
369 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
370 typedef typename Eigen::internal::traits<Derived>::Index Index; \
371 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
372 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
373 Flags = Eigen::internal::traits<Derived>::Flags, \
374 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
375 SizeAtCompileTime = Base::SizeAtCompileTime, \
376 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
377 IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
380 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
381 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
382 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
383 typedef typename Base::PacketScalar PacketScalar; \
384 typedef typename Base::CoeffReturnType CoeffReturnType; \
385 typedef typename Eigen::internal::nested<Derived>::type Nested; \
386 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
387 typedef typename Eigen::internal::traits<Derived>::Index Index; \
388 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
389 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
390 MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
391 MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime, \
392 Flags = Eigen::internal::traits<Derived>::Flags, \
393 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
394 SizeAtCompileTime = Base::SizeAtCompileTime, \
395 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
396 IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
397 using Base::derived; \
398 using Base::const_cast_derived;
401 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
402 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
407 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
408 : ((int)a == 1 || (int)b == 1) ? 1 \
409 : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
410 : ((int)a <= (int)b) ? (int)a : (int)b)
415 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
416 : ((int)a == 1 || (int)b == 1) ? 1 \
417 : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
418 : ((int)a == Dynamic) ? (int)b \
419 : ((int)b == Dynamic) ? (int)a \
420 : ((int)a <= (int)b) ? (int)a : (int)b)
423 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
424 : ((int)a >= (int)b) ? (int)a : (int)b)
426 #define EIGEN_ADD_COST(a,b) int(a)==Dynamic || int(b)==Dynamic ? Dynamic : int(a)+int(b)
428 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
430 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
432 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
433 template<typename OtherDerived> \
434 EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
435 (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
437 return CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); \
441 #define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
443 internal::scalar_product_op< \
444 typename internal::traits<LHS>::Scalar, \
445 typename internal::traits<RHS>::Scalar \
451 #endif // EIGEN_MACROS_H
Definition: Eigen_Colamd.h:54