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