00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef EIGEN_MACROS_H
00012 #define EIGEN_MACROS_H
00013
00014 #define EIGEN_WORLD_VERSION 3
00015 #define EIGEN_MAJOR_VERSION 2
00016 #define EIGEN_MINOR_VERSION 5
00017
00018 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
00019 (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
00020 EIGEN_MINOR_VERSION>=z))))
00021 #ifdef __GNUC__
00022 #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
00023 #else
00024 #define EIGEN_GNUC_AT_LEAST(x,y) 0
00025 #endif
00026
00027 #ifdef __GNUC__
00028 #define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
00029 #else
00030 #define EIGEN_GNUC_AT_MOST(x,y) 0
00031 #endif
00032
00033 #if EIGEN_GNUC_AT_MOST(4,3) && !defined(__clang__)
00034
00035 #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
00036 #else
00037 #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
00038 #endif
00039
00040 #if defined(__GNUC__) && (__GNUC__ <= 3)
00041 #define EIGEN_GCC3_OR_OLDER 1
00042 #else
00043 #define EIGEN_GCC3_OR_OLDER 0
00044 #endif
00045
00046
00047
00048
00049
00050
00051
00052
00053 #if defined(__GNUC__) && !(defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined(__ia64__))
00054 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
00055 #else
00056 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
00057 #endif
00058
00059
00060 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \
00061 && !EIGEN_GCC3_OR_OLDER \
00062 && !defined(__SUNPRO_CC) \
00063 && !defined(__QNXNTO__)
00064 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1
00065 #else
00066 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0
00067 #endif
00068
00069 #ifdef EIGEN_DONT_ALIGN
00070 #ifndef EIGEN_DONT_ALIGN_STATICALLY
00071 #define EIGEN_DONT_ALIGN_STATICALLY
00072 #endif
00073 #define EIGEN_ALIGN 0
00074 #else
00075 #define EIGEN_ALIGN 1
00076 #endif
00077
00078
00079
00080 #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT && !defined(EIGEN_DONT_ALIGN_STATICALLY)
00081 #define EIGEN_ALIGN_STATICALLY 1
00082 #else
00083 #define EIGEN_ALIGN_STATICALLY 0
00084 #ifndef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
00085 #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
00086 #endif
00087 #endif
00088
00089 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
00090 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION RowMajor
00091 #else
00092 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ColMajor
00093 #endif
00094
00095 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
00096 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
00097 #endif
00098
00099
00100 #ifdef __has_builtin
00101 # define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
00102 #else
00103 # define EIGEN_HAS_BUILTIN(x) 0
00104 #endif
00105
00111 #ifndef EIGEN_FAST_MATH
00112 #define EIGEN_FAST_MATH 1
00113 #endif
00114
00115 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
00116
00117
00118 #define EIGEN_CAT2(a,b) a ## b
00119 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
00120
00121
00122 #define EIGEN_MAKESTRING2(a) #a
00123 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
00124
00125
00126
00127
00128 #if (defined _MSC_VER) || (defined __INTEL_COMPILER)
00129 #define EIGEN_STRONG_INLINE __forceinline
00130 #else
00131 #define EIGEN_STRONG_INLINE inline
00132 #endif
00133
00134
00135
00136
00137
00138
00139
00140
00141 #if EIGEN_GNUC_AT_LEAST(4,0)
00142 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
00143 #else
00144 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
00145 #endif
00146
00147 #if (defined __GNUC__)
00148 #define EIGEN_DONT_INLINE __attribute__((noinline))
00149 #elif (defined _MSC_VER)
00150 #define EIGEN_DONT_INLINE __declspec(noinline)
00151 #else
00152 #define EIGEN_DONT_INLINE
00153 #endif
00154
00155 #if (defined __GNUC__)
00156 #define EIGEN_PERMISSIVE_EXPR __extension__
00157 #else
00158 #define EIGEN_PERMISSIVE_EXPR
00159 #endif
00160
00161
00162
00163
00164
00165 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
00166 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
00167
00168 #ifdef NDEBUG
00169 # ifndef EIGEN_NO_DEBUG
00170 # define EIGEN_NO_DEBUG
00171 # endif
00172 #endif
00173
00174
00175 #ifdef EIGEN_NO_DEBUG
00176 #define eigen_plain_assert(x)
00177 #else
00178 #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
00179 namespace Eigen {
00180 namespace internal {
00181 inline bool copy_bool(bool b) { return b; }
00182 }
00183 }
00184 #define eigen_plain_assert(x) assert(x)
00185 #else
00186
00187 #include <cstdlib>
00188 #include <iostream>
00189
00190 namespace Eigen {
00191 namespace internal {
00192
00193
00194 namespace {
00195 EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; }
00196 }
00197 inline void assert_fail(const char *condition, const char *function, const char *file, int line)
00198 {
00199 std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
00200 abort();
00201 }
00202 }
00203 }
00204 #define eigen_plain_assert(x) \
00205 do { \
00206 if(!Eigen::internal::copy_bool(x)) \
00207 Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
00208 } while(false)
00209 #endif
00210 #endif
00211
00212
00213 #ifndef eigen_assert
00214 #define eigen_assert(x) eigen_plain_assert(x)
00215 #endif
00216
00217 #ifdef EIGEN_INTERNAL_DEBUGGING
00218 #define eigen_internal_assert(x) eigen_assert(x)
00219 #else
00220 #define eigen_internal_assert(x)
00221 #endif
00222
00223 #ifdef EIGEN_NO_DEBUG
00224 #define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
00225 #else
00226 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
00227 #endif
00228
00229 #ifndef EIGEN_NO_DEPRECATED_WARNING
00230 #if (defined __GNUC__)
00231 #define EIGEN_DEPRECATED __attribute__((deprecated))
00232 #elif (defined _MSC_VER)
00233 #define EIGEN_DEPRECATED __declspec(deprecated)
00234 #else
00235 #define EIGEN_DEPRECATED
00236 #endif
00237 #else
00238 #define EIGEN_DEPRECATED
00239 #endif
00240
00241 #if (defined __GNUC__)
00242 #define EIGEN_UNUSED __attribute__((unused))
00243 #else
00244 #define EIGEN_UNUSED
00245 #endif
00246
00247
00248 namespace Eigen {
00249 namespace internal {
00250 template<typename T> void ignore_unused_variable(const T&) {}
00251 }
00252 }
00253 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
00254
00255 #if !defined(EIGEN_ASM_COMMENT)
00256 #if (defined __GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
00257 #define EIGEN_ASM_COMMENT(X) __asm__("#" X)
00258 #else
00259 #define EIGEN_ASM_COMMENT(X)
00260 #endif
00261 #endif
00262
00263
00264
00265
00266
00267
00268
00269
00270 #if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__) || (defined __ARMCC_VERSION)
00271 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00272 #elif (defined _MSC_VER)
00273 #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
00274 #elif (defined __SUNPRO_CC)
00275
00276 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00277 #else
00278 #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
00279 #endif
00280
00281 #define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8)
00282 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
00283
00284 #if EIGEN_ALIGN_STATICALLY
00285 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n) EIGEN_ALIGN_TO_BOUNDARY(n)
00286 #define EIGEN_USER_ALIGN16 EIGEN_ALIGN16
00287 #else
00288 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n)
00289 #define EIGEN_USER_ALIGN16
00290 #endif
00291
00292 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
00293 #define EIGEN_RESTRICT
00294 #endif
00295 #ifndef EIGEN_RESTRICT
00296 #define EIGEN_RESTRICT __restrict
00297 #endif
00298
00299 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
00300
00301 #define EIGEN_STACK_ALLOCATION_LIMIT 131072
00302 #endif
00303
00304 #ifndef EIGEN_DEFAULT_IO_FORMAT
00305 #ifdef EIGEN_MAKING_DOCS
00306
00307
00308 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
00309 #else
00310 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
00311 #endif
00312 #endif
00313
00314
00315 #define EIGEN_EMPTY
00316
00317 #if defined(_MSC_VER) && (_MSC_VER < 1800) && (!defined(__INTEL_COMPILER))
00318 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00319 using Base::operator =;
00320 #elif defined(__clang__) // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
00321 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00322 using Base::operator =; \
00323 EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
00324 template <typename OtherDerived> \
00325 EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; }
00326 #else
00327 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00328 using Base::operator =; \
00329 EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
00330 { \
00331 Base::operator=(other); \
00332 return *this; \
00333 }
00334 #endif
00335
00340 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
00341
00350 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
00351 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00352 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00353 typedef typename Base::CoeffReturnType CoeffReturnType; \
00354 typedef typename Eigen::internal::nested<Derived>::type Nested; \
00355 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00356 typedef typename Eigen::internal::traits<Derived>::Index Index; \
00357 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00358 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00359 Flags = Eigen::internal::traits<Derived>::Flags, \
00360 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00361 SizeAtCompileTime = Base::SizeAtCompileTime, \
00362 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00363 IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
00364
00365
00366 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
00367 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00368 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00369 typedef typename Base::PacketScalar PacketScalar; \
00370 typedef typename Base::CoeffReturnType CoeffReturnType; \
00371 typedef typename Eigen::internal::nested<Derived>::type Nested; \
00372 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00373 typedef typename Eigen::internal::traits<Derived>::Index Index; \
00374 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00375 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00376 MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
00377 MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime, \
00378 Flags = Eigen::internal::traits<Derived>::Flags, \
00379 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00380 SizeAtCompileTime = Base::SizeAtCompileTime, \
00381 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00382 IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
00383 using Base::derived; \
00384 using Base::const_cast_derived;
00385
00386
00387 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
00388 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
00389
00390
00391
00392
00393 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00394 : ((int)a == 1 || (int)b == 1) ? 1 \
00395 : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00396 : ((int)a <= (int)b) ? (int)a : (int)b)
00397
00398
00399
00400
00401 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00402 : ((int)a == 1 || (int)b == 1) ? 1 \
00403 : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
00404 : ((int)a == Dynamic) ? (int)b \
00405 : ((int)b == Dynamic) ? (int)a \
00406 : ((int)a <= (int)b) ? (int)a : (int)b)
00407
00408
00409 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00410 : ((int)a >= (int)b) ? (int)a : (int)b)
00411
00412 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
00413
00414 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
00415
00416 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
00417 template<typename OtherDerived> \
00418 EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
00419 (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
00420 { \
00421 return CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); \
00422 }
00423
00424
00425 #define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
00426 CwiseBinaryOp< \
00427 internal::scalar_product_op< \
00428 typename internal::traits<LHS>::Scalar, \
00429 typename internal::traits<RHS>::Scalar \
00430 >, \
00431 const LHS, \
00432 const RHS \
00433 >
00434
00435 #endif // EIGEN_MACROS_H