![]() |
Eigen
3.3.3
|
00001 // This file is part of Eigen, a lightweight C++ template library 00002 // for linear algebra. 00003 // 00004 // Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr> 00005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com> 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 3 00016 #define EIGEN_MINOR_VERSION 3 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 (__clang_major__*100+__clang_minor__) 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 00074 // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC: 00075 // name ver MSC_VER 00076 // 2008 9 1500 00077 // 2010 10 1600 00078 // 2012 11 1700 00079 // 2013 12 1800 00080 // 2015 14 1900 00081 // "15" 15 1900 00082 00084 #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG) 00085 #define EIGEN_COMP_MSVC_STRICT _MSC_VER 00086 #else 00087 #define EIGEN_COMP_MSVC_STRICT 0 00088 #endif 00089 00091 #if defined(__IBMCPP__) || defined(__xlc__) 00092 #define EIGEN_COMP_IBM 1 00093 #else 00094 #define EIGEN_COMP_IBM 0 00095 #endif 00096 00098 #if defined(__PGI) 00099 #define EIGEN_COMP_PGI 1 00100 #else 00101 #define EIGEN_COMP_PGI 0 00102 #endif 00103 00105 #if defined(__CC_ARM) || defined(__ARMCC_VERSION) 00106 #define EIGEN_COMP_ARM 1 00107 #else 00108 #define EIGEN_COMP_ARM 0 00109 #endif 00110 00112 #if defined(__EMSCRIPTEN__) 00113 #define EIGEN_COMP_EMSCRIPTEN 1 00114 #else 00115 #define EIGEN_COMP_EMSCRIPTEN 0 00116 #endif 00117 00118 00120 #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) 00121 #define EIGEN_COMP_GNUC_STRICT 1 00122 #else 00123 #define EIGEN_COMP_GNUC_STRICT 0 00124 #endif 00125 00126 00127 #if EIGEN_COMP_GNUC 00128 #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x) 00129 #define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x) 00130 #define EIGEN_GNUC_AT(x,y) ( __GNUC__==x && __GNUC_MINOR__==y ) 00131 #else 00132 #define EIGEN_GNUC_AT_LEAST(x,y) 0 00133 #define EIGEN_GNUC_AT_MOST(x,y) 0 00134 #define EIGEN_GNUC_AT(x,y) 0 00135 #endif 00136 00137 // FIXME: could probably be removed as we do not support gcc 3.x anymore 00138 #if EIGEN_COMP_GNUC && (__GNUC__ <= 3) 00139 #define EIGEN_GCC3_OR_OLDER 1 00140 #else 00141 #define EIGEN_GCC3_OR_OLDER 0 00142 #endif 00143 00144 00145 // Architecture identification, EIGEN_ARCH_* 00146 00147 #if defined(__x86_64__) || defined(_M_X64) || defined(__amd64) 00148 #define EIGEN_ARCH_x86_64 1 00149 #else 00150 #define EIGEN_ARCH_x86_64 0 00151 #endif 00152 00153 #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__i386) 00154 #define EIGEN_ARCH_i386 1 00155 #else 00156 #define EIGEN_ARCH_i386 0 00157 #endif 00158 00159 #if EIGEN_ARCH_x86_64 || EIGEN_ARCH_i386 00160 #define EIGEN_ARCH_i386_OR_x86_64 1 00161 #else 00162 #define EIGEN_ARCH_i386_OR_x86_64 0 00163 #endif 00164 00166 #if defined(__arm__) 00167 #define EIGEN_ARCH_ARM 1 00168 #else 00169 #define EIGEN_ARCH_ARM 0 00170 #endif 00171 00173 #if defined(__aarch64__) 00174 #define EIGEN_ARCH_ARM64 1 00175 #else 00176 #define EIGEN_ARCH_ARM64 0 00177 #endif 00178 00179 #if EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64 00180 #define EIGEN_ARCH_ARM_OR_ARM64 1 00181 #else 00182 #define EIGEN_ARCH_ARM_OR_ARM64 0 00183 #endif 00184 00186 #if defined(__mips__) || defined(__mips) 00187 #define EIGEN_ARCH_MIPS 1 00188 #else 00189 #define EIGEN_ARCH_MIPS 0 00190 #endif 00191 00193 #if defined(__sparc__) || defined(__sparc) 00194 #define EIGEN_ARCH_SPARC 1 00195 #else 00196 #define EIGEN_ARCH_SPARC 0 00197 #endif 00198 00200 #if defined(__ia64__) 00201 #define EIGEN_ARCH_IA64 1 00202 #else 00203 #define EIGEN_ARCH_IA64 0 00204 #endif 00205 00207 #if defined(__powerpc__) || defined(__ppc__) || defined(_M_PPC) 00208 #define EIGEN_ARCH_PPC 1 00209 #else 00210 #define EIGEN_ARCH_PPC 0 00211 #endif 00212 00213 00214 00215 // Operating system identification, EIGEN_OS_* 00216 00218 #if defined(__unix__) || defined(__unix) 00219 #define EIGEN_OS_UNIX 1 00220 #else 00221 #define EIGEN_OS_UNIX 0 00222 #endif 00223 00225 #if defined(__linux__) 00226 #define EIGEN_OS_LINUX 1 00227 #else 00228 #define EIGEN_OS_LINUX 0 00229 #endif 00230 00232 // note: ANDROID is defined when using ndk_build, __ANDROID__ is defined when using a standalone toolchain. 00233 #if defined(__ANDROID__) || defined(ANDROID) 00234 #define EIGEN_OS_ANDROID 1 00235 #else 00236 #define EIGEN_OS_ANDROID 0 00237 #endif 00238 00240 #if defined(__gnu_linux__) && !(EIGEN_OS_ANDROID) 00241 #define EIGEN_OS_GNULINUX 1 00242 #else 00243 #define EIGEN_OS_GNULINUX 0 00244 #endif 00245 00247 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__) 00248 #define EIGEN_OS_BSD 1 00249 #else 00250 #define EIGEN_OS_BSD 0 00251 #endif 00252 00254 #if defined(__APPLE__) 00255 #define EIGEN_OS_MAC 1 00256 #else 00257 #define EIGEN_OS_MAC 0 00258 #endif 00259 00261 #if defined(__QNX__) 00262 #define EIGEN_OS_QNX 1 00263 #else 00264 #define EIGEN_OS_QNX 0 00265 #endif 00266 00268 #if defined(_WIN32) 00269 #define EIGEN_OS_WIN 1 00270 #else 00271 #define EIGEN_OS_WIN 0 00272 #endif 00273 00275 #if defined(_WIN64) 00276 #define EIGEN_OS_WIN64 1 00277 #else 00278 #define EIGEN_OS_WIN64 0 00279 #endif 00280 00282 #if defined(_WIN32_WCE) 00283 #define EIGEN_OS_WINCE 1 00284 #else 00285 #define EIGEN_OS_WINCE 0 00286 #endif 00287 00289 #if defined(__CYGWIN__) 00290 #define EIGEN_OS_CYGWIN 1 00291 #else 00292 #define EIGEN_OS_CYGWIN 0 00293 #endif 00294 00296 #if EIGEN_OS_WIN && !( EIGEN_OS_WINCE || EIGEN_OS_CYGWIN ) 00297 #define EIGEN_OS_WIN_STRICT 1 00298 #else 00299 #define EIGEN_OS_WIN_STRICT 0 00300 #endif 00301 00303 #if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__)) 00304 #define EIGEN_OS_SUN 1 00305 #else 00306 #define EIGEN_OS_SUN 0 00307 #endif 00308 00310 #if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)) 00311 #define EIGEN_OS_SOLARIS 1 00312 #else 00313 #define EIGEN_OS_SOLARIS 0 00314 #endif 00315 00316 00317 00318 #if EIGEN_GNUC_AT_MOST(4,3) && !EIGEN_COMP_CLANG 00319 // see bug 89 00320 #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0 00321 #else 00322 #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1 00323 #endif 00324 00325 // This macro can be used to prevent from macro expansion, e.g.: 00326 // std::max EIGEN_NOT_A_MACRO(a,b) 00327 #define EIGEN_NOT_A_MACRO 00328 00329 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR 00330 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::RowMajor 00331 #else 00332 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::ColMajor 00333 #endif 00334 00335 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE 00336 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t 00337 #endif 00338 00339 // Cross compiler wrapper around LLVM's __has_builtin 00340 #ifdef __has_builtin 00341 # define EIGEN_HAS_BUILTIN(x) __has_builtin(x) 00342 #else 00343 # define EIGEN_HAS_BUILTIN(x) 0 00344 #endif 00345 00346 // A Clang feature extension to determine compiler features. 00347 // We use it to determine 'cxx_rvalue_references' 00348 #ifndef __has_feature 00349 # define __has_feature(x) 0 00350 #endif 00351 00352 // Upperbound on the C++ version to use. 00353 // Expected values are 03, 11, 14, 17, etc. 00354 // By default, let's use an arbitrarily large C++ version. 00355 #ifndef EIGEN_MAX_CPP_VER 00356 #define EIGEN_MAX_CPP_VER 99 00357 #endif 00358 00359 #if EIGEN_MAX_CPP_VER>=11 && (defined(__cplusplus) && (__cplusplus >= 201103L) || EIGEN_COMP_MSVC >= 1900) 00360 #define EIGEN_HAS_CXX11 1 00361 #else 00362 #define EIGEN_HAS_CXX11 0 00363 #endif 00364 00365 00366 // Do we support r-value references? 00367 #ifndef EIGEN_HAS_RVALUE_REFERENCES 00368 #if EIGEN_MAX_CPP_VER>=11 && \ 00369 (__has_feature(cxx_rvalue_references) || \ 00370 (defined(__cplusplus) && __cplusplus >= 201103L) || \ 00371 (EIGEN_COMP_MSVC >= 1600)) 00372 #define EIGEN_HAS_RVALUE_REFERENCES 1 00373 #else 00374 #define EIGEN_HAS_RVALUE_REFERENCES 0 00375 #endif 00376 #endif 00377 00378 // Does the compiler support C99? 00379 #ifndef EIGEN_HAS_C99_MATH 00380 #if EIGEN_MAX_CPP_VER>=11 && \ 00381 ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \ 00382 || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \ 00383 || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER))) 00384 #define EIGEN_HAS_C99_MATH 1 00385 #else 00386 #define EIGEN_HAS_C99_MATH 0 00387 #endif 00388 #endif 00389 00390 // Does the compiler support result_of? 00391 #ifndef EIGEN_HAS_STD_RESULT_OF 00392 #if EIGEN_MAX_CPP_VER>=11 && ((__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L))) 00393 #define EIGEN_HAS_STD_RESULT_OF 1 00394 #else 00395 #define EIGEN_HAS_STD_RESULT_OF 0 00396 #endif 00397 #endif 00398 00399 // Does the compiler support variadic templates? 00400 #ifndef EIGEN_HAS_VARIADIC_TEMPLATES 00401 #if EIGEN_MAX_CPP_VER>=11 && (__cplusplus > 199711L || EIGEN_COMP_MSVC >= 1900) \ 00402 && ( !defined(__NVCC__) || !EIGEN_ARCH_ARM_OR_ARM64 || (defined __CUDACC_VER__ && __CUDACC_VER__ >= 80000) ) 00403 // ^^ Disable the use of variadic templates when compiling with versions of nvcc older than 8.0 on ARM devices: 00404 // this prevents nvcc from crashing when compiling Eigen on Tegra X1 00405 #define EIGEN_HAS_VARIADIC_TEMPLATES 1 00406 #else 00407 #define EIGEN_HAS_VARIADIC_TEMPLATES 0 00408 #endif 00409 #endif 00410 00411 // Does the compiler fully support const expressions? (as in c++14) 00412 #ifndef EIGEN_HAS_CONSTEXPR 00413 00414 #ifdef __CUDACC__ 00415 // Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above 00416 #if EIGEN_MAX_CPP_VER>=14 && (__cplusplus > 199711L && defined(__CUDACC_VER__) && (EIGEN_COMP_CLANG || __CUDACC_VER__ >= 70500)) 00417 #define EIGEN_HAS_CONSTEXPR 1 00418 #endif 00419 #elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (defined(__cplusplus) && __cplusplus >= 201402L) || \ 00420 (EIGEN_GNUC_AT_LEAST(4,8) && (__cplusplus > 199711L))) 00421 #define EIGEN_HAS_CONSTEXPR 1 00422 #endif 00423 00424 #ifndef EIGEN_HAS_CONSTEXPR 00425 #define EIGEN_HAS_CONSTEXPR 0 00426 #endif 00427 00428 #endif 00429 00430 // Does the compiler support C++11 math? 00431 // Let's be conservative and enable the default C++11 implementation only if we are sure it exists 00432 #ifndef EIGEN_HAS_CXX11_MATH 00433 #if EIGEN_MAX_CPP_VER>=11 && ((__cplusplus > 201103L) || (__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC) \ 00434 && (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC)) 00435 #define EIGEN_HAS_CXX11_MATH 1 00436 #else 00437 #define EIGEN_HAS_CXX11_MATH 0 00438 #endif 00439 #endif 00440 00441 // Does the compiler support proper C++11 containers? 00442 #ifndef EIGEN_HAS_CXX11_CONTAINERS 00443 #if EIGEN_MAX_CPP_VER>=11 && \ 00444 ((__cplusplus > 201103L) \ 00445 || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \ 00446 || EIGEN_COMP_MSVC >= 1900) 00447 #define EIGEN_HAS_CXX11_CONTAINERS 1 00448 #else 00449 #define EIGEN_HAS_CXX11_CONTAINERS 0 00450 #endif 00451 #endif 00452 00453 // Does the compiler support C++11 noexcept? 00454 #ifndef EIGEN_HAS_CXX11_NOEXCEPT 00455 #if EIGEN_MAX_CPP_VER>=11 && \ 00456 (__has_feature(cxx_noexcept) \ 00457 || (__cplusplus > 201103L) \ 00458 || ((__cplusplus >= 201103L) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_ICC>=1400)) \ 00459 || EIGEN_COMP_MSVC >= 1900) 00460 #define EIGEN_HAS_CXX11_NOEXCEPT 1 00461 #else 00462 #define EIGEN_HAS_CXX11_NOEXCEPT 0 00463 #endif 00464 #endif 00465 00471 #ifndef EIGEN_FAST_MATH 00472 #define EIGEN_FAST_MATH 1 00473 #endif 00474 00475 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl; 00476 00477 // concatenate two tokens 00478 #define EIGEN_CAT2(a,b) a ## b 00479 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b) 00480 00481 #define EIGEN_COMMA , 00482 00483 // convert a token to a string 00484 #define EIGEN_MAKESTRING2(a) #a 00485 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a) 00486 00487 // EIGEN_STRONG_INLINE is a stronger version of the inline, using __forceinline on MSVC, 00488 // but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline 00489 // but GCC is still doing fine with just inline. 00490 #if EIGEN_COMP_MSVC || EIGEN_COMP_ICC 00491 #define EIGEN_STRONG_INLINE __forceinline 00492 #else 00493 #define EIGEN_STRONG_INLINE inline 00494 #endif 00495 00496 // EIGEN_ALWAYS_INLINE is the stronget, it has the effect of making the function inline and adding every possible 00497 // attribute to maximize inlining. This should only be used when really necessary: in particular, 00498 // it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times. 00499 // FIXME with the always_inline attribute, 00500 // gcc 3.4.x and 4.1 reports the following compilation error: 00501 // Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const' 00502 // : function body not available 00503 // See also bug 1367 00504 #if EIGEN_GNUC_AT_LEAST(4,2) 00505 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline 00506 #else 00507 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE 00508 #endif 00509 00510 #if EIGEN_COMP_GNUC 00511 #define EIGEN_DONT_INLINE __attribute__((noinline)) 00512 #elif EIGEN_COMP_MSVC 00513 #define EIGEN_DONT_INLINE __declspec(noinline) 00514 #else 00515 #define EIGEN_DONT_INLINE 00516 #endif 00517 00518 #if EIGEN_COMP_GNUC 00519 #define EIGEN_PERMISSIVE_EXPR __extension__ 00520 #else 00521 #define EIGEN_PERMISSIVE_EXPR 00522 #endif 00523 00524 // this macro allows to get rid of linking errors about multiply defined functions. 00525 // - static is not very good because it prevents definitions from different object files to be merged. 00526 // So static causes the resulting linked executable to be bloated with multiple copies of the same function. 00527 // - inline is not perfect either as it unwantedly hints the compiler toward inlining the function. 00528 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS 00529 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS inline 00530 00531 #ifdef NDEBUG 00532 # ifndef EIGEN_NO_DEBUG 00533 # define EIGEN_NO_DEBUG 00534 # endif 00535 #endif 00536 00537 // eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89 00538 #ifdef EIGEN_NO_DEBUG 00539 #define eigen_plain_assert(x) 00540 #else 00541 #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 00542 namespace Eigen { 00543 namespace internal { 00544 inline bool copy_bool(bool b) { return b; } 00545 } 00546 } 00547 #define eigen_plain_assert(x) assert(x) 00548 #else 00549 // work around bug 89 00550 #include <cstdlib> // for abort 00551 #include <iostream> // for std::cerr 00552 00553 namespace Eigen { 00554 namespace internal { 00555 // trivial function copying a bool. Must be EIGEN_DONT_INLINE, so we implement it after including Eigen headers. 00556 // see bug 89. 00557 namespace { 00558 EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; } 00559 } 00560 inline void assert_fail(const char *condition, const char *function, const char *file, int line) 00561 { 00562 std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl; 00563 abort(); 00564 } 00565 } 00566 } 00567 #define eigen_plain_assert(x) \ 00568 do { \ 00569 if(!Eigen::internal::copy_bool(x)) \ 00570 Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \ 00571 } while(false) 00572 #endif 00573 #endif 00574 00575 // eigen_assert can be overridden 00576 #ifndef eigen_assert 00577 #define eigen_assert(x) eigen_plain_assert(x) 00578 #endif 00579 00580 #ifdef EIGEN_INTERNAL_DEBUGGING 00581 #define eigen_internal_assert(x) eigen_assert(x) 00582 #else 00583 #define eigen_internal_assert(x) 00584 #endif 00585 00586 #ifdef EIGEN_NO_DEBUG 00587 #define EIGEN_ONLY_USED_FOR_DEBUG(x) EIGEN_UNUSED_VARIABLE(x) 00588 #else 00589 #define EIGEN_ONLY_USED_FOR_DEBUG(x) 00590 #endif 00591 00592 #ifndef EIGEN_NO_DEPRECATED_WARNING 00593 #if EIGEN_COMP_GNUC 00594 #define EIGEN_DEPRECATED __attribute__((deprecated)) 00595 #elif EIGEN_COMP_MSVC 00596 #define EIGEN_DEPRECATED __declspec(deprecated) 00597 #else 00598 #define EIGEN_DEPRECATED 00599 #endif 00600 #else 00601 #define EIGEN_DEPRECATED 00602 #endif 00603 00604 #if EIGEN_COMP_GNUC 00605 #define EIGEN_UNUSED __attribute__((unused)) 00606 #else 00607 #define EIGEN_UNUSED 00608 #endif 00609 00610 // Suppresses 'unused variable' warnings. 00611 namespace Eigen { 00612 namespace internal { 00613 template<typename T> EIGEN_DEVICE_FUNC void ignore_unused_variable(const T&) {} 00614 } 00615 } 00616 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var); 00617 00618 #if !defined(EIGEN_ASM_COMMENT) 00619 #if EIGEN_COMP_GNUC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64) 00620 #define EIGEN_ASM_COMMENT(X) __asm__("#" X) 00621 #else 00622 #define EIGEN_ASM_COMMENT(X) 00623 #endif 00624 #endif 00625 00626 00627 //------------------------------------------------------------------------------------------ 00628 // Static and dynamic alignment control 00629 // 00630 // The main purpose of this section is to define EIGEN_MAX_ALIGN_BYTES and EIGEN_MAX_STATIC_ALIGN_BYTES 00631 // as the maximal boundary in bytes on which dynamically and statically allocated data may be alignment respectively. 00632 // The values of EIGEN_MAX_ALIGN_BYTES and EIGEN_MAX_STATIC_ALIGN_BYTES can be specified by the user. If not, 00633 // a default value is automatically computed based on architecture, compiler, and OS. 00634 // 00635 // This section also defines macros EIGEN_ALIGN_TO_BOUNDARY(N) and the shortcuts EIGEN_ALIGN{8,16,32,_MAX} 00636 // to be used to declare statically aligned buffers. 00637 //------------------------------------------------------------------------------------------ 00638 00639 00640 /* EIGEN_ALIGN_TO_BOUNDARY(n) forces data to be n-byte aligned. This is used to satisfy SIMD requirements. 00641 * However, we do that EVEN if vectorization (EIGEN_VECTORIZE) is disabled, 00642 * so that vectorization doesn't affect binary compatibility. 00643 * 00644 * If we made alignment depend on whether or not EIGEN_VECTORIZE is defined, it would be impossible to link 00645 * vectorized and non-vectorized code. 00646 */ 00647 #if (defined __CUDACC__) 00648 #define EIGEN_ALIGN_TO_BOUNDARY(n) __align__(n) 00649 #elif EIGEN_COMP_GNUC || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM 00650 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n))) 00651 #elif EIGEN_COMP_MSVC 00652 #define EIGEN_ALIGN_TO_BOUNDARY(n) __declspec(align(n)) 00653 #elif EIGEN_COMP_SUNCC 00654 // FIXME not sure about this one: 00655 #define EIGEN_ALIGN_TO_BOUNDARY(n) __attribute__((aligned(n))) 00656 #else 00657 #error Please tell me what is the equivalent of __attribute__((aligned(n))) for your compiler 00658 #endif 00659 00660 // If the user explicitly disable vectorization, then we also disable alignment 00661 #if defined(EIGEN_DONT_VECTORIZE) 00662 #define EIGEN_IDEAL_MAX_ALIGN_BYTES 0 00663 #elif defined(EIGEN_VECTORIZE_AVX512) 00664 // 64 bytes static alignmeent is preferred only if really required 00665 #define EIGEN_IDEAL_MAX_ALIGN_BYTES 64 00666 #elif defined(__AVX__) 00667 // 32 bytes static alignmeent is preferred only if really required 00668 #define EIGEN_IDEAL_MAX_ALIGN_BYTES 32 00669 #else 00670 #define EIGEN_IDEAL_MAX_ALIGN_BYTES 16 00671 #endif 00672 00673 00674 // EIGEN_MIN_ALIGN_BYTES defines the minimal value for which the notion of explicit alignment makes sense 00675 #define EIGEN_MIN_ALIGN_BYTES 16 00676 00677 // Defined the boundary (in bytes) on which the data needs to be aligned. Note 00678 // that unless EIGEN_ALIGN is defined and not equal to 0, the data may not be 00679 // aligned at all regardless of the value of this #define. 00680 00681 #if (defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN)) && defined(EIGEN_MAX_STATIC_ALIGN_BYTES) && EIGEN_MAX_STATIC_ALIGN_BYTES>0 00682 #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. 00683 #endif 00684 00685 // EIGEN_DONT_ALIGN_STATICALLY and EIGEN_DONT_ALIGN are deprectated 00686 // They imply EIGEN_MAX_STATIC_ALIGN_BYTES=0 00687 #if defined(EIGEN_DONT_ALIGN_STATICALLY) || defined(EIGEN_DONT_ALIGN) 00688 #ifdef EIGEN_MAX_STATIC_ALIGN_BYTES 00689 #undef EIGEN_MAX_STATIC_ALIGN_BYTES 00690 #endif 00691 #define EIGEN_MAX_STATIC_ALIGN_BYTES 0 00692 #endif 00693 00694 #ifndef EIGEN_MAX_STATIC_ALIGN_BYTES 00695 00696 // Try to automatically guess what is the best default value for EIGEN_MAX_STATIC_ALIGN_BYTES 00697 00698 // 16 byte alignment is only useful for vectorization. Since it affects the ABI, we need to enable 00699 // 16 byte alignment on all platforms where vectorization might be enabled. In theory we could always 00700 // enable alignment, but it can be a cause of problems on some platforms, so we just disable it in 00701 // certain common platform (compiler+architecture combinations) to avoid these problems. 00702 // Only static alignment is really problematic (relies on nonstandard compiler extensions), 00703 // try to keep heap alignment even when we have to disable static alignment. 00704 #if EIGEN_COMP_GNUC && !(EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64 || EIGEN_ARCH_PPC || EIGEN_ARCH_IA64) 00705 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1 00706 #elif EIGEN_ARCH_ARM_OR_ARM64 && EIGEN_COMP_GNUC_STRICT && EIGEN_GNUC_AT_MOST(4, 6) 00707 // Old versions of GCC on ARM, at least 4.4, were once seen to have buggy static alignment support. 00708 // Not sure which version fixed it, hopefully it doesn't affect 4.7, which is still somewhat in use. 00709 // 4.8 and newer seem definitely unaffected. 00710 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 1 00711 #else 00712 #define EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT 0 00713 #endif 00714 00715 // static alignment is completely disabled with GCC 3, Sun Studio, and QCC/QNX 00716 #if !EIGEN_GCC_AND_ARCH_DOESNT_WANT_STACK_ALIGNMENT \ 00717 && !EIGEN_GCC3_OR_OLDER \ 00718 && !EIGEN_COMP_SUNCC \ 00719 && !EIGEN_OS_QNX 00720 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 1 00721 #else 00722 #define EIGEN_ARCH_WANTS_STACK_ALIGNMENT 0 00723 #endif 00724 00725 #if EIGEN_ARCH_WANTS_STACK_ALIGNMENT 00726 #define EIGEN_MAX_STATIC_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES 00727 #else 00728 #define EIGEN_MAX_STATIC_ALIGN_BYTES 0 00729 #endif 00730 00731 #endif 00732 00733 // If EIGEN_MAX_ALIGN_BYTES is defined, then it is considered as an upper bound for EIGEN_MAX_ALIGN_BYTES 00734 #if defined(EIGEN_MAX_ALIGN_BYTES) && EIGEN_MAX_ALIGN_BYTES<EIGEN_MAX_STATIC_ALIGN_BYTES 00735 #undef EIGEN_MAX_STATIC_ALIGN_BYTES 00736 #define EIGEN_MAX_STATIC_ALIGN_BYTES EIGEN_MAX_ALIGN_BYTES 00737 #endif 00738 00739 #if EIGEN_MAX_STATIC_ALIGN_BYTES==0 && !defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) 00740 #define EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT 00741 #endif 00742 00743 // At this stage, EIGEN_MAX_STATIC_ALIGN_BYTES>0 is the true test whether we want to align arrays on the stack or not. 00744 // It takes into account both the user choice to explicitly enable/disable alignment (by settting EIGEN_MAX_STATIC_ALIGN_BYTES) 00745 // and the architecture config (EIGEN_ARCH_WANTS_STACK_ALIGNMENT). 00746 // Henceforth, only EIGEN_MAX_STATIC_ALIGN_BYTES should be used. 00747 00748 00749 // Shortcuts to EIGEN_ALIGN_TO_BOUNDARY 00750 #define EIGEN_ALIGN8 EIGEN_ALIGN_TO_BOUNDARY(8) 00751 #define EIGEN_ALIGN16 EIGEN_ALIGN_TO_BOUNDARY(16) 00752 #define EIGEN_ALIGN32 EIGEN_ALIGN_TO_BOUNDARY(32) 00753 #define EIGEN_ALIGN64 EIGEN_ALIGN_TO_BOUNDARY(64) 00754 #if EIGEN_MAX_STATIC_ALIGN_BYTES>0 00755 #define EIGEN_ALIGN_MAX EIGEN_ALIGN_TO_BOUNDARY(EIGEN_MAX_STATIC_ALIGN_BYTES) 00756 #else 00757 #define EIGEN_ALIGN_MAX 00758 #endif 00759 00760 00761 // Dynamic alignment control 00762 00763 #if defined(EIGEN_DONT_ALIGN) && defined(EIGEN_MAX_ALIGN_BYTES) && EIGEN_MAX_ALIGN_BYTES>0 00764 #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. 00765 #endif 00766 00767 #ifdef EIGEN_DONT_ALIGN 00768 #ifdef EIGEN_MAX_ALIGN_BYTES 00769 #undef EIGEN_MAX_ALIGN_BYTES 00770 #endif 00771 #define EIGEN_MAX_ALIGN_BYTES 0 00772 #elif !defined(EIGEN_MAX_ALIGN_BYTES) 00773 #define EIGEN_MAX_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES 00774 #endif 00775 00776 #if EIGEN_IDEAL_MAX_ALIGN_BYTES > EIGEN_MAX_ALIGN_BYTES 00777 #define EIGEN_DEFAULT_ALIGN_BYTES EIGEN_IDEAL_MAX_ALIGN_BYTES 00778 #else 00779 #define EIGEN_DEFAULT_ALIGN_BYTES EIGEN_MAX_ALIGN_BYTES 00780 #endif 00781 00782 00783 #ifndef EIGEN_UNALIGNED_VECTORIZE 00784 #define EIGEN_UNALIGNED_VECTORIZE 1 00785 #endif 00786 00787 //---------------------------------------------------------------------- 00788 00789 00790 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD 00791 #define EIGEN_RESTRICT 00792 #endif 00793 #ifndef EIGEN_RESTRICT 00794 #define EIGEN_RESTRICT __restrict 00795 #endif 00796 00797 #ifndef EIGEN_STACK_ALLOCATION_LIMIT 00798 // 131072 == 128 KB 00799 #define EIGEN_STACK_ALLOCATION_LIMIT 131072 00800 #endif 00801 00802 #ifndef EIGEN_DEFAULT_IO_FORMAT 00803 #ifdef EIGEN_MAKING_DOCS 00804 // format used in Eigen's documentation 00805 // needed to define it here as escaping characters in CMake add_definition's argument seems very problematic. 00806 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "") 00807 #else 00808 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat() 00809 #endif 00810 #endif 00811 00812 // just an empty macro ! 00813 #define EIGEN_EMPTY 00814 00815 #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC < 1900 || defined(__CUDACC_VER__)) // for older MSVC versions, as well as 1900 && CUDA 8, using the base operator is sufficient (cf Bugs 1000, 1324) 00816 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ 00817 using Base::operator =; 00818 #elif EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653) 00819 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ 00820 using Base::operator =; \ 00821 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \ 00822 template <typename OtherDerived> \ 00823 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; } 00824 #else 00825 #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \ 00826 using Base::operator =; \ 00827 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \ 00828 { \ 00829 Base::operator=(other); \ 00830 return *this; \ 00831 } 00832 #endif 00833 00834 00839 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) 00840 00849 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ 00850 typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \ 00851 typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \ 00852 typedef typename Base::CoeffReturnType CoeffReturnType; \ 00853 typedef typename Eigen::internal::ref_selector<Derived>::type Nested; \ 00854 typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \ 00855 typedef typename Eigen::internal::traits<Derived>::StorageIndex StorageIndex; \ 00856 enum { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \ 00857 ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \ 00858 Flags = Eigen::internal::traits<Derived>::Flags, \ 00859 SizeAtCompileTime = Base::SizeAtCompileTime, \ 00860 MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \ 00861 IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \ 00862 using Base::derived; \ 00863 using Base::const_cast_derived; 00864 00865 00866 // FIXME Maybe the EIGEN_DENSE_PUBLIC_INTERFACE could be removed as importing PacketScalar is rarely needed 00867 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ 00868 EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \ 00869 typedef typename Base::PacketScalar PacketScalar; 00870 00871 00872 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b) 00873 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b) 00874 00875 // EIGEN_SIZE_MIN_PREFER_DYNAMIC gives the min between compile-time sizes. 0 has absolute priority, followed by 1, 00876 // followed by Dynamic, followed by other finite values. The reason for giving Dynamic the priority over 00877 // finite values is that min(3, Dynamic) should be Dynamic, since that could be anything between 0 and 3. 00878 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \ 00879 : ((int)a == 1 || (int)b == 1) ? 1 \ 00880 : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \ 00881 : ((int)a <= (int)b) ? (int)a : (int)b) 00882 00883 // EIGEN_SIZE_MIN_PREFER_FIXED is a variant of EIGEN_SIZE_MIN_PREFER_DYNAMIC comparing MaxSizes. The difference is that finite values 00884 // now have priority over Dynamic, so that min(3, Dynamic) gives 3. Indeed, whatever the actual value is 00885 // (between 0 and 3), it is not more than 3. 00886 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b) (((int)a == 0 || (int)b == 0) ? 0 \ 00887 : ((int)a == 1 || (int)b == 1) ? 1 \ 00888 : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \ 00889 : ((int)a == Dynamic) ? (int)b \ 00890 : ((int)b == Dynamic) ? (int)a \ 00891 : ((int)a <= (int)b) ? (int)a : (int)b) 00892 00893 // see EIGEN_SIZE_MIN_PREFER_DYNAMIC. No need for a separate variant for MaxSizes here. 00894 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \ 00895 : ((int)a >= (int)b) ? (int)a : (int)b) 00896 00897 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b))) 00898 00899 #define EIGEN_IMPLIES(a,b) (!(a) || (b)) 00900 00901 // the expression type of a standard coefficient wise binary operation 00902 #define EIGEN_CWISE_BINARY_RETURN_TYPE(LHS,RHS,OPNAME) \ 00903 CwiseBinaryOp< \ 00904 EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)< \ 00905 typename internal::traits<LHS>::Scalar, \ 00906 typename internal::traits<RHS>::Scalar \ 00907 >, \ 00908 const LHS, \ 00909 const RHS \ 00910 > 00911 00912 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,OPNAME) \ 00913 template<typename OtherDerived> \ 00914 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,OPNAME) \ 00915 (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \ 00916 { \ 00917 return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,OPNAME)(derived(), other.derived()); \ 00918 } 00919 00920 #define EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,TYPEA,TYPEB) \ 00921 (Eigen::internal::has_ReturnType<Eigen::ScalarBinaryOpTraits<TYPEA,TYPEB,EIGEN_CAT(EIGEN_CAT(Eigen::internal::scalar_,OPNAME),_op)<TYPEA,TYPEB> > >::value) 00922 00923 #define EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(EXPR,SCALAR,OPNAME) \ 00924 CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<typename internal::traits<EXPR>::Scalar,SCALAR>, const EXPR, \ 00925 const typename internal::plain_constant_type<EXPR,SCALAR>::type> 00926 00927 #define EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(SCALAR,EXPR,OPNAME) \ 00928 CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<SCALAR,typename internal::traits<EXPR>::Scalar>, \ 00929 const typename internal::plain_constant_type<EXPR,SCALAR>::type, const EXPR> 00930 00931 // Workaround for MSVC 2010 (see ML thread "patch with compile for for MSVC 2010") 00932 #if EIGEN_COMP_MSVC_STRICT<=1600 00933 #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) typename internal::enable_if<true,X>::type 00934 #else 00935 #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) X 00936 #endif 00937 00938 #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) \ 00939 template <typename T> EIGEN_DEVICE_FUNC inline \ 00940 EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type,OPNAME))\ 00941 (METHOD)(const T& scalar) const { \ 00942 typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type PromotedT; \ 00943 return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedT,OPNAME)(derived(), \ 00944 typename internal::plain_constant_type<Derived,PromotedT>::type(derived().rows(), derived().cols(), internal::scalar_constant_op<PromotedT>(scalar))); \ 00945 } 00946 00947 #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \ 00948 template <typename T> EIGEN_DEVICE_FUNC inline friend \ 00949 EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg<Scalar EIGEN_COMMA T EIGEN_COMMA EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type,Derived,OPNAME)) \ 00950 (METHOD)(const T& scalar, const StorageBaseType& matrix) { \ 00951 typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type PromotedT; \ 00952 return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedT,Derived,OPNAME)( \ 00953 typename internal::plain_constant_type<Derived,PromotedT>::type(matrix.derived().rows(), matrix.derived().cols(), internal::scalar_constant_op<PromotedT>(scalar)), matrix.derived()); \ 00954 } 00955 00956 #define EIGEN_MAKE_SCALAR_BINARY_OP(METHOD,OPNAME) \ 00957 EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \ 00958 EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) 00959 00960 00961 #ifdef EIGEN_EXCEPTIONS 00962 # define EIGEN_THROW_X(X) throw X 00963 # define EIGEN_THROW throw 00964 # define EIGEN_TRY try 00965 # define EIGEN_CATCH(X) catch (X) 00966 #else 00967 # ifdef __CUDA_ARCH__ 00968 # define EIGEN_THROW_X(X) asm("trap;") 00969 # define EIGEN_THROW asm("trap;") 00970 # else 00971 # define EIGEN_THROW_X(X) std::abort() 00972 # define EIGEN_THROW std::abort() 00973 # endif 00974 # define EIGEN_TRY if (true) 00975 # define EIGEN_CATCH(X) else 00976 #endif 00977 00978 00979 #if EIGEN_HAS_CXX11_NOEXCEPT 00980 # define EIGEN_INCLUDE_TYPE_TRAITS 00981 # define EIGEN_NOEXCEPT noexcept 00982 # define EIGEN_NOEXCEPT_IF(x) noexcept(x) 00983 # define EIGEN_NO_THROW noexcept(true) 00984 # define EIGEN_EXCEPTION_SPEC(X) noexcept(false) 00985 #else 00986 # define EIGEN_NOEXCEPT 00987 # define EIGEN_NOEXCEPT_IF(x) 00988 # define EIGEN_NO_THROW throw() 00989 # define EIGEN_EXCEPTION_SPEC(X) throw(X) 00990 #endif 00991 00992 #endif // EIGEN_MACROS_H