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 92
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 #if defined(__GNUC__) && (__GNUC__ <= 3)
00043 #define EIGEN_GCC3_OR_OLDER 1
00044 #else
00045 #define EIGEN_GCC3_OR_OLDER 0
00046 #endif
00047
00048
00049
00050
00051
00052
00053
00054
00055 #if defined(__GNUC__) && !(defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || defined(__ppc__) || defined(__ia64__))
00056 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
00057 #else
00058 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
00059 #endif
00060
00061
00062 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \
00063 && !EIGEN_GCC3_OR_OLDER \
00064 && !defined(__SUNPRO_CC) \
00065 && !defined(__QNXNTO__)
00066 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1
00067 #else
00068 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0
00069 #endif
00070
00071 #ifdef EIGEN_DONT_ALIGN
00072 #ifndef EIGEN_DONT_ALIGN_STATICALLY
00073 #define EIGEN_DONT_ALIGN_STATICALLY
00074 #endif
00075 #define EIGEN_ALIGN 0
00076 #else
00077 #define EIGEN_ALIGN 1
00078 #endif
00079
00080
00081
00082 #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT && !defined(EIGEN_DONT_ALIGN_STATICALLY)
00083 #define EIGEN_ALIGN_STATICALLY 1
00084 #else
00085 #define EIGEN_ALIGN_STATICALLY 0
00086 #ifndef EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
00087 #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
00088 #endif
00089 #endif
00090
00091 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
00092 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION RowMajor
00093 #else
00094 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ColMajor
00095 #endif
00096
00097 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
00098 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
00099 #endif
00100
00101
00102
00103
00104
00105
00106 #ifndef EIGEN_FAST_MATH
00107 #define EIGEN_FAST_MATH 1
00108 #endif
00109
00110 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
00111
00112 #ifdef NDEBUG
00113 # ifndef EIGEN_NO_DEBUG
00114 # define EIGEN_NO_DEBUG
00115 # endif
00116 #endif
00117
00118 #ifndef eigen_assert
00119 #ifdef EIGEN_NO_DEBUG
00120 #define eigen_assert(x)
00121 #else
00122 #define eigen_assert(x) assert(x)
00123 #endif
00124 #endif
00125
00126 #ifdef EIGEN_INTERNAL_DEBUGGING
00127 #define eigen_internal_assert(x) eigen_assert(x)
00128 #else
00129 #define eigen_internal_assert(x)
00130 #endif
00131
00132 #ifdef EIGEN_NO_DEBUG
00133 #define EIGEN_ONLY_USED_FOR_DEBUG(x) (void)x
00134 #else
00135 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
00136 #endif
00137
00138
00139
00140
00141
00142
00143
00144 #if EIGEN_GNUC_AT_LEAST(4,0)
00145 #define EIGEN_ALWAYS_INLINE_ATTRIB __attribute__((always_inline))
00146 #else
00147 #define EIGEN_ALWAYS_INLINE_ATTRIB
00148 #endif
00149
00150 #if EIGEN_GNUC_AT_LEAST(4,1)
00151 #define EIGEN_FLATTEN_ATTRIB __attribute__((flatten))
00152 #else
00153 #define EIGEN_FLATTEN_ATTRIB
00154 #endif
00155
00156
00157 #if (defined _MSC_VER) || (defined __intel_compiler)
00158 #define EIGEN_STRONG_INLINE __forceinline
00159 #else
00160 #define EIGEN_STRONG_INLINE inline
00161 #endif
00162
00163 #if (defined __GNUC__)
00164 #define EIGEN_DONT_INLINE __attribute__((noinline))
00165 #elif (defined _MSC_VER)
00166 #define EIGEN_DONT_INLINE __declspec(noinline)
00167 #else
00168 #define EIGEN_DONT_INLINE
00169 #endif
00170
00171
00172
00173
00174
00175 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
00176 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
00177
00178 #if (defined __GNUC__)
00179 #define EIGEN_DEPRECATED __attribute__((deprecated))
00180 #elif (defined _MSC_VER)
00181 #define EIGEN_DEPRECATED __declspec(deprecated)
00182 #else
00183 #define EIGEN_DEPRECATED
00184 #endif
00185
00186 #if (defined __GNUC__)
00187 #define EIGEN_UNUSED __attribute__((unused))
00188 #else
00189 #define EIGEN_UNUSED
00190 #endif
00191
00192
00193 #define EIGEN_UNUSED_VARIABLE(var) (void)var;
00194
00195 #if (defined __GNUC__)
00196 #define EIGEN_ASM_COMMENT(X) asm("#"X)
00197 #else
00198 #define EIGEN_ASM_COMMENT(X)
00199 #endif
00200
00201
00202
00203
00204
00205
00206
00207
00208 #if !EIGEN_ALIGN_STATICALLY
00209 #define EIGEN_ALIGN_TO_BOUNDARY(n)
00210 #elif (defined __GNUC__) || (defined __PGI) || (defined __IBMCPP__)
00211 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00212 #elif (defined _MSC_VER)
00213 #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
00214 #elif (defined __SUNPRO_CC)
00215
00216 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00217 #else
00218 #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
00219 #endif
00220
00221 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
00222
00223 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
00224 #define EIGEN_RESTRICT
00225 #endif
00226 #ifndef EIGEN_RESTRICT
00227 #define EIGEN_RESTRICT __restrict
00228 #endif
00229
00230 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
00231 #define EIGEN_STACK_ALLOCATION_LIMIT 20000
00232 #endif
00233
00234 #ifndef EIGEN_DEFAULT_IO_FORMAT
00235 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
00236 #endif
00237
00238
00239 #define EIGEN_EMPTY
00240
00241
00242 #define EIGEN_CAT2(a,b) a ## b
00243 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
00244
00245
00246 #define EIGEN_MAKESTRING2(a) #a
00247 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
00248
00249
00250
00251 #define EIGEN_DOCS_IO_FORMAT IOFormat(3, 0, " ", "\n", "", "")
00252
00253 #if defined(_MSC_VER) && (!defined(__INTEL_COMPILER))
00254 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00255 using Base::operator =;
00256 #else
00257 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00258 using Base::operator =; \
00259 EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
00260 { \
00261 Base::operator=(other); \
00262 return *this; \
00263 }
00264 #endif
00265
00266 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
00267 EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
00278 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00279 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00280 typedef typename Base::CoeffReturnType CoeffReturnType; \
00281 typedef typename Eigen::internal::nested<Derived>::type Nested; \
00282 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00283 typedef typename Eigen::internal::traits<Derived>::Index Index; \
00284 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00285 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00286 Flags = Eigen::internal::traits<Derived>::Flags, \
00287 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00288 SizeAtCompileTime = Base::SizeAtCompileTime, \
00289 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00290 IsVectorAtCompileTime = Base::IsVectorAtCompileTime };
00291
00292
00293 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
00294 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
00295 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
00296 typedef typename Base::PacketScalar PacketScalar; \
00297 typedef typename Base::CoeffReturnType CoeffReturnType; \
00298 typedef typename Eigen::internal::nested<Derived>::type Nested; \
00299 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00300 typedef typename Eigen::internal::traits<Derived>::Index Index; \
00301 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00302 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00303 MaxRowsAtCompileTime = Eigen::internal::traits<Derived>::MaxRowsAtCompileTime, \
00304 MaxColsAtCompileTime = Eigen::internal::traits<Derived>::MaxColsAtCompileTime, \
00305 Flags = Eigen::internal::traits<Derived>::Flags, \
00306 CoeffReadCost = Eigen::internal::traits<Derived>::CoeffReadCost, \
00307 SizeAtCompileTime = Base::SizeAtCompileTime, \
00308 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00309 IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
00310 using Base::derived; \
00311 using Base::const_cast_derived;
00312
00313
00314 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
00315 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
00316
00317
00318
00319
00320 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00321 : ((int)a == 1 || (int)b == 1) ? 1 \
00322 : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00323 : ((int)a <= (int)b) ? (int)a : (int)b)
00324
00325
00326
00327
00328 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00329 : ((int)a == 1 || (int)b == 1) ? 1 \
00330 : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
00331 : ((int)a == Dynamic) ? (int)b \
00332 : ((int)b == Dynamic) ? (int)a \
00333 : ((int)a <= (int)b) ? (int)a : (int)b)
00334
00335
00336 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00337 : ((int)a >= (int)b) ? (int)a : (int)b)
00338
00339 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
00340
00341 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
00342
00343 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
00344 template<typename OtherDerived> \
00345 EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, Derived, OtherDerived> \
00346 METHOD(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
00347 { \
00348 return CwiseBinaryOp<FUNCTOR<Scalar>, Derived, OtherDerived>(derived(), other.derived()); \
00349 }
00350
00351
00352 #define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
00353 CwiseBinaryOp< \
00354 internal::scalar_product_op< \
00355 typename internal::traits<LHS>::Scalar, \
00356 typename internal::traits<RHS>::Scalar \
00357 >, \
00358 LHS, \
00359 RHS \
00360 >
00361
00362 #endif // EIGEN_MACROS_H