MOAB  4.9.3pre
Macros.h
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008-2015 Gael Guennebaud <[email protected]>
00005 // Copyright (C) 2006-2008 Benoit Jacob <[email protected]>
00006 //
00007 // This Source Code Form is subject to the terms of the Mozilla
00008 // Public License v. 2.0. If a copy of the MPL was not distributed
00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
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 92
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 
00022 // Compiler identification, EIGEN_COMP_*
00023 
00025 #ifdef __GNUC__
00026   #define EIGEN_COMP_GNUC 1
00027 #else
00028   #define EIGEN_COMP_GNUC 0
00029 #endif
00030 
00032 #if defined(__clang__)
00033   #define EIGEN_COMP_CLANG 1
00034 #else
00035   #define EIGEN_COMP_CLANG 0
00036 #endif
00037 
00038 
00040 #if defined(__llvm__)
00041   #define EIGEN_COMP_LLVM 1
00042 #else
00043   #define EIGEN_COMP_LLVM 0
00044 #endif
00045 
00047 #if defined(__INTEL_COMPILER)
00048   #define EIGEN_COMP_ICC __INTEL_COMPILER
00049 #else
00050   #define EIGEN_COMP_ICC 0
00051 #endif
00052 
00054 #if defined(__MINGW32__)
00055   #define EIGEN_COMP_MINGW 1
00056 #else
00057   #define EIGEN_COMP_MINGW 0
00058 #endif
00059 
00061 #if defined(__SUNPRO_CC)
00062   #define EIGEN_COMP_SUNCC 1
00063 #else
00064   #define EIGEN_COMP_SUNCC 0
00065 #endif
00066 
00068 #if defined(_MSC_VER)
00069   #define EIGEN_COMP_MSVC _MSC_VER
00070 #else
00071   #define EIGEN_COMP_MSVC 0
00072 #endif
00073 
00075 #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC)
00076   #define EIGEN_COMP_MSVC_STRICT _MSC_VER
00077 #else
00078   #define EIGEN_COMP_MSVC_STRICT 0
00079 #endif
00080 
00082 #if defined(__IBMCPP__) || defined(__xlc__)
00083   #define EIGEN_COMP_IBM 1
00084 #else
00085   #define EIGEN_COMP_IBM 0
00086 #endif
00087 
00089 #if defined(__PGI)
00090   #define EIGEN_COMP_PGI 1
00091 #else
00092   #define EIGEN_COMP_PGI 0
00093 #endif
00094 
00096 #if defined(__CC_ARM) || defined(__ARMCC_VERSION)
00097   #define EIGEN_COMP_ARM 1
00098 #else
00099   #define EIGEN_COMP_ARM 0
00100 #endif
00101 
00103 #if defined(__EMSCRIPTEN__)
00104   #define EIGEN_COMP_EMSCRIPTEN 1
00105 #else
00106   #define EIGEN_COMP_EMSCRIPTEN 0
00107 #endif
00108 
00109 
00111 #if EIGEN_COMP_GNUC && !(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM || EIGEN_COMP_EMSCRIPTEN)
00112   #define EIGEN_COMP_GNUC_STRICT 1
00113 #else
00114   #define EIGEN_COMP_GNUC_STRICT 0
00115 #endif
00116 
00117 
00118 #if EIGEN_COMP_GNUC
00119   #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
00120   #define EIGEN_GNUC_AT_MOST(x,y)  ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
00121   #define EIGEN_GNUC_AT(x,y)       ( __GNUC__==x && __GNUC_MINOR__==y )
00122 #else
00123   #define EIGEN_GNUC_AT_LEAST(x,y) 0
00124   #define EIGEN_GNUC_AT_MOST(x,y)  0
00125   #define EIGEN_GNUC_AT(x,y)       0
00126 #endif
00127 
00128 // FIXME: could probably be removed as we do not support gcc 3.x anymore
00129 #if EIGEN_COMP_GNUC && (__GNUC__ <= 3)
00130 #define EIGEN_GCC3_OR_OLDER 1
00131 #else
00132 #define EIGEN_GCC3_OR_OLDER 0
00133 #endif
00134 
00135 
00136 // Architecture identification, EIGEN_ARCH_*
00137 
00138 #if defined(__x86_64__) || defined(_M_X64) || defined(__amd64)
00139   #define EIGEN_ARCH_x86_64 1
00140 #else
00141   #define EIGEN_ARCH_x86_64 0
00142 #endif
00143 
00144 #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__i386)
00145   #define EIGEN_ARCH_i386 1
00146 #else
00147   #define EIGEN_ARCH_i386 0
00148 #endif
00149 
00150 #if EIGEN_ARCH_x86_64 || EIGEN_ARCH_i386
00151   #define EIGEN_ARCH_i386_OR_x86_64 1
00152 #else
00153   #define EIGEN_ARCH_i386_OR_x86_64 0
00154 #endif
00155 
00157 #if defined(__arm__)
00158   #define EIGEN_ARCH_ARM 1
00159 #else
00160   #define EIGEN_ARCH_ARM 0
00161 #endif
00162 
00164 #if defined(__aarch64__)
00165   #define EIGEN_ARCH_ARM64 1
00166 #else
00167   #define EIGEN_ARCH_ARM64 0
00168 #endif
00169 
00170 #if EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64
00171   #define EIGEN_ARCH_ARM_OR_ARM64 1
00172 #else
00173   #define EIGEN_ARCH_ARM_OR_ARM64 0
00174 #endif
00175 
00177 #if defined(__mips__) || defined(__mips)
00178   #define EIGEN_ARCH_MIPS 1
00179 #else
00180   #define EIGEN_ARCH_MIPS 0
00181 #endif
00182 
00184 #if defined(__sparc__) || defined(__sparc)
00185   #define EIGEN_ARCH_SPARC 1
00186 #else
00187   #define EIGEN_ARCH_SPARC 0
00188 #endif
00189 
00191 #if defined(__ia64__)
00192   #define EIGEN_ARCH_IA64 1
00193 #else
00194   #define EIGEN_ARCH_IA64 0
00195 #endif
00196 
00198 #if defined(__powerpc__) || defined(__ppc__) || defined(_M_PPC)
00199   #define EIGEN_ARCH_PPC 1
00200 #else
00201   #define EIGEN_ARCH_PPC 0
00202 #endif
00203 
00204 
00205 
00206 // Operating system identification, EIGEN_OS_*
00207 
00209 #if defined(__unix__) || defined(__unix)
00210   #define EIGEN_OS_UNIX 1
00211 #else
00212   #define EIGEN_OS_UNIX 0
00213 #endif
00214 
00216 #if defined(__linux__)
00217   #define EIGEN_OS_LINUX 1
00218 #else
00219   #define EIGEN_OS_LINUX 0
00220 #endif
00221 
00223 // note: ANDROID is defined when using ndk_build, __ANDROID__ is defined when using a standalone toolchain.
00224 #if defined(__ANDROID__) || defined(ANDROID)
00225   #define EIGEN_OS_ANDROID 1
00226 #else
00227   #define EIGEN_OS_ANDROID 0
00228 #endif
00229 
00231 #if defined(__gnu_linux__) && !(EIGEN_OS_ANDROID)
00232   #define EIGEN_OS_GNULINUX 1
00233 #else
00234   #define EIGEN_OS_GNULINUX 0
00235 #endif
00236 
00238 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
00239   #define EIGEN_OS_BSD 1
00240 #else
00241   #define EIGEN_OS_BSD 0
00242 #endif
00243 
00245 #if defined(__APPLE__)
00246   #define EIGEN_OS_MAC 1
00247 #else
00248   #define EIGEN_OS_MAC 0
00249 #endif
00250 
00252 #if defined(__QNX__)
00253   #define EIGEN_OS_QNX 1
00254 #else
00255   #define EIGEN_OS_QNX 0
00256 #endif
00257 
00259 #if defined(_WIN32)
00260   #define EIGEN_OS_WIN 1
00261 #else
00262   #define EIGEN_OS_WIN 0
00263 #endif
00264 
00266 #if defined(_WIN64)
00267   #define EIGEN_OS_WIN64 1
00268 #else
00269   #define EIGEN_OS_WIN64 0
00270 #endif
00271 
00273 #if defined(_WIN32_WCE)
00274   #define EIGEN_OS_WINCE 1
00275 #else
00276   #define EIGEN_OS_WINCE 0
00277 #endif
00278 
00280 #if defined(__CYGWIN__)
00281   #define EIGEN_OS_CYGWIN 1
00282 #else
00283   #define EIGEN_OS_CYGWIN 0
00284 #endif
00285 
00287 #if EIGEN_OS_WIN && !( EIGEN_OS_WINCE || EIGEN_OS_CYGWIN )
00288   #define EIGEN_OS_WIN_STRICT 1
00289 #else
00290   #define EIGEN_OS_WIN_STRICT 0
00291 #endif
00292 
00294 #if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__))
00295   #define EIGEN_OS_SUN 1
00296 #else
00297   #define EIGEN_OS_SUN 0
00298 #endif
00299 
00301 #if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
00302   #define EIGEN_OS_SOLARIS 1
00303 #else
00304   #define EIGEN_OS_SOLARIS 0
00305 #endif
00306 
00307 
00308 
00309 #if EIGEN_GNUC_AT_MOST(4,3) && !EIGEN_COMP_CLANG
00310   // see bug 89
00311   #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
00312 #else
00313   #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
00314 #endif
00315 
00316 // This macro can be used to prevent from macro expansion, e.g.:
00317 //   std::max EIGEN_NOT_A_MACRO(a,b)
00318 #define EIGEN_NOT_A_MACRO
00319 
00320 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
00321 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::RowMajor
00322 #else
00323 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::ColMajor
00324 #endif
00325 
00326 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
00327 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
00328 #endif
00329 
00330 // Cross compiler wrapper around LLVM's __has_builtin
00331 #ifdef __has_builtin
00332 #  define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
00333 #else
00334 #  define EIGEN_HAS_BUILTIN(x) 0
00335 #endif
00336 
00337 // A Clang feature extension to determine compiler features.
00338 // We use it to determine 'cxx_rvalue_references'
00339 #ifndef __has_feature
00340 # define __has_feature(x) 0
00341 #endif
00342 
00343 // Do we support r-value references?
00344 #if (__has_feature(cxx_rvalue_references) || \
00345     (defined(__cplusplus) && __cplusplus >= 201103L) || \
00346     (EIGEN_COMP_MSVC >= 1600))
00347   #define EIGEN_HAVE_RVALUE_REFERENCES
00348 #endif
00349 
00350 // Does the compiler support C99?
00351 #if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))       \
00352   || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
00353   || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))
00354 #define EIGEN_HAS_C99_MATH 1
00355 #endif
00356 
00357 // Does the compiler support result_of?
00358 #if (__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L))
00359 #define EIGEN_HAS_STD_RESULT_OF 1
00360 #endif
00361 
00362 // Does the compiler support variadic templates?
00363 #if __cplusplus > 199711L
00364 // Disable the use of variadic templates when compiling with nvcc on ARM devices:
00365 // this prevents nvcc from crashing when compiling Eigen on Tegra X1
00366 #if !defined(__NVCC__) || !EIGEN_ARCH_ARM_OR_ARM64
00367 #define EIGEN_HAS_VARIADIC_TEMPLATES 1
00368 #endif
00369 #endif
00370 
00371 // Does the compiler support const expressions?
00372 #ifdef __CUDACC__
00373 // Const expressions are supported provided that c++11 is enabled and we're using nvcc 7.5 or above
00374 #if defined(__CUDACC_VER__) &&  __CUDACC_VER__ >= 70500 && __cplusplus > 199711L
00375   #define EIGEN_HAS_CONSTEXPR 1
00376 #endif
00377 #elif (defined(__cplusplus) && __cplusplus >= 201402L) || \
00378     EIGEN_GNUC_AT_LEAST(4,8)
00379 #define EIGEN_HAS_CONSTEXPR 1
00380 #endif
00381 
00382 // Does the compiler support C++11 math?
00383 // Let's be conservative and enable the default C++11 implementation only if we are sure it exists
00384 #ifndef EIGEN_HAS_CXX11_MATH
00385   #if (__cplusplus > 201103L) || (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC)  \
00386       && (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC)
00387     #define EIGEN_HAS_CXX11_MATH 1
00388   #else
00389     #define EIGEN_HAS_CXX11_MATH 0
00390   #endif
00391 #endif
00392 
00393 // Does the compiler support proper C++11 containers?
00394 #ifndef EIGEN_HAS_CXX11_CONTAINERS
00395   #if    (__cplusplus > 201103L) \
00396       || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \
00397       || EIGEN_COMP_MSVC >= 1900
00398     #define EIGEN_HAS_CXX11_CONTAINERS 1
00399   #else
00400     #define EIGEN_HAS_CXX11_CONTAINERS 0
00401   #endif
00402 #endif
00403 
00404 // Does the compiler support C++11 noexcept?
00405 #ifndef EIGEN_HAS_CXX11_NOEXCEPT
00406   #if    (__cplusplus > 201103L) \
00407       || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \
00408       || EIGEN_COMP_MSVC >= 1900
00409     #define EIGEN_HAS_CXX11_NOEXCEPT 1
00410   #else
00411     #define EIGEN_HAS_CXX11_NOEXCEPT 0
00412   #endif
00413 #endif
00414 
00420 #ifndef EIGEN_FAST_MATH
00421 #define EIGEN_FAST_MATH 1
00422 #endif
00423 
00424 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
00425 
00426 // concatenate two tokens
00427 #define EIGEN_CAT2(a,b) a ## b
00428 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
00429 
00430 // convert a token to a string
00431 #define EIGEN_MAKESTRING2(a) #a
00432 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
00433 
00434 // EIGEN_STRONG_INLINE is a stronger version of the inline, using __forceinline on MSVC,
00435 // but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline
00436 // but GCC is still doing fine with just inline.
00437 #if EIGEN_COMP_MSVC || EIGEN_COMP_ICC
00438 #define EIGEN_STRONG_INLINE __forceinline
00439 #else
00440 #define EIGEN_STRONG_INLINE inline
00441 #endif
00442 
00443 // EIGEN_ALWAYS_INLINE is the stronget, it has the effect of making the function inline and adding every possible
00444 // attribute to maximize inlining. This should only be used when really necessary: in particular,
00445 // it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times.
00446 // FIXME with the always_inline attribute,
00447 // gcc 3.4.x reports the following compilation error:
00448 //   Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
00449 //    : function body not available
00450 #if EIGEN_GNUC_AT_LEAST(4,0)
00451 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
00452 #else
00453 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
00454 #endif
00455 
00456 #if EIGEN_COMP_GNUC
00457 #define EIGEN_DONT_INLINE __attribute__((noinline))
00458 #elif EIGEN_COMP_MSVC
00459 #define EIGEN_DONT_INLINE __declspec(noinline)
00460 #else
00461 #define EIGEN_DONT_INLINE
00462 #endif
00463 
00464 #if EIGEN_COMP_GNUC
00465 #define EIGEN_PERMISSIVE_EXPR __extension__
00466 #else
00467 #define EIGEN_PERMISSIVE_EXPR
00468 #endif
00469 
00470 // this macro allows to get rid of linking errors about multiply defined functions.
00471 //  - static is not very good because it prevents definitions from different object files to be merged.
00472 //           So static causes the resulting linked executable to be bloated with multiple copies of the same function.
00473 //  - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
00474 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
00475 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline
00476 
00477 #ifdef NDEBUG
00478 # ifndef EIGEN_NO_DEBUG
00479 #  define EIGEN_NO_DEBUG
00480 # endif
00481 #endif
00482 
00483 // eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89
00484 #ifdef EIGEN_NO_DEBUG
00485   #define eigen_plain_assert(x)
00486 #else
00487   #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
00488     namespace Eigen {
00489     namespace internal {
00490     inline bool copy_bool(bool b) { return b; }
00491     }
00492     }
00493     #define eigen_plain_assert(x) assert(x)
00494   #else
00495     // work around bug 89
00496     #include <cstdlib>   // for abort
00497     #include <iostream>  // for std::cerr
00498 
00499     namespace Eigen {
00500     namespace internal {
00501     // trivial function copying a bool. Must be EIGEN_DONT_INLINE, so we implement it after including Eigen headers.
00502     // see bug 89.
00503     namespace {
00504     EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; }
00505     }
00506     inline void assert_fail(const char *condition, const char *function, const char *file, int line)
00507     {
00508       std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
00509       abort();
00510     }
00511     }
00512     }
00513     #define eigen_plain_assert(x) \
00514       do { \
00515         if(!Eigen::internal::copy_bool(x)) \
00516           Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
00517       } while(false)
00518   #endif
00519 #endif
00520 
00521 // eigen_assert can be overridden
00522 #ifndef eigen_assert
00523 #define eigen_assert(x) eigen_plain_assert(x)
00524 #endif
00525 
00526 #ifdef EIGEN_INTERNAL_DEBUGGING
00527 #define eigen_internal_assert(x) eigen_assert(x)
00528 #else
00529 #define eigen_internal_assert(x)
00530 #endif
00531 
00532 #ifdef EIGEN_NO_DEBUG
00533 #define EIGEN_ONLY_USED_FOR_DEBUG(x) EIGEN_UNUSED_VARIABLE(x)
00534 #else
00535 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
00536 #endif
00537 
00538 #ifndef EIGEN_NO_DEPRECATED_WARNING
00539   #if EIGEN_COMP_GNUC
00540     #define EIGEN_DEPRECATED __attribute__((deprecated))
00541   #elif EIGEN_COMP_MSVC
00542     #define EIGEN_DEPRECATED __declspec(deprecated)
00543   #else
00544     #define EIGEN_DEPRECATED
00545   #endif
00546 #else
00547   #define EIGEN_DEPRECATED
00548 #endif
00549 
00550 #if EIGEN_COMP_GNUC
00551 #define EIGEN_UNUSED __attribute__((unused))
00552 #else
00553 #define EIGEN_UNUSED
00554 #endif
00555 
00556 // Suppresses 'unused variable' warnings.
00557 namespace Eigen {
00558   namespace internal {
00559     template<typename T> EIGEN_DEVICE_FUNC void ignore_unused_variable(const T&) {}
00560   }
00561 }
00562 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
00563 
00564 #if !defined(EIGEN_ASM_COMMENT)
00565   #if EIGEN_COMP_GNUC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64)
00566     #define EIGEN_ASM_COMMENT(X)  __asm__("#" X)
00567   #else
00568     #define EIGEN_ASM_COMMENT(X)
00569   #endif
00570 #endif
00571 
00572 
00573 //------------------------------------------------------------------------------------------
00574 // Static and dynamic alignment control
00575 // 
00576 // The main purpose of this section is to define EIGEN_MAX_ALIGN_BYTES and EIGEN_MAX_STATIC_ALIGN_BYTES
00577 // as the maximal boundary in bytes on which dynamically and statically allocated data may be alignment respectively.
00578 // The values of EIGEN_MAX_ALIGN_BYTES and EIGEN_MAX_STATIC_ALIGN_BYTES can be specified by the user. If not,
00579 // a default value is automatically computed based on architecture, compiler, and OS.
00580 // 
00581 // This section also defines macros EIGEN_ALIGN_TO_BOUNDARY(N) and the shortcuts EIGEN_ALIGN{8,16,32,_MAX}
00582 // to be used to declare statically aligned buffers.
00583 //------------------------------------------------------------------------------------------
00584 
00585 
00586 /* EIGEN_ALIGN_TO_BOUNDARY(n) forces data to be n-byte aligned. This is used to satisfy SIMD requirements.
00587  * However, we do that EVEN if vectorization (EIGEN_VECTORIZE) is disabled,
00588  * so that vectorization doesn't affect binary compatibility.
00589  *
00590  * If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link
00591  * vectorized and non-vectorized code.
00592  */
00593 #if (defined __CUDACC__)
00594   #define EIGEN_ALIGN_TO_BOUNDARY(n) __align__(n)
00595 #elif EIGEN_COMP_GNUC || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM
00596   #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00597 #elif EIGEN_COMP_MSVC
00598   #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n))
00599 #elif EIGEN_COMP_SUNCC
00600   // FIXME not sure about this one:
00601   #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n)))
00602 #else
00603   #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler
00604 #endif
00605 
00606 // If the user explicitly disable vectorization, then we also disable alignment
00607 #if defined(EIGEN_DONT_VECTORIZE)
00608   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 0
00609 #elif defined(__AVX__)
00610   // 32 bytes static alignmeent is preferred only if really required
00611   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 32
00612 #else
00613   #define EIGEN_IDEAL_MAX_ALIGN_BYTES 16
00614 #endif
00615 
00616 
00617 // EIGEN_MIN_ALIGN_BYTES defines the minimal value for which the notion of explicit alignment makes sense
00618 #define EIGEN_MIN_ALIGN_BYTES 16
00619 
00620 // Defined the boundary (in bytes) on which the data needs to be aligned. Note
00621 // that unless EIGEN_ALIGN is defined and not equal to 0, the data may not be
00622 // aligned at all regardless of the value of this #define.
00623 
00624 #if (defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN))  && defined(EIGEN_MAX_STATIC_ALIGN_BYTES) && EIGEN_MAX_STATIC_ALIGN_BYTES>0
00625 #error EIGEN_MAX_STATIC_ALIGN_BYTES and EIGEN_DONT_ALIGN[_STATICALLY] are both defined with EIGEN_MAX_STATIC_ALIGN_BYTES!=0. Use EIGEN_MAX_STATIC_ALIGN_BYTES=0 as a synonym of EIGEN_DONT_ALIGN_STATICALLY.
00626 #endif
00627 
00628 // EIGEN_DONT_ALIGN_STATICALLY and EIGEN_DONT_ALIGN are deprectated
00629 // They imply EIGEN_MAX_STATIC_ALIGN_BYTES=0
00630 #if defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN)
00631   #ifdef EIGEN_MAX_STATIC_ALIGN_BYTES
00632     #undef EIGEN_MAX_STATIC_ALIGN_BYTES
00633   #endif
00634   #define EIGEN_MAX_STATIC_ALIGN_BYTES 0
00635 #endif
00636 
00637 #ifndef EIGEN_MAX_STATIC_ALIGN_BYTES
00638 
00639   // Try to automatically guess what is the best default value for EIGEN_MAX_STATIC_ALIGN_BYTES
00640   
00641   // 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable
00642   // 16 byte alignment on all platforms where vectorization might be enabled. In theory we could always
00643   // enable alignment, but it can be a cause of problems on some platforms, so we just disable it in
00644   // certain common platform (compiler+architecture combinations) to avoid these problems.
00645   // Only static alignment is really problematic (relies on nonstandard compiler extensions),
00646   // try to keep heap alignment even when we have to disable static alignment.
00647   #if EIGEN_COMP_GNUC && !(EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64 || EIGEN_ARCH_PPC || EIGEN_ARCH_IA64)
00648   #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
00649   #elif EIGEN_ARCH_ARM_OR_ARM64 && EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_MOST(4, 6)
00650   // Old versions of GCC on ARM, at least 4.4, were once seen to have buggy static alignment support.
00651   // Not sure which version fixed it, hopefully it doesn't affect 4.7, which is still somewhat in use.
00652   // 4.8 and newer seem definitely unaffected.
00653   #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1
00654   #else
00655   #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0
00656   #endif
00657 
00658   // static alignment is completely disabled with GCC 3, Sun Studio, and QCC/QNX
00659   #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \
00660   && !EIGEN_GCC3_OR_OLDER \
00661   && !EIGEN_COMP_SUNCC \
00662   && !EIGEN_OS_QNX
00663     #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1
00664   #else
00665     #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0
00666   #endif
00667   
00668   #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT
00669     #define EIGEN_MAX_STATIC_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES
00670   #else
00671     #define EIGEN_MAX_STATIC_ALIGN_BYTES 0
00672   #endif
00673   
00674 #endif
00675 
00676 // If EIGEN_MAX_ALIGN_BYTES is defined, then it is considered as an upper bound for EIGEN_MAX_ALIGN_BYTES
00677 #if defined(EIGEN_MAX_ALIGN_BYTES) && EIGEN_MAX_ALIGN_BYTES<EIGEN_MAX_STATIC_ALIGN_BYTES
00678 #undef EIGEN_MAX_STATIC_ALIGN_BYTES
00679 #define EIGEN_MAX_STATIC_ALIGN_BYTES EIGEN_MAX_ALIGN_BYTES
00680 #endif
00681 
00682 #if EIGEN_MAX_STATIC_ALIGN_BYTES==0 && !defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
00683   #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
00684 #endif
00685 
00686 // At this stage, EIGEN_MAX_STATIC_ALIGN_BYTES>0 is the true test whether we want to align arrays on the stack or not.
00687 // It takes into account both the user choice to explicitly enable/disable alignment (by settting EIGEN_MAX_STATIC_ALIGN_BYTES)
00688 // and the architecture config (EIGEN_ARCH_WANTS_STACK_ALIGNMENT).
00689 // Henceforth, only EIGEN_MAX_STATIC_ALIGN_BYTES should be used.
00690 
00691 
00692 // Shortcuts to EIGEN_ALIGN_TO_BOUNDARY
00693 #define EIGEN_ALIGN8  EIGEN_ALIGN_TO_BOUNDARY(8)
00694 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16)
00695 #define EIGEN_ALIGN32 EIGEN_ALIGN_TO_BOUNDARY(32)
00696 #define EIGEN_ALIGN64 EIGEN_ALIGN_TO_BOUNDARY(64)
00697 #if EIGEN_MAX_STATIC_ALIGN_BYTES>0
00698 #define EIGEN_ALIGN_MAX EIGEN_ALIGN_TO_BOUNDARY(EIGEN_MAX_STATIC_ALIGN_BYTES)
00699 #else
00700 #define EIGEN_ALIGN_MAX
00701 #endif
00702 
00703 
00704 // Dynamic alignment control
00705 
00706 #if defined(EIGEN_DONT_ALIGN) && defined(EIGEN_MAX_ALIGN_BYTES) && EIGEN_MAX_ALIGN_BYTES>0
00707 #error EIGEN_MAX_ALIGN_BYTES and EIGEN_DONT_ALIGN are both defined with EIGEN_MAX_ALIGN_BYTES!=0. Use EIGEN_MAX_ALIGN_BYTES=0 as a synonym of EIGEN_DONT_ALIGN.
00708 #endif
00709 
00710 #ifdef EIGEN_DONT_ALIGN
00711   #ifdef EIGEN_MAX_ALIGN_BYTES
00712     #undef EIGEN_MAX_ALIGN_BYTES
00713   #endif
00714   #define EIGEN_MAX_ALIGN_BYTES 0
00715 #elif !defined(EIGEN_MAX_ALIGN_BYTES)
00716   #define EIGEN_MAX_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES
00717 #endif
00718 
00719 #if EIGEN_IDEAL_MAX_ALIGN_BYTES > EIGEN_MAX_ALIGN_BYTES
00720 #define EIGEN_DEFAULT_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES
00721 #else
00722 #define EIGEN_DEFAULT_ALIGN_BYTES EIGEN_MAX_ALIGN_BYTES
00723 #endif
00724 
00725 //----------------------------------------------------------------------
00726 
00727 
00728 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
00729   #define EIGEN_RESTRICT
00730 #endif
00731 #ifndef EIGEN_RESTRICT
00732   #define EIGEN_RESTRICT __restrict
00733 #endif
00734 
00735 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
00736 // 131072 == 128 KB
00737 #define EIGEN_STACK_ALLOCATION_LIMIT 131072
00738 #endif
00739 
00740 #ifndef EIGEN_DEFAULT_IO_FORMAT
00741 #ifdef EIGEN_MAKING_DOCS
00742 // format used in Eigen's documentation
00743 // needed to define it here as escaping characters in CMake add_definition's argument seems very problematic.
00744 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
00745 #else
00746 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
00747 #endif
00748 #endif
00749 
00750 // just an empty macro !
00751 #define EIGEN_EMPTY
00752 
00753 #if EIGEN_COMP_MSVC_STRICT && EIGEN_COMP_MSVC < 1900 // for older MSVC versions using the base operator is sufficient (cf Bug 1000)
00754   #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00755     using Base::operator =;
00756 #elif EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
00757   #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00758     using Base::operator =; \
00759     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
00760     template <typename OtherDerived> \
00761     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; }
00762 #else
00763   #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
00764     using Base::operator =; \
00765     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
00766     { \
00767       Base::operator=(other); \
00768       return *this; \
00769     }
00770 #endif
00771 
00772 
00777 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived)
00778 
00787 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
00788   typedef typename Eigen::internal::traits<Derived>::Scalar Scalar;  \
00789   typedef typename Eigen::NumTraits<Scalar>::Real RealScalar;  \
00790   typedef typename Base::CoeffReturnType CoeffReturnType;  \
00791   typedef typename Eigen::internal::ref_selector<Derived>::type Nested; \
00792   typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
00793   typedef typename Eigen::internal::traits<Derived>::StorageIndex StorageIndex; \
00794   enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
00795         ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
00796         Flags = Eigen::internal::traits<Derived>::Flags, \
00797         SizeAtCompileTime = Base::SizeAtCompileTime, \
00798         MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
00799         IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
00800   using Base::derived; \
00801   using Base::const_cast_derived;
00802 
00803 
00804 // FIXME Maybe the EIGEN_DENSE_PUBLIC_INTERFACE could be removed as importing PacketScalar is rarely needed
00805 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
00806   EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
00807   typedef typename Base::PacketScalar PacketScalar;
00808 
00809 
00810 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
00811 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
00812 
00813 // EIGEN_SIZE_MIN_PREFER_DYNAMIC gives the min between compile-time sizes. 0 has absolute priority, followed by 1,
00814 // followed by Dynamic, followed by other finite values. The reason for giving Dynamic the priority over
00815 // finite values is that min(3, Dynamic) should be Dynamic, since that could be anything between 0 and 3.
00816 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
00817                            : ((int)a == 1 || (int)b == 1) ? 1 \
00818                            : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00819                            : ((int)a <= (int)b) ? (int)a : (int)b)
00820 
00821 // EIGEN_SIZE_MIN_PREFER_FIXED is a variant of EIGEN_SIZE_MIN_PREFER_DYNAMIC comparing MaxSizes. The difference is that finite values
00822 // now have priority over Dynamic, so that min(3, Dynamic) gives 3. Indeed, whatever the actual value is
00823 // (between 0 and 3), it is not more than 3.
00824 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b)  (((int)a == 0 || (int)b == 0) ? 0 \
00825                            : ((int)a == 1 || (int)b == 1) ? 1 \
00826                            : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
00827                            : ((int)a == Dynamic) ? (int)b \
00828                            : ((int)b == Dynamic) ? (int)a \
00829                            : ((int)a <= (int)b) ? (int)a : (int)b)
00830 
00831 // see EIGEN_SIZE_MIN_PREFER_DYNAMIC. No need for a separate variant for MaxSizes here.
00832 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
00833                            : ((int)a >= (int)b) ? (int)a : (int)b)
00834 
00835 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
00836 
00837 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
00838 
00839 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,FUNCTOR) \
00840   template<typename OtherDerived> \
00841   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived> \
00842   (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
00843   { \
00844     return CwiseBinaryOp<FUNCTOR<Scalar>, const Derived, const OtherDerived>(derived(), other.derived()); \
00845   }
00846 
00847 // the expression type of a cwise product
00848 #define EIGEN_CWISE_PRODUCT_RETURN_TYPE(LHS,RHS) \
00849     CwiseBinaryOp< \
00850       internal::scalar_product_op< \
00851           typename internal::traits<LHS>::Scalar, \
00852           typename internal::traits<RHS>::Scalar \
00853       >, \
00854       const LHS, \
00855       const RHS \
00856     >
00857 
00858 #ifdef EIGEN_EXCEPTIONS
00859 #  define EIGEN_THROW_X(X) throw X
00860 #  define EIGEN_THROW throw
00861 #  define EIGEN_TRY try
00862 #  define EIGEN_CATCH(X) catch (X)
00863 #else
00864 #  ifdef __CUDA_ARCH__
00865 #    define EIGEN_THROW_X(X) asm("trap;") return {}
00866 #    define EIGEN_THROW asm("trap;"); return {}
00867 #  else
00868 #    define EIGEN_THROW_X(X) std::abort()
00869 #    define EIGEN_THROW std::abort()
00870 #  endif
00871 #  define EIGEN_TRY if (true)
00872 #  define EIGEN_CATCH(X) else
00873 #endif
00874 
00875 #if EIGEN_HAS_CXX11_NOEXCEPT
00876 #   define EIGEN_NO_THROW noexcept(true)
00877 #   define EIGEN_EXCEPTION_SPEC(X) noexcept(false)
00878 #else
00879 #   define EIGEN_NO_THROW throw()
00880 #   define EIGEN_EXCEPTION_SPEC(X) throw(X)
00881 #endif
00882 
00883 #endif // EIGEN_MACROS_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines