Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/eigen3/Eigen/src/Core/util/Macros.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>
0005 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
0006 //
0007 // This Source Code Form is subject to the terms of the Mozilla
0008 // Public License v. 2.0. If a copy of the MPL was not distributed
0009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0010 
0011 #ifndef EIGEN_MACROS_H
0012 #define EIGEN_MACROS_H
0013 
0014 //------------------------------------------------------------------------------------------
0015 // Eigen version and basic defaults
0016 //------------------------------------------------------------------------------------------
0017 
0018 #define EIGEN_WORLD_VERSION 3
0019 #define EIGEN_MAJOR_VERSION 4
0020 #define EIGEN_MINOR_VERSION 0
0021 
0022 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
0023                                       (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
0024                                                                  EIGEN_MINOR_VERSION>=z))))
0025 
0026 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
0027 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::RowMajor
0028 #else
0029 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::ColMajor
0030 #endif
0031 
0032 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
0033 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
0034 #endif
0035 
0036 // Upperbound on the C++ version to use.
0037 // Expected values are 03, 11, 14, 17, etc.
0038 // By default, let's use an arbitrarily large C++ version.
0039 #ifndef EIGEN_MAX_CPP_VER
0040 #define EIGEN_MAX_CPP_VER 99
0041 #endif
0042 
0043 /** Allows to disable some optimizations which might affect the accuracy of the result.
0044   * Such optimization are enabled by default, and set EIGEN_FAST_MATH to 0 to disable them.
0045   * They currently include:
0046   *   - single precision ArrayBase::sin() and ArrayBase::cos() for SSE and AVX vectorization.
0047   */
0048 #ifndef EIGEN_FAST_MATH
0049 #define EIGEN_FAST_MATH 1
0050 #endif
0051 
0052 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
0053 // 131072 == 128 KB
0054 #define EIGEN_STACK_ALLOCATION_LIMIT 131072
0055 #endif
0056 
0057 //------------------------------------------------------------------------------------------
0058 // Compiler identification, EIGEN_COMP_*
0059 //------------------------------------------------------------------------------------------
0060 
0061 /// \internal EIGEN_COMP_GNUC set to 1 for all compilers compatible with GCC
0062 #ifdef __GNUC__
0063   #define EIGEN_COMP_GNUC (__GNUC__*10+__GNUC_MINOR__)
0064 #else
0065   #define EIGEN_COMP_GNUC 0
0066 #endif
0067 
0068 /// \internal EIGEN_COMP_CLANG set to major+minor version (e.g., 307 for clang 3.7) if the compiler is clang
0069 #if defined(__clang__)
0070   #define EIGEN_COMP_CLANG (__clang_major__*100+__clang_minor__)
0071 #else
0072   #define EIGEN_COMP_CLANG 0
0073 #endif
0074 
0075 /// \internal EIGEN_COMP_CASTXML set to 1 if being preprocessed by CastXML
0076 #if defined(__castxml__)
0077   #define EIGEN_COMP_CASTXML 1
0078 #else
0079   #define EIGEN_COMP_CASTXML 0
0080 #endif
0081 
0082 /// \internal EIGEN_COMP_LLVM set to 1 if the compiler backend is llvm
0083 #if defined(__llvm__)
0084   #define EIGEN_COMP_LLVM 1
0085 #else
0086   #define EIGEN_COMP_LLVM 0
0087 #endif
0088 
0089 /// \internal EIGEN_COMP_ICC set to __INTEL_COMPILER if the compiler is Intel compiler, 0 otherwise
0090 #if defined(__INTEL_COMPILER)
0091   #define EIGEN_COMP_ICC __INTEL_COMPILER
0092 #else
0093   #define EIGEN_COMP_ICC 0
0094 #endif
0095 
0096 /// \internal EIGEN_COMP_MINGW set to 1 if the compiler is mingw
0097 #if defined(__MINGW32__)
0098   #define EIGEN_COMP_MINGW 1
0099 #else
0100   #define EIGEN_COMP_MINGW 0
0101 #endif
0102 
0103 /// \internal EIGEN_COMP_SUNCC set to 1 if the compiler is Solaris Studio
0104 #if defined(__SUNPRO_CC)
0105   #define EIGEN_COMP_SUNCC 1
0106 #else
0107   #define EIGEN_COMP_SUNCC 0
0108 #endif
0109 
0110 /// \internal EIGEN_COMP_MSVC set to _MSC_VER if the compiler is Microsoft Visual C++, 0 otherwise.
0111 #if defined(_MSC_VER)
0112   #define EIGEN_COMP_MSVC _MSC_VER
0113 #else
0114   #define EIGEN_COMP_MSVC 0
0115 #endif
0116 
0117 #if defined(__NVCC__)
0118 #if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
0119   #define EIGEN_COMP_NVCC  ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
0120 #elif defined(__CUDACC_VER__)
0121   #define EIGEN_COMP_NVCC __CUDACC_VER__
0122 #else
0123   #error "NVCC did not define compiler version."
0124 #endif
0125 #else
0126   #define EIGEN_COMP_NVCC 0
0127 #endif
0128 
0129 // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC:
0130 //  name        ver   MSC_VER
0131 //  2008         9      1500
0132 //  2010        10      1600
0133 //  2012        11      1700
0134 //  2013        12      1800
0135 //  2015        14      1900
0136 //  "15"        15      1900
0137 //  2017-14.1   15.0    1910
0138 //  2017-14.11  15.3    1911
0139 //  2017-14.12  15.5    1912
0140 //  2017-14.13  15.6    1913
0141 //  2017-14.14  15.7    1914
0142 
0143 /// \internal EIGEN_COMP_MSVC_LANG set to _MSVC_LANG if the compiler is Microsoft Visual C++, 0 otherwise.
0144 #if defined(_MSVC_LANG)
0145   #define EIGEN_COMP_MSVC_LANG _MSVC_LANG
0146 #else
0147   #define EIGEN_COMP_MSVC_LANG 0
0148 #endif
0149 
0150 // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC_LANG:
0151 // MSVC option                          Standard  MSVC_LANG
0152 // /std:c++14 (default as of VS 2019)   C++14     201402L
0153 // /std:c++17                           C++17     201703L
0154 // /std:c++latest                       >C++17    >201703L
0155 
0156 /// \internal EIGEN_COMP_MSVC_STRICT set to 1 if the compiler is really Microsoft Visual C++ and not ,e.g., ICC or clang-cl
0157 #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG)
0158   #define EIGEN_COMP_MSVC_STRICT _MSC_VER
0159 #else
0160   #define EIGEN_COMP_MSVC_STRICT 0
0161 #endif
0162 
0163 /// \internal EIGEN_COMP_IBM set to xlc version if the compiler is IBM XL C++
0164 // XLC   version
0165 // 3.1   0x0301
0166 // 4.5   0x0405
0167 // 5.0   0x0500
0168 // 12.1  0x0C01
0169 #if defined(__IBMCPP__) || defined(__xlc__) || defined(__ibmxl__)
0170   #define EIGEN_COMP_IBM __xlC__
0171 #else
0172   #define EIGEN_COMP_IBM 0
0173 #endif
0174 
0175 /// \internal EIGEN_COMP_PGI set to PGI version if the compiler is Portland Group Compiler
0176 #if defined(__PGI)
0177   #define EIGEN_COMP_PGI (__PGIC__*100+__PGIC_MINOR__)
0178 #else
0179   #define EIGEN_COMP_PGI 0
0180 #endif
0181 
0182 /// \internal EIGEN_COMP_ARM set to 1 if the compiler is ARM Compiler
0183 #if defined(__CC_ARM) || defined(__ARMCC_VERSION)
0184   #define EIGEN_COMP_ARM 1
0185 #else
0186   #define EIGEN_COMP_ARM 0
0187 #endif
0188 
0189 /// \internal EIGEN_COMP_EMSCRIPTEN set to 1 if the compiler is Emscripten Compiler
0190 #if defined(__EMSCRIPTEN__)
0191   #define EIGEN_COMP_EMSCRIPTEN 1
0192 #else
0193   #define EIGEN_COMP_EMSCRIPTEN 0
0194 #endif
0195 
0196 
0197 /// \internal EIGEN_GNUC_STRICT set to 1 if the compiler is really GCC and not a compatible compiler (e.g., ICC, clang, mingw, etc.)
0198 #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)
0199   #define EIGEN_COMP_GNUC_STRICT 1
0200 #else
0201   #define EIGEN_COMP_GNUC_STRICT 0
0202 #endif
0203 
0204 
0205 #if EIGEN_COMP_GNUC
0206   #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
0207   #define EIGEN_GNUC_AT_MOST(x,y)  ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
0208   #define EIGEN_GNUC_AT(x,y)       ( __GNUC__==x && __GNUC_MINOR__==y )
0209 #else
0210   #define EIGEN_GNUC_AT_LEAST(x,y) 0
0211   #define EIGEN_GNUC_AT_MOST(x,y)  0
0212   #define EIGEN_GNUC_AT(x,y)       0
0213 #endif
0214 
0215 // FIXME: could probably be removed as we do not support gcc 3.x anymore
0216 #if EIGEN_COMP_GNUC && (__GNUC__ <= 3)
0217 #define EIGEN_GCC3_OR_OLDER 1
0218 #else
0219 #define EIGEN_GCC3_OR_OLDER 0
0220 #endif
0221 
0222 
0223 
0224 //------------------------------------------------------------------------------------------
0225 // Architecture identification, EIGEN_ARCH_*
0226 //------------------------------------------------------------------------------------------
0227 
0228 
0229 #if defined(__x86_64__) || (defined(_M_X64) && !defined(_M_ARM64EC)) || defined(__amd64)
0230   #define EIGEN_ARCH_x86_64 1
0231 #else
0232   #define EIGEN_ARCH_x86_64 0
0233 #endif
0234 
0235 #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__i386)
0236   #define EIGEN_ARCH_i386 1
0237 #else
0238   #define EIGEN_ARCH_i386 0
0239 #endif
0240 
0241 #if EIGEN_ARCH_x86_64 || EIGEN_ARCH_i386
0242   #define EIGEN_ARCH_i386_OR_x86_64 1
0243 #else
0244   #define EIGEN_ARCH_i386_OR_x86_64 0
0245 #endif
0246 
0247 /// \internal EIGEN_ARCH_ARM set to 1 if the architecture is ARM
0248 #if defined(__arm__)
0249   #define EIGEN_ARCH_ARM 1
0250 #else
0251   #define EIGEN_ARCH_ARM 0
0252 #endif
0253 
0254 /// \internal EIGEN_ARCH_ARM64 set to 1 if the architecture is ARM64
0255 #if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
0256   #define EIGEN_ARCH_ARM64 1
0257 #else
0258   #define EIGEN_ARCH_ARM64 0
0259 #endif
0260 
0261 /// \internal EIGEN_ARCH_ARM_OR_ARM64 set to 1 if the architecture is ARM or ARM64
0262 #if EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64
0263   #define EIGEN_ARCH_ARM_OR_ARM64 1
0264 #else
0265   #define EIGEN_ARCH_ARM_OR_ARM64 0
0266 #endif
0267 
0268 /// \internal EIGEN_ARCH_ARMV8 set to 1 if the architecture is armv8 or greater.
0269 #if EIGEN_ARCH_ARM_OR_ARM64 && defined(__ARM_ARCH) && __ARM_ARCH >= 8
0270 #define EIGEN_ARCH_ARMV8 1
0271 #else
0272 #define EIGEN_ARCH_ARMV8 0
0273 #endif
0274 
0275 
0276 /// \internal EIGEN_HAS_ARM64_FP16 set to 1 if the architecture provides an IEEE
0277 /// compliant Arm fp16 type
0278 #if EIGEN_ARCH_ARM64
0279   #ifndef EIGEN_HAS_ARM64_FP16
0280     #if defined(__ARM_FP16_FORMAT_IEEE)
0281       #define EIGEN_HAS_ARM64_FP16 1
0282     #else
0283       #define EIGEN_HAS_ARM64_FP16 0
0284     #endif
0285   #endif
0286 #endif
0287 
0288 /// \internal EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC set to 1 if the architecture
0289 /// supports Neon vector intrinsics for fp16.
0290 #if EIGEN_ARCH_ARM64
0291   #ifndef EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
0292     #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
0293       #define EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 1
0294     #else
0295       #define EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 0
0296     #endif
0297   #endif
0298 #endif
0299 
0300 /// \internal EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC set to 1 if the architecture
0301 /// supports Neon scalar intrinsics for fp16.
0302 #if EIGEN_ARCH_ARM64
0303   #ifndef EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC
0304     #if defined(__ARM_FEATURE_FP16_SCALAR_ARITHMETIC)
0305       #define EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC 1
0306     #endif
0307   #endif
0308 #endif
0309 
0310 /// \internal EIGEN_ARCH_MIPS set to 1 if the architecture is MIPS
0311 #if defined(__mips__) || defined(__mips)
0312   #define EIGEN_ARCH_MIPS 1
0313 #else
0314   #define EIGEN_ARCH_MIPS 0
0315 #endif
0316 
0317 /// \internal EIGEN_ARCH_SPARC set to 1 if the architecture is SPARC
0318 #if defined(__sparc__) || defined(__sparc)
0319   #define EIGEN_ARCH_SPARC 1
0320 #else
0321   #define EIGEN_ARCH_SPARC 0
0322 #endif
0323 
0324 /// \internal EIGEN_ARCH_IA64 set to 1 if the architecture is Intel Itanium
0325 #if defined(__ia64__)
0326   #define EIGEN_ARCH_IA64 1
0327 #else
0328   #define EIGEN_ARCH_IA64 0
0329 #endif
0330 
0331 /// \internal EIGEN_ARCH_PPC set to 1 if the architecture is PowerPC
0332 #if defined(__powerpc__) || defined(__ppc__) || defined(_M_PPC)
0333   #define EIGEN_ARCH_PPC 1
0334 #else
0335   #define EIGEN_ARCH_PPC 0
0336 #endif
0337 
0338 
0339 
0340 //------------------------------------------------------------------------------------------
0341 // Operating system identification, EIGEN_OS_*
0342 //------------------------------------------------------------------------------------------
0343 
0344 /// \internal EIGEN_OS_UNIX set to 1 if the OS is a unix variant
0345 #if defined(__unix__) || defined(__unix)
0346   #define EIGEN_OS_UNIX 1
0347 #else
0348   #define EIGEN_OS_UNIX 0
0349 #endif
0350 
0351 /// \internal EIGEN_OS_LINUX set to 1 if the OS is based on Linux kernel
0352 #if defined(__linux__)
0353   #define EIGEN_OS_LINUX 1
0354 #else
0355   #define EIGEN_OS_LINUX 0
0356 #endif
0357 
0358 /// \internal EIGEN_OS_ANDROID set to 1 if the OS is Android
0359 // note: ANDROID is defined when using ndk_build, __ANDROID__ is defined when using a standalone toolchain.
0360 #if defined(__ANDROID__) || defined(ANDROID)
0361   #define EIGEN_OS_ANDROID 1
0362 #else
0363   #define EIGEN_OS_ANDROID 0
0364 #endif
0365 
0366 /// \internal EIGEN_OS_GNULINUX set to 1 if the OS is GNU Linux and not Linux-based OS (e.g., not android)
0367 #if defined(__gnu_linux__) && !(EIGEN_OS_ANDROID)
0368   #define EIGEN_OS_GNULINUX 1
0369 #else
0370   #define EIGEN_OS_GNULINUX 0
0371 #endif
0372 
0373 /// \internal EIGEN_OS_BSD set to 1 if the OS is a BSD variant
0374 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
0375   #define EIGEN_OS_BSD 1
0376 #else
0377   #define EIGEN_OS_BSD 0
0378 #endif
0379 
0380 /// \internal EIGEN_OS_MAC set to 1 if the OS is MacOS
0381 #if defined(__APPLE__)
0382   #define EIGEN_OS_MAC 1
0383 #else
0384   #define EIGEN_OS_MAC 0
0385 #endif
0386 
0387 /// \internal EIGEN_OS_QNX set to 1 if the OS is QNX
0388 #if defined(__QNX__)
0389   #define EIGEN_OS_QNX 1
0390 #else
0391   #define EIGEN_OS_QNX 0
0392 #endif
0393 
0394 /// \internal EIGEN_OS_WIN set to 1 if the OS is Windows based
0395 #if defined(_WIN32)
0396   #define EIGEN_OS_WIN 1
0397 #else
0398   #define EIGEN_OS_WIN 0
0399 #endif
0400 
0401 /// \internal EIGEN_OS_WIN64 set to 1 if the OS is Windows 64bits
0402 #if defined(_WIN64)
0403   #define EIGEN_OS_WIN64 1
0404 #else
0405   #define EIGEN_OS_WIN64 0
0406 #endif
0407 
0408 /// \internal EIGEN_OS_WINCE set to 1 if the OS is Windows CE
0409 #if defined(_WIN32_WCE)
0410   #define EIGEN_OS_WINCE 1
0411 #else
0412   #define EIGEN_OS_WINCE 0
0413 #endif
0414 
0415 /// \internal EIGEN_OS_CYGWIN set to 1 if the OS is Windows/Cygwin
0416 #if defined(__CYGWIN__)
0417   #define EIGEN_OS_CYGWIN 1
0418 #else
0419   #define EIGEN_OS_CYGWIN 0
0420 #endif
0421 
0422 /// \internal EIGEN_OS_WIN_STRICT set to 1 if the OS is really Windows and not some variants
0423 #if EIGEN_OS_WIN && !( EIGEN_OS_WINCE || EIGEN_OS_CYGWIN )
0424   #define EIGEN_OS_WIN_STRICT 1
0425 #else
0426   #define EIGEN_OS_WIN_STRICT 0
0427 #endif
0428 
0429 /// \internal EIGEN_OS_SUN set to __SUNPRO_C if the OS is SUN
0430 // compiler  solaris   __SUNPRO_C
0431 // version   studio
0432 // 5.7       10        0x570
0433 // 5.8       11        0x580
0434 // 5.9       12        0x590
0435 // 5.10      12.1      0x5100
0436 // 5.11      12.2      0x5110
0437 // 5.12      12.3      0x5120
0438 #if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__))
0439   #define EIGEN_OS_SUN __SUNPRO_C
0440 #else
0441   #define EIGEN_OS_SUN 0
0442 #endif
0443 
0444 /// \internal EIGEN_OS_SOLARIS set to 1 if the OS is Solaris
0445 #if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
0446   #define EIGEN_OS_SOLARIS 1
0447 #else
0448   #define EIGEN_OS_SOLARIS 0
0449 #endif
0450 
0451 
0452 //------------------------------------------------------------------------------------------
0453 // Detect GPU compilers and architectures
0454 //------------------------------------------------------------------------------------------
0455 
0456 // NVCC is not supported as the target platform for HIPCC
0457 // Note that this also makes EIGEN_CUDACC and EIGEN_HIPCC mutually exclusive
0458 #if defined(__NVCC__) && defined(__HIPCC__)
0459   #error "NVCC as the target platform for HIPCC is currently not supported."
0460 #endif
0461 
0462 #if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
0463   // Means the compiler is either nvcc or clang with CUDA enabled
0464   #define EIGEN_CUDACC __CUDACC__
0465 #endif
0466 
0467 #if defined(__CUDA_ARCH__) && !defined(EIGEN_NO_CUDA)
0468   // Means we are generating code for the device
0469   #define EIGEN_CUDA_ARCH __CUDA_ARCH__
0470 #endif
0471 
0472 #if defined(EIGEN_CUDACC)
0473 #include <cuda.h>
0474   #define EIGEN_CUDA_SDK_VER (CUDA_VERSION * 10)
0475 #else
0476   #define EIGEN_CUDA_SDK_VER 0
0477 #endif
0478 
0479 #if defined(__HIPCC__) && !defined(EIGEN_NO_HIP)
0480   // Means the compiler is HIPCC (analogous to EIGEN_CUDACC, but for HIP)
0481   #define EIGEN_HIPCC __HIPCC__
0482 
0483   // We need to include hip_runtime.h here because it pulls in
0484   // ++ hip_common.h which contains the define for  __HIP_DEVICE_COMPILE__
0485   // ++ host_defines.h which contains the defines for the __host__ and __device__ macros
0486   #include <hip/hip_runtime.h>
0487 
0488   #if defined(__HIP_DEVICE_COMPILE__)
0489     // analogous to EIGEN_CUDA_ARCH, but for HIP
0490     #define EIGEN_HIP_DEVICE_COMPILE __HIP_DEVICE_COMPILE__
0491   #endif
0492 
0493   // For HIP (ROCm 3.5 and higher), we need to explicitly set the launch_bounds attribute
0494   // value to 1024. The compiler assigns a default value of 256 when the attribute is not
0495   // specified. This results in failures on the HIP platform, for cases when a GPU kernel
0496   // without an explicit launch_bounds attribute is called with a threads_per_block value
0497   // greater than 256.
0498   //
0499   // This is a regression in functioanlity and is expected to be fixed within the next
0500   // couple of ROCm releases (compiler will go back to using 1024 value as the default)
0501   //
0502   // In the meantime, we will use a "only enabled for HIP" macro to set the launch_bounds
0503   // attribute.
0504 
0505   #define EIGEN_HIP_LAUNCH_BOUNDS_1024 __launch_bounds__(1024)
0506 
0507 #endif
0508 
0509 #if !defined(EIGEN_HIP_LAUNCH_BOUNDS_1024)
0510 #define EIGEN_HIP_LAUNCH_BOUNDS_1024
0511 #endif // !defined(EIGEN_HIP_LAUNCH_BOUNDS_1024)
0512 
0513 // Unify CUDA/HIPCC
0514 
0515 #if defined(EIGEN_CUDACC) || defined(EIGEN_HIPCC)
0516 //
0517 // If either EIGEN_CUDACC or EIGEN_HIPCC is defined, then define EIGEN_GPUCC
0518 //
0519 #define EIGEN_GPUCC
0520 //
0521 // EIGEN_HIPCC implies the HIP compiler and is used to tweak Eigen code for use in HIP kernels
0522 // EIGEN_CUDACC implies the CUDA compiler and is used to tweak Eigen code for use in CUDA kernels
0523 //
0524 // In most cases the same tweaks are required to the Eigen code to enable in both the HIP and CUDA kernels.
0525 // For those cases, the corresponding code should be guarded with
0526 //      #if defined(EIGEN_GPUCC)
0527 // instead of
0528 //      #if defined(EIGEN_CUDACC) || defined(EIGEN_HIPCC)
0529 //
0530 // For cases where the tweak is specific to HIP, the code should be guarded with
0531 //      #if defined(EIGEN_HIPCC)
0532 //
0533 // For cases where the tweak is specific to CUDA, the code should be guarded with
0534 //      #if defined(EIGEN_CUDACC)
0535 //
0536 #endif
0537 
0538 #if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIP_DEVICE_COMPILE)
0539 //
0540 // If either EIGEN_CUDA_ARCH or EIGEN_HIP_DEVICE_COMPILE is defined, then define EIGEN_GPU_COMPILE_PHASE
0541 //
0542 #define EIGEN_GPU_COMPILE_PHASE
0543 //
0544 // GPU compilers (HIPCC, NVCC) typically do two passes over the source code,
0545 //   + one to compile the source for the "host" (ie CPU)
0546 //   + another to compile the source for the "device" (ie. GPU)
0547 //
0548 // Code that needs to enabled only during the either the "host" or "device" compilation phase
0549 // needs to be guarded with a macro that indicates the current compilation phase
0550 //
0551 // EIGEN_HIP_DEVICE_COMPILE implies the device compilation phase in HIP
0552 // EIGEN_CUDA_ARCH implies the device compilation phase in CUDA
0553 //
0554 // In most cases, the "host" / "device" specific code is the same for both HIP and CUDA
0555 // For those cases, the code should be guarded with
0556 //       #if defined(EIGEN_GPU_COMPILE_PHASE)
0557 // instead of
0558 //       #if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIP_DEVICE_COMPILE)
0559 //
0560 // For cases where the tweak is specific to HIP, the code should be guarded with
0561 //      #if defined(EIGEN_HIP_DEVICE_COMPILE)
0562 //
0563 // For cases where the tweak is specific to CUDA, the code should be guarded with
0564 //      #if defined(EIGEN_CUDA_ARCH)
0565 //
0566 #endif
0567 
0568 #if defined(EIGEN_USE_SYCL) && defined(__SYCL_DEVICE_ONLY__)
0569 // EIGEN_USE_SYCL is a user-defined macro while __SYCL_DEVICE_ONLY__ is a compiler-defined macro.
0570 // In most cases we want to check if both macros are defined which can be done using the define below.
0571 #define SYCL_DEVICE_ONLY
0572 #endif
0573 
0574 //------------------------------------------------------------------------------------------
0575 // Detect Compiler/Architecture/OS specific features
0576 //------------------------------------------------------------------------------------------
0577 
0578 #if EIGEN_GNUC_AT_MOST(4,3) && !EIGEN_COMP_CLANG
0579   // see bug 89
0580   #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 0
0581 #else
0582   #define EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO 1
0583 #endif
0584 
0585 // Cross compiler wrapper around LLVM's __has_builtin
0586 #ifdef __has_builtin
0587 #  define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
0588 #else
0589 #  define EIGEN_HAS_BUILTIN(x) 0
0590 #endif
0591 
0592 // A Clang feature extension to determine compiler features.
0593 // We use it to determine 'cxx_rvalue_references'
0594 #ifndef __has_feature
0595 # define __has_feature(x) 0
0596 #endif
0597 
0598 // Some old compilers do not support template specializations like:
0599 // template<typename T,int N> void foo(const T x[N]);
0600 #if !(   EIGEN_COMP_CLANG && (   (EIGEN_COMP_CLANG<309)                                                       \
0601                               || (defined(__apple_build_version__) && (__apple_build_version__ < 9000000)))  \
0602       || EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<49)
0603 #define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 1
0604 #else
0605 #define EIGEN_HAS_STATIC_ARRAY_TEMPLATE 0
0606 #endif
0607 
0608 // The macro EIGEN_CPLUSPLUS is a replacement for __cplusplus/_MSVC_LANG that
0609 // works for both platforms, indicating the C++ standard version number.
0610 //
0611 // With MSVC, without defining /Zc:__cplusplus, the __cplusplus macro will
0612 // report 199711L regardless of the language standard specified via /std.
0613 // We need to rely on _MSVC_LANG instead, which is only available after
0614 // VS2015.3.
0615 #if EIGEN_COMP_MSVC_LANG > 0
0616 #define EIGEN_CPLUSPLUS EIGEN_COMP_MSVC_LANG
0617 #elif EIGEN_COMP_MSVC >= 1900
0618 #define EIGEN_CPLUSPLUS 201103L
0619 #elif defined(__cplusplus)
0620 #define EIGEN_CPLUSPLUS __cplusplus
0621 #else
0622 #define EIGEN_CPLUSPLUS 0
0623 #endif
0624 
0625 // The macro EIGEN_COMP_CXXVER defines the c++ verson expected by the compiler.
0626 // For instance, if compiling with gcc and -std=c++17, then EIGEN_COMP_CXXVER
0627 // is defined to 17.
0628 #if EIGEN_CPLUSPLUS > 201703L
0629   #define EIGEN_COMP_CXXVER 20
0630 #elif EIGEN_CPLUSPLUS > 201402L
0631   #define EIGEN_COMP_CXXVER 17
0632 #elif EIGEN_CPLUSPLUS > 201103L
0633   #define EIGEN_COMP_CXXVER 14
0634 #elif EIGEN_CPLUSPLUS >= 201103L
0635   #define EIGEN_COMP_CXXVER 11
0636 #else
0637   #define EIGEN_COMP_CXXVER 03
0638 #endif
0639 
0640 #ifndef EIGEN_HAS_CXX14_VARIABLE_TEMPLATES
0641   #if defined(__cpp_variable_templates) && __cpp_variable_templates >= 201304 && EIGEN_MAX_CPP_VER>=14
0642     #define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 1
0643   #else
0644     #define EIGEN_HAS_CXX14_VARIABLE_TEMPLATES 0
0645   #endif
0646 #endif
0647 
0648 
0649 // The macros EIGEN_HAS_CXX?? defines a rough estimate of available c++ features
0650 // but in practice we should not rely on them but rather on the availabilty of
0651 // individual features as defined later.
0652 // This is why there is no EIGEN_HAS_CXX17.
0653 // FIXME: get rid of EIGEN_HAS_CXX14 and maybe even EIGEN_HAS_CXX11.
0654 #if EIGEN_MAX_CPP_VER>=11 && EIGEN_COMP_CXXVER>=11
0655 #define EIGEN_HAS_CXX11 1
0656 #else
0657 #define EIGEN_HAS_CXX11 0
0658 #endif
0659 
0660 #if EIGEN_MAX_CPP_VER>=14 && EIGEN_COMP_CXXVER>=14
0661 #define EIGEN_HAS_CXX14 1
0662 #else
0663 #define EIGEN_HAS_CXX14 0
0664 #endif
0665 
0666 // Do we support r-value references?
0667 #ifndef EIGEN_HAS_RVALUE_REFERENCES
0668 #if EIGEN_MAX_CPP_VER>=11 && \
0669     (__has_feature(cxx_rvalue_references) || \
0670      (EIGEN_COMP_CXXVER >= 11) || (EIGEN_COMP_MSVC >= 1600))
0671   #define EIGEN_HAS_RVALUE_REFERENCES 1
0672 #else
0673   #define EIGEN_HAS_RVALUE_REFERENCES 0
0674 #endif
0675 #endif
0676 
0677 // Does the compiler support C99?
0678 // Need to include <cmath> to make sure _GLIBCXX_USE_C99 gets defined
0679 #include <cmath>
0680 #ifndef EIGEN_HAS_C99_MATH
0681 #if EIGEN_MAX_CPP_VER>=11 && \
0682     ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901))       \
0683   || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
0684   || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) \
0685   || (EIGEN_COMP_MSVC >= 1900) || defined(SYCL_DEVICE_ONLY))
0686   #define EIGEN_HAS_C99_MATH 1
0687 #else
0688   #define EIGEN_HAS_C99_MATH 0
0689 #endif
0690 #endif
0691 
0692 // Does the compiler support result_of?
0693 // result_of was deprecated in c++17 and removed in c++ 20
0694 #ifndef EIGEN_HAS_STD_RESULT_OF
0695 #if EIGEN_HAS_CXX11 && EIGEN_COMP_CXXVER < 17
0696 #define EIGEN_HAS_STD_RESULT_OF 1
0697 #else
0698 #define EIGEN_HAS_STD_RESULT_OF 0
0699 #endif
0700 #endif
0701 
0702 // Does the compiler support std::hash?
0703 #ifndef EIGEN_HAS_STD_HASH
0704 // The std::hash struct is defined in C++11 but is not labelled as a __device__
0705 // function and is not constexpr, so cannot be used on device.
0706 #if EIGEN_HAS_CXX11 && !defined(EIGEN_GPU_COMPILE_PHASE)
0707 #define EIGEN_HAS_STD_HASH 1
0708 #else
0709 #define EIGEN_HAS_STD_HASH 0
0710 #endif
0711 #endif  // EIGEN_HAS_STD_HASH
0712 
0713 #ifndef EIGEN_HAS_STD_INVOKE_RESULT
0714 #if EIGEN_MAX_CPP_VER >= 17 && EIGEN_COMP_CXXVER >= 17
0715 #define EIGEN_HAS_STD_INVOKE_RESULT 1
0716 #else
0717 #define EIGEN_HAS_STD_INVOKE_RESULT 0
0718 #endif
0719 #endif
0720 
0721 #ifndef EIGEN_HAS_ALIGNAS
0722 #if EIGEN_MAX_CPP_VER>=11 && EIGEN_HAS_CXX11 &&   \
0723       (     __has_feature(cxx_alignas)            \
0724         ||  EIGEN_HAS_CXX14                       \
0725         || (EIGEN_COMP_MSVC >= 1800)              \
0726         || (EIGEN_GNUC_AT_LEAST(4,8))             \
0727         || (EIGEN_COMP_CLANG>=305)                \
0728         || (EIGEN_COMP_ICC>=1500)                 \
0729         || (EIGEN_COMP_PGI>=1500)                 \
0730         || (EIGEN_COMP_SUNCC>=0x5130))
0731 #define EIGEN_HAS_ALIGNAS 1
0732 #else
0733 #define EIGEN_HAS_ALIGNAS 0
0734 #endif
0735 #endif
0736 
0737 // Does the compiler support type_traits?
0738 // - full support of type traits was added only to GCC 5.1.0.
0739 // - 20150626 corresponds to the last release of 4.x libstdc++
0740 #ifndef EIGEN_HAS_TYPE_TRAITS
0741 #if EIGEN_MAX_CPP_VER>=11 && (EIGEN_HAS_CXX11 || EIGEN_COMP_MSVC >= 1700) \
0742   && ((!EIGEN_COMP_GNUC_STRICT) || EIGEN_GNUC_AT_LEAST(5, 1)) \
0743   && ((!defined(__GLIBCXX__))   || __GLIBCXX__ > 20150626)
0744 #define EIGEN_HAS_TYPE_TRAITS 1
0745 #define EIGEN_INCLUDE_TYPE_TRAITS
0746 #else
0747 #define EIGEN_HAS_TYPE_TRAITS 0
0748 #endif
0749 #endif
0750 
0751 // Does the compiler support variadic templates?
0752 #ifndef EIGEN_HAS_VARIADIC_TEMPLATES
0753 #if EIGEN_MAX_CPP_VER>=11 && (EIGEN_COMP_CXXVER >= 11) \
0754   && (!defined(__NVCC__) || !EIGEN_ARCH_ARM_OR_ARM64 || (EIGEN_COMP_NVCC >= 80000) )
0755     // ^^ Disable the use of variadic templates when compiling with versions of nvcc older than 8.0 on ARM devices:
0756     //    this prevents nvcc from crashing when compiling Eigen on Tegra X1
0757 #define EIGEN_HAS_VARIADIC_TEMPLATES 1
0758 #elif  EIGEN_MAX_CPP_VER>=11 && (EIGEN_COMP_CXXVER >= 11) && defined(SYCL_DEVICE_ONLY)
0759 #define EIGEN_HAS_VARIADIC_TEMPLATES 1
0760 #else
0761 #define EIGEN_HAS_VARIADIC_TEMPLATES 0
0762 #endif
0763 #endif
0764 
0765 // Does the compiler fully support const expressions? (as in c++14)
0766 #ifndef EIGEN_HAS_CONSTEXPR
0767   #if defined(EIGEN_CUDACC)
0768   // Const expressions are supported provided that c++11 is enabled and we're using either clang or nvcc 7.5 or above
0769     #if EIGEN_MAX_CPP_VER>=14 && (EIGEN_COMP_CXXVER >= 11 && (EIGEN_COMP_CLANG || EIGEN_COMP_NVCC >= 70500))
0770       #define EIGEN_HAS_CONSTEXPR 1
0771     #endif
0772   #elif EIGEN_MAX_CPP_VER>=14 && (__has_feature(cxx_relaxed_constexpr) || (EIGEN_COMP_CXXVER >= 14) || \
0773     (EIGEN_GNUC_AT_LEAST(4,8) && (EIGEN_COMP_CXXVER >= 11)) || \
0774     (EIGEN_COMP_CLANG >= 306 && (EIGEN_COMP_CXXVER >= 11)))
0775     #define EIGEN_HAS_CONSTEXPR 1
0776   #endif
0777 
0778   #ifndef EIGEN_HAS_CONSTEXPR
0779     #define EIGEN_HAS_CONSTEXPR 0
0780   #endif
0781 
0782 #endif // EIGEN_HAS_CONSTEXPR
0783 
0784 #if EIGEN_HAS_CONSTEXPR
0785 #define EIGEN_CONSTEXPR constexpr
0786 #else
0787 #define EIGEN_CONSTEXPR
0788 #endif
0789 
0790 // Does the compiler support C++11 math?
0791 // Let's be conservative and enable the default C++11 implementation only if we are sure it exists
0792 #ifndef EIGEN_HAS_CXX11_MATH
0793   #if EIGEN_MAX_CPP_VER>=11 && ((EIGEN_COMP_CXXVER > 11) || (EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC)  \
0794       && (EIGEN_ARCH_i386_OR_x86_64) && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC))
0795     #define EIGEN_HAS_CXX11_MATH 1
0796   #else
0797     #define EIGEN_HAS_CXX11_MATH 0
0798   #endif
0799 #endif
0800 
0801 // Does the compiler support proper C++11 containers?
0802 #ifndef EIGEN_HAS_CXX11_CONTAINERS
0803   #if    EIGEN_MAX_CPP_VER>=11 && \
0804          ((EIGEN_COMP_CXXVER > 11) \
0805       || ((EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC>=1400)))
0806     #define EIGEN_HAS_CXX11_CONTAINERS 1
0807   #else
0808     #define EIGEN_HAS_CXX11_CONTAINERS 0
0809   #endif
0810 #endif
0811 
0812 // Does the compiler support C++11 noexcept?
0813 #ifndef EIGEN_HAS_CXX11_NOEXCEPT
0814   #if    EIGEN_MAX_CPP_VER>=11 && \
0815          (__has_feature(cxx_noexcept) \
0816       || (EIGEN_COMP_CXXVER > 11) \
0817       || ((EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_GNUC_STRICT || EIGEN_COMP_CLANG || EIGEN_COMP_MSVC || EIGEN_COMP_ICC>=1400)))
0818     #define EIGEN_HAS_CXX11_NOEXCEPT 1
0819   #else
0820     #define EIGEN_HAS_CXX11_NOEXCEPT 0
0821   #endif
0822 #endif
0823 
0824 #ifndef EIGEN_HAS_CXX11_ATOMIC
0825   #if    EIGEN_MAX_CPP_VER>=11 && \
0826          (__has_feature(cxx_atomic) \
0827       || (EIGEN_COMP_CXXVER > 11) \
0828       || ((EIGEN_COMP_CXXVER == 11) && (EIGEN_COMP_MSVC==0 || EIGEN_COMP_MSVC >= 1700)))
0829     #define EIGEN_HAS_CXX11_ATOMIC 1
0830   #else
0831     #define EIGEN_HAS_CXX11_ATOMIC 0
0832   #endif
0833 #endif
0834 
0835 #ifndef EIGEN_HAS_CXX11_OVERRIDE_FINAL
0836   #if    EIGEN_MAX_CPP_VER>=11 && \
0837        (EIGEN_COMP_CXXVER >= 11 || EIGEN_COMP_MSVC >= 1700)
0838     #define EIGEN_HAS_CXX11_OVERRIDE_FINAL 1
0839   #else
0840     #define EIGEN_HAS_CXX11_OVERRIDE_FINAL 0
0841   #endif
0842 #endif
0843 
0844 // NOTE: the required Apple's clang version is very conservative
0845 //       and it could be that XCode 9 works just fine.
0846 // NOTE: the MSVC version is based on https://en.cppreference.com/w/cpp/compiler_support
0847 //       and not tested.
0848 #ifndef EIGEN_HAS_CXX17_OVERALIGN
0849 #if EIGEN_MAX_CPP_VER>=17 && EIGEN_COMP_CXXVER>=17 && (                                 \
0850            (EIGEN_COMP_MSVC >= 1912)                                                    \
0851         || (EIGEN_GNUC_AT_LEAST(7,0))                                                   \
0852         || ((!defined(__apple_build_version__)) && (EIGEN_COMP_CLANG>=500))             \
0853         || (( defined(__apple_build_version__)) && (__apple_build_version__>=10000000)) \
0854       )
0855 #define EIGEN_HAS_CXX17_OVERALIGN 1
0856 #else
0857 #define EIGEN_HAS_CXX17_OVERALIGN 0
0858 #endif
0859 #endif
0860 
0861 #if defined(EIGEN_CUDACC) && EIGEN_HAS_CONSTEXPR
0862   // While available already with c++11, this is useful mostly starting with c++14 and relaxed constexpr rules
0863   #if defined(__NVCC__)
0864     // nvcc considers constexpr functions as __host__ __device__ with the option --expt-relaxed-constexpr
0865     #ifdef __CUDACC_RELAXED_CONSTEXPR__
0866       #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
0867     #endif
0868   #elif defined(__clang__) && defined(__CUDA__) && __has_feature(cxx_relaxed_constexpr)
0869     // clang++ always considers constexpr functions as implicitly __host__ __device__
0870     #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
0871   #endif
0872 #endif
0873 
0874 // Does the compiler support the __int128 and __uint128_t extensions for 128-bit
0875 // integer arithmetic?
0876 //
0877 // Clang and GCC define __SIZEOF_INT128__ when these extensions are supported,
0878 // but we avoid using them in certain cases:
0879 //
0880 // * Building using Clang for Windows, where the Clang runtime library has
0881 //   128-bit support only on LP64 architectures, but Windows is LLP64.
0882 #ifndef EIGEN_HAS_BUILTIN_INT128
0883 #if defined(__SIZEOF_INT128__) && !(EIGEN_OS_WIN && EIGEN_COMP_CLANG)
0884 #define EIGEN_HAS_BUILTIN_INT128 1
0885 #else
0886 #define EIGEN_HAS_BUILTIN_INT128 0
0887 #endif
0888 #endif
0889 
0890 //------------------------------------------------------------------------------------------
0891 // Preprocessor programming helpers
0892 //------------------------------------------------------------------------------------------
0893 
0894 // This macro can be used to prevent from macro expansion, e.g.:
0895 //   std::max EIGEN_NOT_A_MACRO(a,b)
0896 #define EIGEN_NOT_A_MACRO
0897 
0898 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
0899 
0900 // concatenate two tokens
0901 #define EIGEN_CAT2(a,b) a ## b
0902 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
0903 
0904 #define EIGEN_COMMA ,
0905 
0906 // convert a token to a string
0907 #define EIGEN_MAKESTRING2(a) #a
0908 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
0909 
0910 // EIGEN_STRONG_INLINE is a stronger version of the inline, using __forceinline on MSVC,
0911 // but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline
0912 // but GCC is still doing fine with just inline.
0913 #ifndef EIGEN_STRONG_INLINE
0914 #if (EIGEN_COMP_MSVC || EIGEN_COMP_ICC) && !defined(EIGEN_GPUCC)
0915 #define EIGEN_STRONG_INLINE __forceinline
0916 #else
0917 #define EIGEN_STRONG_INLINE inline
0918 #endif
0919 #endif
0920 
0921 // EIGEN_ALWAYS_INLINE is the stronget, it has the effect of making the function inline and adding every possible
0922 // attribute to maximize inlining. This should only be used when really necessary: in particular,
0923 // it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times.
0924 // FIXME with the always_inline attribute,
0925 // gcc 3.4.x and 4.1 reports the following compilation error:
0926 //   Eval.h:91: sorry, unimplemented: inlining failed in call to 'const Eigen::Eval<Derived> Eigen::MatrixBase<Scalar, Derived>::eval() const'
0927 //    : function body not available
0928 //   See also bug 1367
0929 #if EIGEN_GNUC_AT_LEAST(4,2) && !defined(SYCL_DEVICE_ONLY)
0930 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
0931 #else
0932 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
0933 #endif
0934 
0935 #if EIGEN_COMP_GNUC
0936 #define EIGEN_DONT_INLINE __attribute__((noinline))
0937 #elif EIGEN_COMP_MSVC
0938 #define EIGEN_DONT_INLINE __declspec(noinline)
0939 #else
0940 #define EIGEN_DONT_INLINE
0941 #endif
0942 
0943 #if EIGEN_COMP_GNUC
0944 #define EIGEN_PERMISSIVE_EXPR __extension__
0945 #else
0946 #define EIGEN_PERMISSIVE_EXPR
0947 #endif
0948 
0949 // GPU stuff
0950 
0951 // Disable some features when compiling with GPU compilers (NVCC/clang-cuda/SYCL/HIPCC)
0952 #if defined(EIGEN_CUDACC) || defined(SYCL_DEVICE_ONLY) || defined(EIGEN_HIPCC)
0953   // Do not try asserts on device code
0954   #ifndef EIGEN_NO_DEBUG
0955   #define EIGEN_NO_DEBUG
0956   #endif
0957 
0958   #ifdef EIGEN_INTERNAL_DEBUGGING
0959   #undef EIGEN_INTERNAL_DEBUGGING
0960   #endif
0961 
0962   #ifdef EIGEN_EXCEPTIONS
0963   #undef EIGEN_EXCEPTIONS
0964   #endif
0965 #endif
0966 
0967 #if defined(SYCL_DEVICE_ONLY)
0968   #ifndef EIGEN_DONT_VECTORIZE
0969     #define EIGEN_DONT_VECTORIZE
0970   #endif
0971   #define EIGEN_DEVICE_FUNC __attribute__((flatten)) __attribute__((always_inline))
0972 // All functions callable from CUDA/HIP code must be qualified with __device__
0973 #elif defined(EIGEN_GPUCC)
0974     #define EIGEN_DEVICE_FUNC __host__ __device__
0975 #else
0976   #define EIGEN_DEVICE_FUNC
0977 #endif
0978 
0979 
0980 // this macro allows to get rid of linking errors about multiply defined functions.
0981 //  - static is not very good because it prevents definitions from different object files to be merged.
0982 //           So static causes the resulting linked executable to be bloated with multiple copies of the same function.
0983 //  - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
0984 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC
0985 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC inline
0986 
0987 #ifdef NDEBUG
0988 # ifndef EIGEN_NO_DEBUG
0989 #  define EIGEN_NO_DEBUG
0990 # endif
0991 #endif
0992 
0993 // eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89
0994 #ifdef EIGEN_NO_DEBUG
0995   #ifdef SYCL_DEVICE_ONLY // used to silence the warning on SYCL device
0996     #define eigen_plain_assert(x) EIGEN_UNUSED_VARIABLE(x)
0997   #else
0998     #define eigen_plain_assert(x)
0999   #endif
1000 #else
1001   #if EIGEN_SAFE_TO_USE_STANDARD_ASSERT_MACRO
1002     namespace Eigen {
1003     namespace internal {
1004     inline bool copy_bool(bool b) { return b; }
1005     }
1006     }
1007     #define eigen_plain_assert(x) assert(x)
1008   #else
1009     // work around bug 89
1010     #include <cstdlib>   // for abort
1011     #include <iostream>  // for std::cerr
1012 
1013     namespace Eigen {
1014     namespace internal {
1015     // trivial function copying a bool. Must be EIGEN_DONT_INLINE, so we implement it after including Eigen headers.
1016     // see bug 89.
1017     namespace {
1018     EIGEN_DONT_INLINE bool copy_bool(bool b) { return b; }
1019     }
1020     inline void assert_fail(const char *condition, const char *function, const char *file, int line)
1021     {
1022       std::cerr << "assertion failed: " << condition << " in function " << function << " at " << file << ":" << line << std::endl;
1023       abort();
1024     }
1025     }
1026     }
1027     #define eigen_plain_assert(x) \
1028       do { \
1029         if(!Eigen::internal::copy_bool(x)) \
1030           Eigen::internal::assert_fail(EIGEN_MAKESTRING(x), __PRETTY_FUNCTION__, __FILE__, __LINE__); \
1031       } while(false)
1032   #endif
1033 #endif
1034 
1035 // eigen_assert can be overridden
1036 #ifndef eigen_assert
1037 #define eigen_assert(x) eigen_plain_assert(x)
1038 #endif
1039 
1040 #ifdef EIGEN_INTERNAL_DEBUGGING
1041 #define eigen_internal_assert(x) eigen_assert(x)
1042 #else
1043 #define eigen_internal_assert(x)
1044 #endif
1045 
1046 #ifdef EIGEN_NO_DEBUG
1047 #define EIGEN_ONLY_USED_FOR_DEBUG(x) EIGEN_UNUSED_VARIABLE(x)
1048 #else
1049 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
1050 #endif
1051 
1052 #ifndef EIGEN_NO_DEPRECATED_WARNING
1053   #if EIGEN_COMP_GNUC
1054     #define EIGEN_DEPRECATED __attribute__((deprecated))
1055   #elif EIGEN_COMP_MSVC
1056     #define EIGEN_DEPRECATED __declspec(deprecated)
1057   #else
1058     #define EIGEN_DEPRECATED
1059   #endif
1060 #else
1061   #define EIGEN_DEPRECATED
1062 #endif
1063 
1064 #if EIGEN_COMP_GNUC
1065 #define EIGEN_UNUSED __attribute__((unused))
1066 #else
1067 #define EIGEN_UNUSED
1068 #endif
1069 
1070 // Suppresses 'unused variable' warnings.
1071 namespace Eigen {
1072   namespace internal {
1073     template<typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void ignore_unused_variable(const T&) {}
1074   }
1075 }
1076 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
1077 
1078 #if !defined(EIGEN_ASM_COMMENT)
1079   #if EIGEN_COMP_GNUC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64)
1080     #define EIGEN_ASM_COMMENT(X)  __asm__("#" X)
1081   #else
1082     #define EIGEN_ASM_COMMENT(X)
1083   #endif
1084 #endif
1085 
1086 
1087 // Acts as a barrier preventing operations involving `X` from crossing. This
1088 // occurs, for example, in the fast rounding trick where a magic constant is
1089 // added then subtracted, which is otherwise compiled away with -ffast-math.
1090 //
1091 // See bug 1674
1092 #if !defined(EIGEN_OPTIMIZATION_BARRIER)
1093   #if EIGEN_COMP_GNUC
1094     // According to https://gcc.gnu.org/onlinedocs/gcc/Constraints.html:
1095     //   X: Any operand whatsoever.
1096     //   r: A register operand is allowed provided that it is in a general
1097     //      register.
1098     //   g: Any register, memory or immediate integer operand is allowed, except
1099     //      for registers that are not general registers.
1100     //   w: (AArch32/AArch64) Floating point register, Advanced SIMD vector
1101     //      register or SVE vector register.
1102     //   x: (SSE) Any SSE register.
1103     //      (AArch64) Like w, but restricted to registers 0 to 15 inclusive.
1104     //   v: (PowerPC) An Altivec vector register.
1105     //   wa:(PowerPC) A VSX register.
1106     //
1107     // "X" (uppercase) should work for all cases, though this seems to fail for
1108     // some versions of GCC for arm/aarch64 with
1109     //   "error: inconsistent operand constraints in an 'asm'"
1110     // Clang x86_64/arm/aarch64 seems to require "g" to support both scalars and
1111     // vectors, otherwise
1112     //   "error: non-trivial scalar-to-vector conversion, possible invalid
1113     //    constraint for vector type"
1114     //
1115     // GCC for ppc64le generates an internal compiler error with x/X/g.
1116     // GCC for AVX generates an internal compiler error with X.
1117     //
1118     // Tested on icc/gcc/clang for sse, avx, avx2, avx512dq
1119     //           gcc for arm, aarch64,
1120     //           gcc for ppc64le,
1121     // both vectors and scalars.
1122     //
1123     // Note that this is restricted to plain types - this will not work
1124     // directly for std::complex<T>, Eigen::half, Eigen::bfloat16. For these,
1125     // you will need to apply to the underlying POD type.
1126     #if EIGEN_ARCH_PPC && EIGEN_COMP_GNUC_STRICT
1127       // This seems to be broken on clang.  Packet4f is loaded into a single
1128       //   register rather than a vector, zeroing out some entries.  Integer
1129       //   types also generate a compile error.
1130       // General, Altivec, VSX.
1131       #define EIGEN_OPTIMIZATION_BARRIER(X)  __asm__  ("" : "+r,v,wa" (X));
1132     #elif EIGEN_ARCH_ARM_OR_ARM64
1133       // General, NEON.
1134       #define EIGEN_OPTIMIZATION_BARRIER(X)  __asm__  ("" : "+g,w" (X));
1135     #elif EIGEN_ARCH_i386_OR_x86_64
1136       // General, SSE.
1137       #define EIGEN_OPTIMIZATION_BARRIER(X)  __asm__  ("" : "+g,x" (X));
1138     #else
1139       // Not implemented for other architectures.
1140       #define EIGEN_OPTIMIZATION_BARRIER(X)
1141     #endif
1142   #else
1143     // Not implemented for other compilers.
1144     #define EIGEN_OPTIMIZATION_BARRIER(X)
1145   #endif
1146 #endif
1147 
1148 #if EIGEN_COMP_MSVC
1149   // NOTE MSVC often gives C4127 warnings with compiletime if statements. See bug 1362.
1150   // This workaround is ugly, but it does the job.
1151 #  define EIGEN_CONST_CONDITIONAL(cond)  (void)0, cond
1152 #else
1153 #  define EIGEN_CONST_CONDITIONAL(cond)  cond
1154 #endif
1155 
1156 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
1157   #define EIGEN_RESTRICT
1158 #endif
1159 #ifndef EIGEN_RESTRICT
1160   #define EIGEN_RESTRICT __restrict
1161 #endif
1162 
1163 
1164 #ifndef EIGEN_DEFAULT_IO_FORMAT
1165 #ifdef EIGEN_MAKING_DOCS
1166 // format used in Eigen's documentation
1167 // needed to define it here as escaping characters in CMake add_definition's argument seems very problematic.
1168 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
1169 #else
1170 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
1171 #endif
1172 #endif
1173 
1174 // just an empty macro !
1175 #define EIGEN_EMPTY
1176 
1177 
1178 // When compiling CUDA/HIP device code with NVCC or HIPCC
1179 // pull in math functions from the global namespace.
1180 // In host mode, and when device code is compiled with clang,
1181 // use the std versions.
1182 #if (defined(EIGEN_CUDA_ARCH) && defined(__NVCC__)) || defined(EIGEN_HIP_DEVICE_COMPILE)
1183   #define EIGEN_USING_STD(FUNC) using ::FUNC;
1184 #else
1185   #define EIGEN_USING_STD(FUNC) using std::FUNC;
1186 #endif
1187 
1188 #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC < 1900 || (EIGEN_COMP_MSVC == 1900 && EIGEN_COMP_NVCC))
1189   // For older MSVC versions, as well as 1900 && CUDA 8, using the base operator is necessary,
1190   //   otherwise we get duplicate definition errors
1191   // For later MSVC versions, we require explicit operator= definition, otherwise we get
1192   //   use of implicitly deleted operator errors.
1193   // (cf Bugs 920, 1000, 1324, 2291)
1194   #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1195     using Base::operator =;
1196 #elif EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
1197   #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1198     using Base::operator =; \
1199     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
1200     template <typename OtherDerived> \
1201     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; }
1202 #else
1203   #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1204     using Base::operator =; \
1205     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
1206     { \
1207       Base::operator=(other); \
1208       return *this; \
1209     }
1210 #endif
1211 
1212 
1213 /**
1214  * \internal
1215  * \brief Macro to explicitly define the default copy constructor.
1216  * This is necessary, because the implicit definition is deprecated if the copy-assignment is overridden.
1217  */
1218 #if EIGEN_HAS_CXX11
1219 #define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS) CLASS(const CLASS&) = default;
1220 #else
1221 #define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
1222 #endif
1223 
1224 
1225 
1226 /** \internal
1227  * \brief Macro to manually inherit assignment operators.
1228  * This is necessary, because the implicitly defined assignment operator gets deleted when a custom operator= is defined.
1229  * With C++11 or later this also default-implements the copy-constructor
1230  */
1231 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)  \
1232     EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1233     EIGEN_DEFAULT_COPY_CONSTRUCTOR(Derived)
1234 
1235 /** \internal
1236  * \brief Macro to manually define default constructors and destructors.
1237  * This is necessary when the copy constructor is re-defined.
1238  * For empty helper classes this should usually be protected, to avoid accidentally creating empty objects.
1239  *
1240  * Hiding the default destructor lead to problems in C++03 mode together with boost::multiprecision
1241  */
1242 #if EIGEN_HAS_CXX11
1243 #define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)  \
1244     Derived() = default; \
1245     ~Derived() = default;
1246 #else
1247 #define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)  \
1248     Derived() {}; \
1249     /* ~Derived() {}; */
1250 #endif
1251 
1252 
1253 
1254 
1255 
1256 /**
1257 * Just a side note. Commenting within defines works only by documenting
1258 * behind the object (via '!<'). Comments cannot be multi-line and thus
1259 * we have these extra long lines. What is confusing doxygen over here is
1260 * that we use '\' and basically have a bunch of typedefs with their
1261 * documentation in a single line.
1262 **/
1263 
1264 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
1265   typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; /*!< \brief Numeric type, e.g. float, double, int or std::complex<float>. */ \
1266   typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; /*!< \brief The underlying numeric type for composed scalar types. \details In cases where Scalar is e.g. std::complex<T>, T were corresponding to RealScalar. */ \
1267   typedef typename Base::CoeffReturnType CoeffReturnType; /*!< \brief The return type for coefficient access. \details Depending on whether the object allows direct coefficient access (e.g. for a MatrixXd), this type is either 'const Scalar&' or simply 'Scalar' for objects that do not allow direct coefficient access. */ \
1268   typedef typename Eigen::internal::ref_selector<Derived>::type Nested; \
1269   typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
1270   typedef typename Eigen::internal::traits<Derived>::StorageIndex StorageIndex; \
1271   enum CompileTimeTraits \
1272       { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
1273         ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
1274         Flags = Eigen::internal::traits<Derived>::Flags, \
1275         SizeAtCompileTime = Base::SizeAtCompileTime, \
1276         MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
1277         IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
1278   using Base::derived; \
1279   using Base::const_cast_derived;
1280 
1281 
1282 // FIXME Maybe the EIGEN_DENSE_PUBLIC_INTERFACE could be removed as importing PacketScalar is rarely needed
1283 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
1284   EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
1285   typedef typename Base::PacketScalar PacketScalar;
1286 
1287 
1288 #define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
1289 #define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
1290 
1291 // EIGEN_SIZE_MIN_PREFER_DYNAMIC gives the min between compile-time sizes. 0 has absolute priority, followed by 1,
1292 // followed by Dynamic, followed by other finite values. The reason for giving Dynamic the priority over
1293 // finite values is that min(3, Dynamic) should be Dynamic, since that could be anything between 0 and 3.
1294 #define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
1295                            : ((int)a == 1 || (int)b == 1) ? 1 \
1296                            : ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
1297                            : ((int)a <= (int)b) ? (int)a : (int)b)
1298 
1299 // EIGEN_SIZE_MIN_PREFER_FIXED is a variant of EIGEN_SIZE_MIN_PREFER_DYNAMIC comparing MaxSizes. The difference is that finite values
1300 // now have priority over Dynamic, so that min(3, Dynamic) gives 3. Indeed, whatever the actual value is
1301 // (between 0 and 3), it is not more than 3.
1302 #define EIGEN_SIZE_MIN_PREFER_FIXED(a,b)  (((int)a == 0 || (int)b == 0) ? 0 \
1303                            : ((int)a == 1 || (int)b == 1) ? 1 \
1304                            : ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
1305                            : ((int)a == Dynamic) ? (int)b \
1306                            : ((int)b == Dynamic) ? (int)a \
1307                            : ((int)a <= (int)b) ? (int)a : (int)b)
1308 
1309 // see EIGEN_SIZE_MIN_PREFER_DYNAMIC. No need for a separate variant for MaxSizes here.
1310 #define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
1311                            : ((int)a >= (int)b) ? (int)a : (int)b)
1312 
1313 #define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
1314 
1315 #define EIGEN_IMPLIES(a,b) (!(a) || (b))
1316 
1317 #if EIGEN_HAS_BUILTIN(__builtin_expect) || EIGEN_COMP_GNUC
1318 #define EIGEN_PREDICT_FALSE(x) (__builtin_expect(x, false))
1319 #define EIGEN_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
1320 #else
1321 #define EIGEN_PREDICT_FALSE(x) (x)
1322 #define EIGEN_PREDICT_TRUE(x) (x)
1323 #endif
1324 
1325 // the expression type of a standard coefficient wise binary operation
1326 #define EIGEN_CWISE_BINARY_RETURN_TYPE(LHS,RHS,OPNAME) \
1327     CwiseBinaryOp< \
1328       EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)< \
1329           typename internal::traits<LHS>::Scalar, \
1330           typename internal::traits<RHS>::Scalar \
1331       >, \
1332       const LHS, \
1333       const RHS \
1334     >
1335 
1336 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,OPNAME) \
1337   template<typename OtherDerived> \
1338   EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,OPNAME) \
1339   (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
1340   { \
1341     return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,OPNAME)(derived(), other.derived()); \
1342   }
1343 
1344 #define EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,TYPEA,TYPEB) \
1345   (Eigen::internal::has_ReturnType<Eigen::ScalarBinaryOpTraits<TYPEA,TYPEB,EIGEN_CAT(EIGEN_CAT(Eigen::internal::scalar_,OPNAME),_op)<TYPEA,TYPEB>  > >::value)
1346 
1347 #define EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(EXPR,SCALAR,OPNAME) \
1348   CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<typename internal::traits<EXPR>::Scalar,SCALAR>, const EXPR, \
1349                 const typename internal::plain_constant_type<EXPR,SCALAR>::type>
1350 
1351 #define EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(SCALAR,EXPR,OPNAME) \
1352   CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<SCALAR,typename internal::traits<EXPR>::Scalar>, \
1353                 const typename internal::plain_constant_type<EXPR,SCALAR>::type, const EXPR>
1354 
1355 // Workaround for MSVC 2010 (see ML thread "patch with compile for for MSVC 2010")
1356 #if EIGEN_COMP_MSVC_STRICT && (EIGEN_COMP_MSVC_STRICT<=1600)
1357 #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) typename internal::enable_if<true,X>::type
1358 #else
1359 #define EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE(X) X
1360 #endif
1361 
1362 #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) \
1363   template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
1364   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))\
1365   (METHOD)(const T& scalar) const { \
1366     typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type PromotedT; \
1367     return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedT,OPNAME)(derived(), \
1368            typename internal::plain_constant_type<Derived,PromotedT>::type(derived().rows(), derived().cols(), internal::scalar_constant_op<PromotedT>(scalar))); \
1369   }
1370 
1371 #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \
1372   template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend \
1373   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)) \
1374   (METHOD)(const T& scalar, const StorageBaseType& matrix) { \
1375     typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type PromotedT; \
1376     return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedT,Derived,OPNAME)( \
1377            typename internal::plain_constant_type<Derived,PromotedT>::type(matrix.derived().rows(), matrix.derived().cols(), internal::scalar_constant_op<PromotedT>(scalar)), matrix.derived()); \
1378   }
1379 
1380 #define EIGEN_MAKE_SCALAR_BINARY_OP(METHOD,OPNAME) \
1381   EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \
1382   EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME)
1383 
1384 
1385 #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_CUDA_ARCH) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL) && !defined(EIGEN_HIP_DEVICE_COMPILE)
1386   #define EIGEN_EXCEPTIONS
1387 #endif
1388 
1389 
1390 #ifdef EIGEN_EXCEPTIONS
1391 #  define EIGEN_THROW_X(X) throw X
1392 #  define EIGEN_THROW throw
1393 #  define EIGEN_TRY try
1394 #  define EIGEN_CATCH(X) catch (X)
1395 #else
1396 #  if defined(EIGEN_CUDA_ARCH)
1397 #    define EIGEN_THROW_X(X) asm("trap;")
1398 #    define EIGEN_THROW asm("trap;")
1399 #  elif defined(EIGEN_HIP_DEVICE_COMPILE)
1400 #    define EIGEN_THROW_X(X) asm("s_trap 0")
1401 #    define EIGEN_THROW asm("s_trap 0")
1402 #  else
1403 #    define EIGEN_THROW_X(X) std::abort()
1404 #    define EIGEN_THROW std::abort()
1405 #  endif
1406 #  define EIGEN_TRY if (true)
1407 #  define EIGEN_CATCH(X) else
1408 #endif
1409 
1410 
1411 #if EIGEN_HAS_CXX11_NOEXCEPT
1412 #   define EIGEN_INCLUDE_TYPE_TRAITS
1413 #   define EIGEN_NOEXCEPT noexcept
1414 #   define EIGEN_NOEXCEPT_IF(x) noexcept(x)
1415 #   define EIGEN_NO_THROW noexcept(true)
1416 #   define EIGEN_EXCEPTION_SPEC(X) noexcept(false)
1417 #else
1418 #   define EIGEN_NOEXCEPT
1419 #   define EIGEN_NOEXCEPT_IF(x)
1420 #   define EIGEN_NO_THROW throw()
1421 #   if EIGEN_COMP_MSVC || EIGEN_COMP_CXXVER>=17
1422       // MSVC does not support exception specifications (warning C4290),
1423       // and they are deprecated in c++11 anyway. This is even an error in c++17.
1424 #     define EIGEN_EXCEPTION_SPEC(X) throw()
1425 #   else
1426 #     define EIGEN_EXCEPTION_SPEC(X) throw(X)
1427 #   endif
1428 #endif
1429 
1430 #if EIGEN_HAS_VARIADIC_TEMPLATES
1431 // The all function is used to enable a variadic version of eigen_assert which can take a parameter pack as its input.
1432 namespace Eigen {
1433 namespace internal {
1434 
1435 inline bool all(){ return true; }
1436 
1437 template<typename T, typename ...Ts>
1438 bool all(T t, Ts ... ts){ return t && all(ts...); }
1439 
1440 }
1441 }
1442 #endif
1443 
1444 #if EIGEN_HAS_CXX11_OVERRIDE_FINAL
1445 // provide override and final specifiers if they are available:
1446 #   define EIGEN_OVERRIDE override
1447 #   define EIGEN_FINAL final
1448 #else
1449 #   define EIGEN_OVERRIDE
1450 #   define EIGEN_FINAL
1451 #endif
1452 
1453 // Wrapping #pragma unroll in a macro since it is required for SYCL
1454 #if defined(SYCL_DEVICE_ONLY)
1455   #if defined(_MSC_VER)
1456     #define EIGEN_UNROLL_LOOP __pragma(unroll)
1457   #else
1458     #define EIGEN_UNROLL_LOOP _Pragma("unroll")
1459   #endif
1460 #else
1461   #define EIGEN_UNROLL_LOOP
1462 #endif
1463 
1464 #endif // EIGEN_MACROS_H