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 1
00016 #define EIGEN_MINOR_VERSION 2
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
00104 #ifndef EIGEN_FAST_MATH
00105 #define EIGEN_FAST_MATH 1
00106 #endif
00107
00108 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
00109
00110
00111 #define EIGEN_CAT2(a,b) a ## b
00112 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
00113
00114
00115 #define EIGEN_MAKESTRING2(a) #a
00116 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
00117
00118 #if EIGEN_GNUC_AT_LEAST(4,1) && !defined(__clang__) && !defined(__INTEL_COMPILER)
00119 #define EIGEN_FLATTEN_ATTRIB __attribute__((flatten))
00120 #else
00121 #define EIGEN_FLATTEN_ATTRIB
00122 #endif
00123
00124
00125
00126
00127 #if (defined _MSC_VER) || (defined __INTEL_COMPILER)
00128 #define EIGEN_STRONG_INLINE __forceinline
00129 #else
00130 #define EIGEN_STRONG_INLINE inline
00131 #endif
00132
00133
00134
00135
00136
00137
00138
00139
00140 #if EIGEN_GNUC_AT_LEAST(4,0)
00141 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
00142 #else
00143 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
00144 #endif
00145
00146 #if (defined __GNUC__)
00147 #define EIGEN_DONT_INLINE __attribute__((noinline))
00148 #elif (defined _MSC_VER)
00149 #define EIGEN_DONT_INLINE __declspec(noinline)
00150 #else
00151 #define EIGEN_DONT_INLINE
00152 #endif
00153
00154
00155
00156
00157
00158 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
00159 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
00160
00161 #ifdef NDEBUG
00162 # ifndef EIGEN_NO_DEBUG
00163 # define EIGEN_NO_DEBUG
00164 # endif
00165 #endif
00166
00167
00168 #ifdef EIGEN_NO_DEBUG
00169 #define eigen_plain_assert(x)
00170 #else
00171 #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
00172 namespace Eigen {
00173 namespace internal {
00174 inline bool copy_bool(bool b) { return b; }
00175 }
00176 }
00177 #define eigen_plain_assert(x) assert(x)
00178 #else
00179
00180 #include <cstdlib>
00181 #include <iostream>
00182
00183 namespace Eigen {
00184 namespace internal {
00185
00186
00187 namespace {
00188 EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; }
00189 }
00190 inline void assert_fail(const char *condition, const char *function, const char *file, int line)
00191 {
00192 std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
00193 abort();
00194 }
00195 }
00196 }
00197 #define eigen_plain_assert(x) \
00198 do { \
00199 if(!Eigen::internal::copy_bool(x)) \
00200 Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
00201 } while(false)
00202 #endif
00203 #endif
00204
00205
00206 #ifndef eigen_assert
00207 #define eigen_assert(x) eigen_plain_assert(x)
00208 #endif
00209
00210 #ifdef EIGEN_INTERNAL_DEBUGGING
00211 #define eigen_internal_assert(x) eigen_assert(x)
00212 #else
00213 #define eigen_internal_assert(x)
00214 #endif
00215
00216 #ifdef EIGEN_NO_DEBUG
00217 #define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
00218 #else
00219 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
00220 #endif
00221
00222 #ifndef EIGEN_NO_DEPRECATED_WARNING
00223 #if (defined __GNUC__)
00224 #define EIGEN_DEPRECATED __attribute__((deprecated))
00225 #elif (defined _MSC_VER)
00226 #define EIGEN_DEPRECATED __declspec(deprecated)
00227 #else
00228 #define EIGEN_DEPRECATED
00229 #endif
00230 #else
00231 #define EIGEN_DEPRECATED
00232 #endif
00233
00234 #if (defined __GNUC__)
00235 #define EIGEN_UNUSED __attribute__((unused))
00236 #else
00237 #define EIGEN_UNUSED
00238 #endif
00239
00240
00241 #define EIGEN_UNUSED_VARIABLE(var) (void)var;
00242
00243 #if !defined(EIGEN_ASM_COMMENT) && (defined __GNUC__)
00244 #define EIGEN_ASM_COMMENT(X) asm("#" X)
00245 #else
00246 #define EIGEN_ASM_COMMENT(X)
00247 #endif
00248
00249
00250
00251
00252
00253
00254
00255
00256 #if (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__) || (defined __ARMCC_VERSION)
00257 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00258 #elif (defined _MSC_VER)
00259 #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
00260 #elif (defined __SUNPRO_CC)
00261
00262 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00263 #else
00264 #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
00265 #endif
00266
00267 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
00268
00269 #if EIGEN_ALIGN_STATICALLY
00270 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n) EIGEN_ALIGN_TO_BOUNDARY(n)
00271 #define EIGEN_USER_ALIGN16 EIGEN_ALIGN16
00272 #else
00273 #define EIGEN_USER_ALIGN_TO_BOUNDARY(n)
00274 #define EIGEN_USER_ALIGN16
00275 #endif
00276
00277 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
00278 #define EIGEN_RESTRICT
00279 #endif
00280 #ifndef EIGEN_RESTRICT
00281 #define EIGEN_RESTRICT __restrict
00282 #endif
00283
00284 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
00285 #define EIGEN_STACK_ALLOCATION_LIMIT 20000
00286 #endif
00287
00288 #ifndef EIGEN_DEFAULT_IO_FORMAT
00289 #ifdef EIGEN_MAKING_DOCS
00290
00291
00292 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
00293 #else
00294 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
00295 #endif
00296 #endif
00297
00298
00299 #define EIGEN_EMPTY
00300
00301 #if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
00302 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00303 using Base::operator =;
00304 #else
00305 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00306 using Base::operator =; \
00307 EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
00308 { \
00309 Base::operator=(other); \
00310 return *this; \
00311 }
00312 #endif
00313
00314 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
00315 EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
00316
00325 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
00326 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00327 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00328 typedef typename Base::CoeffReturnType CoeffReturnType; \
00329 typedef typename Eigen::internal::nested<Derived>::type Nested; \
00330 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00331 typedef typename Eigen::internal::traits<Derived>::Index Index; \
00332 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00333 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00334 Flags = Eigen::internal::traits<Derived>::Flags, \
00335 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00336 SizeAtCompileTime = Base::SizeAtCompileTime, \
00337 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00338 IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
00339
00340
00341 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
00342 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00343 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00344 typedef typename Base::PacketScalar PacketScalar; \
00345 typedef typename Base::CoeffReturnType CoeffReturnType; \
00346 typedef typename Eigen::internal::nested<Derived>::type Nested; \
00347 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00348 typedef typename Eigen::internal::traits<Derived>::Index Index; \
00349 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00350 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00351 MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
00352 MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime, \
00353 Flags = Eigen::internal::traits<Derived>::Flags, \
00354 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00355 SizeAtCompileTime = Base::SizeAtCompileTime, \
00356 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00357 IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
00358 using Base::derived; \
00359 using Base::const_cast_derived;
00360
00361
00362 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
00363 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
00364
00365
00366
00367
00368 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00369 : ((int)a == 1 || (int)b == 1) ? 1 \
00370 : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00371 : ((int)a <= (int)b) ? (int)a : (int)b)
00372
00373
00374
00375
00376 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00377 : ((int)a == 1 || (int)b == 1) ? 1 \
00378 : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
00379 : ((int)a == Dynamic) ? (int)b \
00380 : ((int)b == Dynamic) ? (int)a \
00381 : ((int)a <= (int)b) ? (int)a : (int)b)
00382
00383
00384 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00385 : ((int)a >= (int)b) ? (int)a : (int)b)
00386
00387 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
00388
00389 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
00390
00391 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
00392 template<typename OtherDerived> \
00393 EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
00394 (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
00395 { \
00396 return CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); \
00397 }
00398
00399
00400 #define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
00401 CwiseBinaryOp< \
00402 internal::scalar_product_op< \
00403 typename internal::traits<LHS>::Scalar, \
00404 typename internal::traits<RHS>::Scalar \
00405 >, \
00406 const LHS, \
00407 const RHS \
00408 >
00409
00410 #endif // EIGEN_MACROS_H