Eigen  3.4.90 (git rev 67eeba6e720c5745abc77ae6c92ce0a44aa7b7ae)
Macros.h
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2015 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_MACROS_H
12 #define EIGEN_MACROS_H
13 #include "../InternalHeaderCheck.h"
14 
15 //------------------------------------------------------------------------------------------
16 // Eigen version and basic defaults
17 //------------------------------------------------------------------------------------------
18 
19 #define EIGEN_WORLD_VERSION 3
20 #define EIGEN_MAJOR_VERSION 4
21 #define EIGEN_MINOR_VERSION 90
22 
23 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \
24  (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \
25  EIGEN_MINOR_VERSION>=z))))
26 
27 #ifdef EIGEN_DEFAULT_TO_ROW_MAJOR
28 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::RowMajor
29 #else
30 #define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION Eigen::ColMajor
31 #endif
32 
33 #ifndef EIGEN_DEFAULT_DENSE_INDEX_TYPE
34 #define EIGEN_DEFAULT_DENSE_INDEX_TYPE std::ptrdiff_t
35 #endif
36 
37 // Upperbound on the C++ version to use.
38 // Expected values are 03, 11, 14, 17, etc.
39 // By default, let's use an arbitrarily large C++ version.
40 #ifndef EIGEN_MAX_CPP_VER
41 #define EIGEN_MAX_CPP_VER 99
42 #endif
43 
49 #ifndef EIGEN_FAST_MATH
50 #define EIGEN_FAST_MATH 1
51 #endif
52 
53 #ifndef EIGEN_STACK_ALLOCATION_LIMIT
54 // 131072 == 128 KB
55 #define EIGEN_STACK_ALLOCATION_LIMIT 131072
56 #endif
57 
58 //------------------------------------------------------------------------------------------
59 // Compiler identification, EIGEN_COMP_*
60 //------------------------------------------------------------------------------------------
61 
63 #ifdef __GNUC__
64  #define EIGEN_COMP_GNUC (__GNUC__*10+__GNUC_MINOR__)
65 #else
66  #define EIGEN_COMP_GNUC 0
67 #endif
68 
70 #if defined(__clang__)
71  #define EIGEN_COMP_CLANG (__clang_major__*100+__clang_minor__)
72 #else
73  #define EIGEN_COMP_CLANG 0
74 #endif
75 
77 #if defined(__castxml__)
78  #define EIGEN_COMP_CASTXML 1
79 #else
80  #define EIGEN_COMP_CASTXML 0
81 #endif
82 
84 #if defined(__llvm__)
85  #define EIGEN_COMP_LLVM 1
86 #else
87  #define EIGEN_COMP_LLVM 0
88 #endif
89 
91 #if defined(__INTEL_COMPILER)
92  #define EIGEN_COMP_ICC __INTEL_COMPILER
93 #else
94  #define EIGEN_COMP_ICC 0
95 #endif
96 
98 #if defined(__INTEL_CLANG_COMPILER)
99  #define EIGEN_COMP_CLANGICC __INTEL_CLANG_COMPILER
100 #else
101  #define EIGEN_COMP_CLANGICC 0
102 #endif
103 
105 #if defined(__MINGW32__)
106  #define EIGEN_COMP_MINGW 1
107 #else
108  #define EIGEN_COMP_MINGW 0
109 #endif
110 
112 #if defined(__SUNPRO_CC)
113  #define EIGEN_COMP_SUNCC 1
114 #else
115  #define EIGEN_COMP_SUNCC 0
116 #endif
117 
119 #if defined(_MSC_VER)
120  #define EIGEN_COMP_MSVC _MSC_VER
121 #else
122  #define EIGEN_COMP_MSVC 0
123 #endif
124 
125 #if defined(__NVCC__)
126 #if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
127  #define EIGEN_COMP_NVCC ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
128 #elif defined(__CUDACC_VER__)
129  #define EIGEN_COMP_NVCC __CUDACC_VER__
130 #else
131  #error "NVCC did not define compiler version."
132 #endif
133 #else
134  #define EIGEN_COMP_NVCC 0
135 #endif
136 
137 // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC:
138 // name ver MSC_VER
139 // 2015 14 1900
140 // "15" 15 1900
141 // 2017-14.1 15.0 1910
142 // 2017-14.11 15.3 1911
143 // 2017-14.12 15.5 1912
144 // 2017-14.13 15.6 1913
145 // 2017-14.14 15.7 1914
146 // 2017 15.8 1915
147 // 2017 15.9 1916
148 // 2019 RTW 16.0 1920
149 
151 #if defined(_MSVC_LANG)
152  #define EIGEN_COMP_MSVC_LANG _MSVC_LANG
153 #else
154  #define EIGEN_COMP_MSVC_LANG 0
155 #endif
156 
157 // For the record, here is a table summarizing the possible values for EIGEN_COMP_MSVC_LANG:
158 // MSVC option Standard MSVC_LANG
159 // /std:c++14 (default as of VS 2019) C++14 201402L
160 // /std:c++17 C++17 201703L
161 // /std:c++latest >C++17 >201703L
162 
164 #if EIGEN_COMP_MSVC && !(EIGEN_COMP_ICC || EIGEN_COMP_LLVM || EIGEN_COMP_CLANG)
165  #define EIGEN_COMP_MSVC_STRICT _MSC_VER
166 #else
167  #define EIGEN_COMP_MSVC_STRICT 0
168 #endif
169 
171 // XLC version
172 // 3.1 0x0301
173 // 4.5 0x0405
174 // 5.0 0x0500
175 // 12.1 0x0C01
176 #if defined(__IBMCPP__) || defined(__xlc__) || defined(__ibmxl__)
177  #define EIGEN_COMP_IBM __xlC__
178 #else
179  #define EIGEN_COMP_IBM 0
180 #endif
181 
183 #if defined(__PGI)
184  #define EIGEN_COMP_PGI (__PGIC__*100+__PGIC_MINOR__)
185 #else
186  #define EIGEN_COMP_PGI 0
187 #endif
188 
190 #if defined(__CC_ARM) || defined(__ARMCC_VERSION)
191  #define EIGEN_COMP_ARM 1
192 #else
193  #define EIGEN_COMP_ARM 0
194 #endif
195 
197 #if defined(__EMSCRIPTEN__)
198  #define EIGEN_COMP_EMSCRIPTEN 1
199 #else
200  #define EIGEN_COMP_EMSCRIPTEN 0
201 #endif
202 
206 #if defined(__FUJITSU)
207  #define EIGEN_COMP_FCC (__FCC_major__*100+__FCC_minor__*10+__FCC_patchlevel__)
208 #else
209  #define EIGEN_COMP_FCC 0
210 #endif
211 
215 #if defined(__CLANG_FUJITSU)
216  #define EIGEN_COMP_CLANGFCC (__FCC_major__*100+__FCC_minor__*10+__FCC_patchlevel__)
217 #else
218  #define EIGEN_COMP_CLANGFCC 0
219 #endif
220 
224 #if defined(_CRAYC) && !defined(__clang__)
225  #define EIGEN_COMP_CPE (_RELEASE_MAJOR*100+_RELEASE_MINOR*10+_RELEASE_PATCHLEVEL)
226 #else
227  #define EIGEN_COMP_CPE 0
228 #endif
229 
233 #if defined(_CRAYC) && defined(__clang__)
234  #define EIGEN_COMP_CLANGCPE (_RELEASE_MAJOR*100+_RELEASE_MINOR*10+_RELEASE_PATCHLEVEL)
235 #else
236  #define EIGEN_COMP_CLANGCPE 0
237 #endif
238 
240 #if defined(__LCC__) && defined(__MCST__)
241  #define EIGEN_COMP_LCC (__LCC__*100+__LCC_MINOR__)
242 #else
243  #define EIGEN_COMP_LCC 0
244 #endif
245 
246 
248 #if EIGEN_COMP_GNUC && !(EIGEN_COMP_CLANG || EIGEN_COMP_ICC || EIGEN_COMP_CLANGICC || EIGEN_COMP_MINGW || EIGEN_COMP_PGI || EIGEN_COMP_IBM || EIGEN_COMP_ARM || EIGEN_COMP_EMSCRIPTEN || EIGEN_COMP_FCC || EIGEN_COMP_CLANGFCC || EIGEN_COMP_CPE || EIGEN_COMP_CLANGCPE || EIGEN_COMP_LCC)
249  #define EIGEN_COMP_GNUC_STRICT 1
250 #else
251  #define EIGEN_COMP_GNUC_STRICT 0
252 #endif
253 
254 
255 #if EIGEN_COMP_GNUC
256  #define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__==x && __GNUC_MINOR__>=y) || __GNUC__>x)
257  #define EIGEN_GNUC_AT_MOST(x,y) ((__GNUC__==x && __GNUC_MINOR__<=y) || __GNUC__<x)
258  #define EIGEN_GNUC_AT(x,y) ( __GNUC__==x && __GNUC_MINOR__==y )
259 #else
260  #define EIGEN_GNUC_AT_LEAST(x,y) 0
261  #define EIGEN_GNUC_AT_MOST(x,y) 0
262  #define EIGEN_GNUC_AT(x,y) 0
263 #endif
264 
265 
266 //------------------------------------------------------------------------------------------
267 // Architecture identification, EIGEN_ARCH_*
268 //------------------------------------------------------------------------------------------
269 
270 
271 #if defined(__x86_64__) || (defined(_M_X64) && !defined(_M_ARM64EC)) || defined(__amd64)
272  #define EIGEN_ARCH_x86_64 1
273 #else
274  #define EIGEN_ARCH_x86_64 0
275 #endif
276 
277 #if defined(__i386__) || defined(_M_IX86) || defined(_X86_) || defined(__i386)
278  #define EIGEN_ARCH_i386 1
279 #else
280  #define EIGEN_ARCH_i386 0
281 #endif
282 
283 #if EIGEN_ARCH_x86_64 || EIGEN_ARCH_i386
284  #define EIGEN_ARCH_i386_OR_x86_64 1
285 #else
286  #define EIGEN_ARCH_i386_OR_x86_64 0
287 #endif
288 
290 #if defined(__arm__)
291  #define EIGEN_ARCH_ARM 1
292 #else
293  #define EIGEN_ARCH_ARM 0
294 #endif
295 
297 #if defined(__aarch64__) || defined(_M_ARM64) || defined(_M_ARM64EC)
298  #define EIGEN_ARCH_ARM64 1
299 #else
300  #define EIGEN_ARCH_ARM64 0
301 #endif
302 
304 #if EIGEN_ARCH_ARM || EIGEN_ARCH_ARM64
305  #define EIGEN_ARCH_ARM_OR_ARM64 1
306 #else
307  #define EIGEN_ARCH_ARM_OR_ARM64 0
308 #endif
309 
311 #if EIGEN_ARCH_ARM_OR_ARM64 && defined(__ARM_ARCH) && __ARM_ARCH >= 8
312 #define EIGEN_ARCH_ARMV8 1
313 #else
314 #define EIGEN_ARCH_ARMV8 0
315 #endif
316 
317 
320 #if EIGEN_ARCH_ARM64
321  #ifndef EIGEN_HAS_ARM64_FP16
322  #if defined(__ARM_FP16_FORMAT_IEEE)
323  #define EIGEN_HAS_ARM64_FP16 1
324  #else
325  #define EIGEN_HAS_ARM64_FP16 0
326  #endif
327  #endif
328 #endif
329 
332 #if EIGEN_ARCH_ARM64
333  #ifndef EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC
334  #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
335  #define EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 1
336  #else
337  #define EIGEN_HAS_ARM64_FP16_VECTOR_ARITHMETIC 0
338  #endif
339  #endif
340 #endif
341 
344 #if EIGEN_ARCH_ARM64
345  #ifndef EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC
346  #if defined(__ARM_FEATURE_FP16_SCALAR_ARITHMETIC)
347  #define EIGEN_HAS_ARM64_FP16_SCALAR_ARITHMETIC 1
348  #endif
349  #endif
350 #endif
351 
353 #if defined(__mips__) || defined(__mips)
354  #define EIGEN_ARCH_MIPS 1
355 #else
356  #define EIGEN_ARCH_MIPS 0
357 #endif
358 
360 #if defined(__sparc__) || defined(__sparc)
361  #define EIGEN_ARCH_SPARC 1
362 #else
363  #define EIGEN_ARCH_SPARC 0
364 #endif
365 
367 #if defined(__ia64__)
368  #define EIGEN_ARCH_IA64 1
369 #else
370  #define EIGEN_ARCH_IA64 0
371 #endif
372 
374 #if defined(__powerpc__) || defined(__ppc__) || defined(_M_PPC)
375  #define EIGEN_ARCH_PPC 1
376 #else
377  #define EIGEN_ARCH_PPC 0
378 #endif
379 
380 
381 
382 //------------------------------------------------------------------------------------------
383 // Operating system identification, EIGEN_OS_*
384 //------------------------------------------------------------------------------------------
385 
387 #if defined(__unix__) || defined(__unix)
388  #define EIGEN_OS_UNIX 1
389 #else
390  #define EIGEN_OS_UNIX 0
391 #endif
392 
394 #if defined(__linux__)
395  #define EIGEN_OS_LINUX 1
396 #else
397  #define EIGEN_OS_LINUX 0
398 #endif
399 
401 // note: ANDROID is defined when using ndk_build, __ANDROID__ is defined when using a standalone toolchain.
402 #if defined(__ANDROID__) || defined(ANDROID)
403  #define EIGEN_OS_ANDROID 1
404 #else
405  #define EIGEN_OS_ANDROID 0
406 #endif
407 
409 #if defined(__gnu_linux__) && !(EIGEN_OS_ANDROID)
410  #define EIGEN_OS_GNULINUX 1
411 #else
412  #define EIGEN_OS_GNULINUX 0
413 #endif
414 
416 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || defined(__DragonFly__)
417  #define EIGEN_OS_BSD 1
418 #else
419  #define EIGEN_OS_BSD 0
420 #endif
421 
423 #if defined(__APPLE__)
424  #define EIGEN_OS_MAC 1
425 #else
426  #define EIGEN_OS_MAC 0
427 #endif
428 
430 #if defined(__QNX__)
431  #define EIGEN_OS_QNX 1
432 #else
433  #define EIGEN_OS_QNX 0
434 #endif
435 
437 #if defined(_WIN32)
438  #define EIGEN_OS_WIN 1
439 #else
440  #define EIGEN_OS_WIN 0
441 #endif
442 
444 #if defined(_WIN64)
445  #define EIGEN_OS_WIN64 1
446 #else
447  #define EIGEN_OS_WIN64 0
448 #endif
449 
451 #if defined(_WIN32_WCE)
452  #define EIGEN_OS_WINCE 1
453 #else
454  #define EIGEN_OS_WINCE 0
455 #endif
456 
458 #if defined(__CYGWIN__)
459  #define EIGEN_OS_CYGWIN 1
460 #else
461  #define EIGEN_OS_CYGWIN 0
462 #endif
463 
465 #if EIGEN_OS_WIN && !( EIGEN_OS_WINCE || EIGEN_OS_CYGWIN )
466  #define EIGEN_OS_WIN_STRICT 1
467 #else
468  #define EIGEN_OS_WIN_STRICT 0
469 #endif
470 
472 // compiler solaris __SUNPRO_C
473 // version studio
474 // 5.7 10 0x570
475 // 5.8 11 0x580
476 // 5.9 12 0x590
477 // 5.10 12.1 0x5100
478 // 5.11 12.2 0x5110
479 // 5.12 12.3 0x5120
480 #if (defined(sun) || defined(__sun)) && !(defined(__SVR4) || defined(__svr4__))
481  #define EIGEN_OS_SUN __SUNPRO_C
482 #else
483  #define EIGEN_OS_SUN 0
484 #endif
485 
487 #if (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
488  #define EIGEN_OS_SOLARIS 1
489 #else
490  #define EIGEN_OS_SOLARIS 0
491 #endif
492 
493 
494 //------------------------------------------------------------------------------------------
495 // Detect GPU compilers and architectures
496 //------------------------------------------------------------------------------------------
497 
498 // NVCC is not supported as the target platform for HIPCC
499 // Note that this also makes EIGEN_CUDACC and EIGEN_HIPCC mutually exclusive
500 #if defined(__NVCC__) && defined(__HIPCC__)
501  #error "NVCC as the target platform for HIPCC is currently not supported."
502 #endif
503 
504 #if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
505  // Means the compiler is either nvcc or clang with CUDA enabled
506  #define EIGEN_CUDACC __CUDACC__
507 #endif
508 
509 #if defined(__CUDA_ARCH__) && !defined(EIGEN_NO_CUDA)
510  // Means we are generating code for the device
511  #define EIGEN_CUDA_ARCH __CUDA_ARCH__
512 #endif
513 
514 #if defined(EIGEN_CUDACC)
515 #include <cuda.h>
516  #define EIGEN_CUDA_SDK_VER (CUDA_VERSION * 10)
517 #else
518  #define EIGEN_CUDA_SDK_VER 0
519 #endif
520 
521 #if defined(__HIPCC__) && !defined(EIGEN_NO_HIP)
522  // Means the compiler is HIPCC (analogous to EIGEN_CUDACC, but for HIP)
523  #define EIGEN_HIPCC __HIPCC__
524 
525  // We need to include hip_runtime.h here because it pulls in
526  // ++ hip_common.h which contains the define for __HIP_DEVICE_COMPILE__
527  // ++ host_defines.h which contains the defines for the __host__ and __device__ macros
528  #include <hip/hip_runtime.h>
529 
530  #if defined(__HIP_DEVICE_COMPILE__)
531  // analogous to EIGEN_CUDA_ARCH, but for HIP
532  #define EIGEN_HIP_DEVICE_COMPILE __HIP_DEVICE_COMPILE__
533  #endif
534 
535  // For HIP (ROCm 3.5 and higher), we need to explicitly set the launch_bounds attribute
536  // value to 1024. The compiler assigns a default value of 256 when the attribute is not
537  // specified. This results in failures on the HIP platform, for cases when a GPU kernel
538  // without an explicit launch_bounds attribute is called with a threads_per_block value
539  // greater than 256.
540  //
541  // This is a regression in functioanlity and is expected to be fixed within the next
542  // couple of ROCm releases (compiler will go back to using 1024 value as the default)
543  //
544  // In the meantime, we will use a "only enabled for HIP" macro to set the launch_bounds
545  // attribute.
546 
547  #define EIGEN_HIP_LAUNCH_BOUNDS_1024 __launch_bounds__(1024)
548 
549 #endif
550 
551 #if !defined(EIGEN_HIP_LAUNCH_BOUNDS_1024)
552 #define EIGEN_HIP_LAUNCH_BOUNDS_1024
553 #endif // !defined(EIGEN_HIP_LAUNCH_BOUNDS_1024)
554 
555 // Unify CUDA/HIPCC
556 
557 #if defined(EIGEN_CUDACC) || defined(EIGEN_HIPCC)
558 //
559 // If either EIGEN_CUDACC or EIGEN_HIPCC is defined, then define EIGEN_GPUCC
560 //
561 #define EIGEN_GPUCC
562 //
563 // EIGEN_HIPCC implies the HIP compiler and is used to tweak Eigen code for use in HIP kernels
564 // EIGEN_CUDACC implies the CUDA compiler and is used to tweak Eigen code for use in CUDA kernels
565 //
566 // In most cases the same tweaks are required to the Eigen code to enable in both the HIP and CUDA kernels.
567 // For those cases, the corresponding code should be guarded with
568 // #if defined(EIGEN_GPUCC)
569 // instead of
570 // #if defined(EIGEN_CUDACC) || defined(EIGEN_HIPCC)
571 //
572 // For cases where the tweak is specific to HIP, the code should be guarded with
573 // #if defined(EIGEN_HIPCC)
574 //
575 // For cases where the tweak is specific to CUDA, the code should be guarded with
576 // #if defined(EIGEN_CUDACC)
577 //
578 #endif
579 
580 #if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIP_DEVICE_COMPILE)
581 //
582 // If either EIGEN_CUDA_ARCH or EIGEN_HIP_DEVICE_COMPILE is defined, then define EIGEN_GPU_COMPILE_PHASE
583 //
584 #define EIGEN_GPU_COMPILE_PHASE
585 //
586 // GPU compilers (HIPCC, NVCC) typically do two passes over the source code,
587 // + one to compile the source for the "host" (ie CPU)
588 // + another to compile the source for the "device" (ie. GPU)
589 //
590 // Code that needs to enabled only during the either the "host" or "device" compilation phase
591 // needs to be guarded with a macro that indicates the current compilation phase
592 //
593 // EIGEN_HIP_DEVICE_COMPILE implies the device compilation phase in HIP
594 // EIGEN_CUDA_ARCH implies the device compilation phase in CUDA
595 //
596 // In most cases, the "host" / "device" specific code is the same for both HIP and CUDA
597 // For those cases, the code should be guarded with
598 // #if defined(EIGEN_GPU_COMPILE_PHASE)
599 // instead of
600 // #if defined(EIGEN_CUDA_ARCH) || defined(EIGEN_HIP_DEVICE_COMPILE)
601 //
602 // For cases where the tweak is specific to HIP, the code should be guarded with
603 // #if defined(EIGEN_HIP_DEVICE_COMPILE)
604 //
605 // For cases where the tweak is specific to CUDA, the code should be guarded with
606 // #if defined(EIGEN_CUDA_ARCH)
607 //
608 #endif
609 
610 #if defined(EIGEN_USE_SYCL) && defined(__SYCL_DEVICE_ONLY__)
611 // EIGEN_USE_SYCL is a user-defined macro while __SYCL_DEVICE_ONLY__ is a compiler-defined macro.
612 // In most cases we want to check if both macros are defined which can be done using the define below.
613 #define SYCL_DEVICE_ONLY
614 #endif
615 
616 //------------------------------------------------------------------------------------------
617 // Detect Compiler/Architecture/OS specific features
618 //------------------------------------------------------------------------------------------
619 
620 // Cross compiler wrapper around LLVM's __has_builtin
621 #ifdef __has_builtin
622 # define EIGEN_HAS_BUILTIN(x) __has_builtin(x)
623 #else
624 # define EIGEN_HAS_BUILTIN(x) 0
625 #endif
626 
627 // A Clang feature extension to determine compiler features.
628 // We use it to determine 'cxx_rvalue_references'
629 #ifndef __has_feature
630 # define __has_feature(x) 0
631 #endif
632 
633 // The macro EIGEN_CPLUSPLUS is a replacement for __cplusplus/_MSVC_LANG that
634 // works for both platforms, indicating the C++ standard version number.
635 //
636 // With MSVC, without defining /Zc:__cplusplus, the __cplusplus macro will
637 // report 199711L regardless of the language standard specified via /std.
638 // We need to rely on _MSVC_LANG instead, which is only available after
639 // VS2015.3.
640 #if EIGEN_COMP_MSVC_LANG > 0
641 #define EIGEN_CPLUSPLUS EIGEN_COMP_MSVC_LANG
642 #elif EIGEN_COMP_MSVC >= 1900
643 #define EIGEN_CPLUSPLUS 201103L
644 #elif defined(__cplusplus)
645 #define EIGEN_CPLUSPLUS __cplusplus
646 #else
647 #define EIGEN_CPLUSPLUS 0
648 #endif
649 
650 // The macro EIGEN_COMP_CXXVER defines the c++ version expected by the compiler.
651 // For instance, if compiling with gcc and -std=c++17, then EIGEN_COMP_CXXVER
652 // is defined to 17.
653 #if EIGEN_CPLUSPLUS > 201703L
654  #define EIGEN_COMP_CXXVER 20
655 #elif EIGEN_CPLUSPLUS > 201402L
656  #define EIGEN_COMP_CXXVER 17
657 #elif EIGEN_CPLUSPLUS > 201103L
658  #define EIGEN_COMP_CXXVER 14
659 #elif EIGEN_CPLUSPLUS >= 201103L
660  #define EIGEN_COMP_CXXVER 11
661 #else
662  #define EIGEN_COMP_CXXVER 03
663 #endif
664 
665 
666 // The macros EIGEN_HAS_CXX?? defines a rough estimate of available c++ features
667 // but in practice we should not rely on them but rather on the availability of
668 // individual features as defined later.
669 // This is why there is no EIGEN_HAS_CXX17.
670 #if EIGEN_MAX_CPP_VER<14 || EIGEN_COMP_CXXVER<14 || (EIGEN_COMP_MSVC && EIGEN_COMP_MSVC < 1900) || \
671  (EIGEN_COMP_ICC && EIGEN_COMP_ICC < 1500) || (EIGEN_COMP_NVCC && EIGEN_COMP_NVCC < 80000) || \
672  (EIGEN_COMP_CLANG && ((EIGEN_COMP_CLANG<309) || (defined(__apple_build_version__) && (__apple_build_version__ < 9000000)))) || \
673  (EIGEN_COMP_GNUC_STRICT && EIGEN_COMP_GNUC<51)
674 #error This compiler appears to be too old to be supported by Eigen
675 #endif
676 
677 // Does the compiler support C99?
678 // Need to include <cmath> to make sure _GLIBCXX_USE_C99 gets defined
679 #include <cmath>
680 #ifndef EIGEN_HAS_C99_MATH
681 #if ((defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) \
682  || (defined(__GNUC__) && defined(_GLIBCXX_USE_C99)) \
683  || (defined(_LIBCPP_VERSION) && !defined(_MSC_VER)) \
684  || (EIGEN_COMP_MSVC) || defined(SYCL_DEVICE_ONLY))
685  #define EIGEN_HAS_C99_MATH 1
686 #else
687  #define EIGEN_HAS_C99_MATH 0
688 #endif
689 #endif
690 
691 // Does the compiler support std::hash?
692 #ifndef EIGEN_HAS_STD_HASH
693 // The std::hash struct is defined in C++11 but is not labelled as a __device__
694 // function and is not constexpr, so cannot be used on device.
695 #if !defined(EIGEN_GPU_COMPILE_PHASE)
696 #define EIGEN_HAS_STD_HASH 1
697 #else
698 #define EIGEN_HAS_STD_HASH 0
699 #endif
700 #endif // EIGEN_HAS_STD_HASH
701 
702 #ifndef EIGEN_HAS_STD_INVOKE_RESULT
703 #if EIGEN_MAX_CPP_VER >= 17 && EIGEN_COMP_CXXVER >= 17
704 #define EIGEN_HAS_STD_INVOKE_RESULT 1
705 #else
706 #define EIGEN_HAS_STD_INVOKE_RESULT 0
707 #endif
708 #endif
709 
710 #define EIGEN_CONSTEXPR constexpr
711 
712 // Does the compiler support C++11 math?
713 // Let's be conservative and enable the default C++11 implementation only if we are sure it exists
714 #ifndef EIGEN_HAS_CXX11_MATH
715  #if (EIGEN_ARCH_i386_OR_x86_64 && (EIGEN_OS_GNULINUX || EIGEN_OS_WIN_STRICT || EIGEN_OS_MAC))
716  #define EIGEN_HAS_CXX11_MATH 1
717  #else
718  #define EIGEN_HAS_CXX11_MATH 0
719  #endif
720 #endif
721 
722 // NOTE: the required Apple's clang version is very conservative
723 // and it could be that XCode 9 works just fine.
724 // NOTE: the MSVC version is based on https://en.cppreference.com/w/cpp/compiler_support
725 // and not tested.
726 #ifndef EIGEN_HAS_CXX17_OVERALIGN
727 #if EIGEN_MAX_CPP_VER>=17 && EIGEN_COMP_CXXVER>=17 && ( \
728  (EIGEN_COMP_MSVC >= 1912) \
729  || (EIGEN_GNUC_AT_LEAST(7,0)) \
730  || ((!defined(__apple_build_version__)) && (EIGEN_COMP_CLANG>=500)) \
731  || (( defined(__apple_build_version__)) && (__apple_build_version__>=10000000)) \
732  )
733 #define EIGEN_HAS_CXX17_OVERALIGN 1
734 #else
735 #define EIGEN_HAS_CXX17_OVERALIGN 0
736 #endif
737 #endif
738 
739 #if defined(EIGEN_CUDACC)
740  // While available already with c++11, this is useful mostly starting with c++14 and relaxed constexpr rules
741  #if defined(__NVCC__)
742  // nvcc considers constexpr functions as __host__ __device__ with the option --expt-relaxed-constexpr
743  #ifdef __CUDACC_RELAXED_CONSTEXPR__
744  #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
745  #endif
746  #elif defined(__clang__) && defined(__CUDA__) && __has_feature(cxx_relaxed_constexpr)
747  // clang++ always considers constexpr functions as implicitly __host__ __device__
748  #define EIGEN_CONSTEXPR_ARE_DEVICE_FUNC
749  #endif
750 #endif
751 
752 // Does the compiler support the __int128 and __uint128_t extensions for 128-bit
753 // integer arithmetic?
754 //
755 // Clang and GCC define __SIZEOF_INT128__ when these extensions are supported,
756 // but we avoid using them in certain cases:
757 //
758 // * Building using Clang for Windows, where the Clang runtime library has
759 // 128-bit support only on LP64 architectures, but Windows is LLP64.
760 #ifndef EIGEN_HAS_BUILTIN_INT128
761 #if defined(__SIZEOF_INT128__) && !(EIGEN_OS_WIN && EIGEN_COMP_CLANG)
762 #define EIGEN_HAS_BUILTIN_INT128 1
763 #else
764 #define EIGEN_HAS_BUILTIN_INT128 0
765 #endif
766 #endif
767 
768 //------------------------------------------------------------------------------------------
769 // Preprocessor programming helpers
770 //------------------------------------------------------------------------------------------
771 
772 // This macro can be used to prevent from macro expansion, e.g.:
773 // std::max EIGEN_NOT_A_MACRO(a,b)
774 #define EIGEN_NOT_A_MACRO
775 
776 #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl;
777 
778 // concatenate two tokens
779 #define EIGEN_CAT2(a,b) a ## b
780 #define EIGEN_CAT(a,b) EIGEN_CAT2(a,b)
781 
782 #define EIGEN_COMMA ,
783 
784 // convert a token to a string
785 #define EIGEN_MAKESTRING2(a) #a
786 #define EIGEN_MAKESTRING(a) EIGEN_MAKESTRING2(a)
787 
788 // EIGEN_STRONG_INLINE is a stronger version of the inline, using __forceinline on MSVC,
789 // but it still doesn't use GCC's always_inline. This is useful in (common) situations where MSVC needs forceinline
790 // but GCC is still doing fine with just inline.
791 #ifndef EIGEN_STRONG_INLINE
792 #if (EIGEN_COMP_MSVC || EIGEN_COMP_ICC) && !defined(EIGEN_GPUCC)
793 #define EIGEN_STRONG_INLINE __forceinline
794 #else
795 #define EIGEN_STRONG_INLINE inline
796 #endif
797 #endif
798 
799 // EIGEN_ALWAYS_INLINE is the strongest, it has the effect of making the function inline and adding every possible
800 // attribute to maximize inlining. This should only be used when really necessary: in particular,
801 // it uses __attribute__((always_inline)) on GCC, which most of the time is useless and can severely harm compile times.
802 // FIXME with the always_inline attribute,
803 #if EIGEN_COMP_GNUC && !defined(SYCL_DEVICE_ONLY)
804 #define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) inline
805 #else
806 #define EIGEN_ALWAYS_INLINE EIGEN_STRONG_INLINE
807 #endif
808 
809 #if EIGEN_COMP_GNUC
810 #define EIGEN_DONT_INLINE __attribute__((noinline))
811 #elif EIGEN_COMP_MSVC
812 #define EIGEN_DONT_INLINE __declspec(noinline)
813 #else
814 #define EIGEN_DONT_INLINE
815 #endif
816 
817 #if EIGEN_COMP_GNUC
818 #define EIGEN_PERMISSIVE_EXPR __extension__
819 #else
820 #define EIGEN_PERMISSIVE_EXPR
821 #endif
822 
823 // GPU stuff
824 
825 // Disable some features when compiling with GPU compilers (NVCC/clang-cuda/SYCL/HIPCC)
826 #if defined(EIGEN_CUDACC) || defined(SYCL_DEVICE_ONLY) || defined(EIGEN_HIPCC)
827  // Do not try asserts on device code
828  #ifndef EIGEN_NO_DEBUG
829  #define EIGEN_NO_DEBUG
830  #endif
831 
832  #ifdef EIGEN_INTERNAL_DEBUGGING
833  #undef EIGEN_INTERNAL_DEBUGGING
834  #endif
835 
836  #ifdef EIGEN_EXCEPTIONS
837  #undef EIGEN_EXCEPTIONS
838  #endif
839 #endif
840 
841 #if defined(SYCL_DEVICE_ONLY)
842  #ifndef EIGEN_DONT_VECTORIZE
843  #define EIGEN_DONT_VECTORIZE
844  #endif
845  #define EIGEN_DEVICE_FUNC __attribute__((flatten)) __attribute__((always_inline))
846 // All functions callable from CUDA/HIP code must be qualified with __device__
847 #elif defined(EIGEN_GPUCC)
848  #define EIGEN_DEVICE_FUNC __host__ __device__
849 #else
850  #define EIGEN_DEVICE_FUNC
851 #endif
852 
853 
854 // this macro allows to get rid of linking errors about multiply defined functions.
855 // - static is not very good because it prevents definitions from different object files to be merged.
856 // So static causes the resulting linked executable to be bloated with multiple copies of the same function.
857 // - inline is not perfect either as it unwantedly hints the compiler toward inlining the function.
858 #define EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC
859 #define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC inline
860 
861 #ifdef NDEBUG
862 # ifndef EIGEN_NO_DEBUG
863 # define EIGEN_NO_DEBUG
864 # endif
865 #endif
866 
867 // eigen_plain_assert is where we implement the workaround for the assert() bug in GCC <= 4.3, see bug 89
868 #ifdef EIGEN_NO_DEBUG
869  #ifdef SYCL_DEVICE_ONLY // used to silence the warning on SYCL device
870  #define eigen_plain_assert(x) EIGEN_UNUSED_VARIABLE(x)
871  #else
872  #define eigen_plain_assert(x)
873  #endif
874 #else
875  #define eigen_plain_assert(x) assert(x)
876 #endif
877 
878 // eigen_assert can be overridden
879 #ifndef eigen_assert
880 #define eigen_assert(x) eigen_plain_assert(x)
881 #endif
882 
883 #ifdef EIGEN_INTERNAL_DEBUGGING
884 #define eigen_internal_assert(x) eigen_assert(x)
885 #else
886 #define eigen_internal_assert(x)
887 #endif
888 
889 #ifdef EIGEN_NO_DEBUG
890 #define EIGEN_ONLY_USED_FOR_DEBUG(x) EIGEN_UNUSED_VARIABLE(x)
891 #else
892 #define EIGEN_ONLY_USED_FOR_DEBUG(x)
893 #endif
894 
895 #ifndef EIGEN_NO_DEPRECATED_WARNING
896  #if EIGEN_COMP_GNUC
897  #define EIGEN_DEPRECATED __attribute__((deprecated))
898  #elif EIGEN_COMP_MSVC
899  #define EIGEN_DEPRECATED __declspec(deprecated)
900  #else
901  #define EIGEN_DEPRECATED
902  #endif
903 #else
904  #define EIGEN_DEPRECATED
905 #endif
906 
907 #if EIGEN_COMP_GNUC
908 #define EIGEN_UNUSED __attribute__((unused))
909 #else
910 #define EIGEN_UNUSED
911 #endif
912 
913 // Suppresses 'unused variable' warnings.
914 namespace Eigen {
915  namespace internal {
916  template<typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE constexpr void ignore_unused_variable(const T&) {}
917  }
918 }
919 #define EIGEN_UNUSED_VARIABLE(var) Eigen::internal::ignore_unused_variable(var);
920 
921 #if !defined(EIGEN_ASM_COMMENT)
922  #if EIGEN_COMP_GNUC && (EIGEN_ARCH_i386_OR_x86_64 || EIGEN_ARCH_ARM_OR_ARM64)
923  #define EIGEN_ASM_COMMENT(X) __asm__("#" X)
924  #else
925  #define EIGEN_ASM_COMMENT(X)
926  #endif
927 #endif
928 
929 
930 // Acts as a barrier preventing operations involving `X` from crossing. This
931 // occurs, for example, in the fast rounding trick where a magic constant is
932 // added then subtracted, which is otherwise compiled away with -ffast-math.
933 //
934 // See bug 1674
935 #if !defined(EIGEN_OPTIMIZATION_BARRIER)
936  #if EIGEN_COMP_GNUC
937  // According to https://gcc.gnu.org/onlinedocs/gcc/Constraints.html:
938  // X: Any operand whatsoever.
939  // r: A register operand is allowed provided that it is in a general
940  // register.
941  // g: Any register, memory or immediate integer operand is allowed, except
942  // for registers that are not general registers.
943  // w: (AArch32/AArch64) Floating point register, Advanced SIMD vector
944  // register or SVE vector register.
945  // x: (SSE) Any SSE register.
946  // (AArch64) Like w, but restricted to registers 0 to 15 inclusive.
947  // v: (PowerPC) An Altivec vector register.
948  // wa:(PowerPC) A VSX register.
949  //
950  // "X" (uppercase) should work for all cases, though this seems to fail for
951  // some versions of GCC for arm/aarch64 with
952  // "error: inconsistent operand constraints in an 'asm'"
953  // Clang x86_64/arm/aarch64 seems to require "g" to support both scalars and
954  // vectors, otherwise
955  // "error: non-trivial scalar-to-vector conversion, possible invalid
956  // constraint for vector type"
957  //
958  // GCC for ppc64le generates an internal compiler error with x/X/g.
959  // GCC for AVX generates an internal compiler error with X.
960  //
961  // Tested on icc/gcc/clang for sse, avx, avx2, avx512dq
962  // gcc for arm, aarch64,
963  // gcc for ppc64le,
964  // both vectors and scalars.
965  //
966  // Note that this is restricted to plain types - this will not work
967  // directly for std::complex<T>, Eigen::half, Eigen::bfloat16. For these,
968  // you will need to apply to the underlying POD type.
969  #if EIGEN_ARCH_PPC && EIGEN_COMP_GNUC_STRICT
970  // This seems to be broken on clang. Packet4f is loaded into a single
971  // register rather than a vector, zeroing out some entries. Integer
972  // types also generate a compile error.
973  // General, Altivec, VSX.
974  #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+r,v,wa" (X));
975  #elif EIGEN_ARCH_ARM_OR_ARM64
976  #ifdef __ARM_FP
977  // General, VFP or NEON.
978  // Clang doesn't like "r",
979  // error: non-trivial scalar-to-vector conversion, possible invalid
980  // constraint for vector typ
981  #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,w" (X));
982  #else
983  // Arm without VFP or NEON.
984  // "w" constraint will not compile.
985  #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g" (X));
986  #endif
987  #elif EIGEN_ARCH_i386_OR_x86_64
988  // General, SSE.
989  #define EIGEN_OPTIMIZATION_BARRIER(X) __asm__ ("" : "+g,x" (X));
990  #else
991  // Not implemented for other architectures.
992  #define EIGEN_OPTIMIZATION_BARRIER(X)
993  #endif
994  #else
995  // Not implemented for other compilers.
996  #define EIGEN_OPTIMIZATION_BARRIER(X)
997  #endif
998 #endif
999 
1000 #if EIGEN_COMP_MSVC
1001  // NOTE MSVC often gives C4127 warnings with compiletime if statements. See bug 1362.
1002  // This workaround is ugly, but it does the job.
1003 # define EIGEN_CONST_CONDITIONAL(cond) (void)0, cond
1004 #else
1005 # define EIGEN_CONST_CONDITIONAL(cond) cond
1006 #endif
1007 
1008 #ifdef EIGEN_DONT_USE_RESTRICT_KEYWORD
1009  #define EIGEN_RESTRICT
1010 #endif
1011 #ifndef EIGEN_RESTRICT
1012  #define EIGEN_RESTRICT __restrict
1013 #endif
1014 
1015 
1016 #ifndef EIGEN_DEFAULT_IO_FORMAT
1017 #ifdef EIGEN_MAKING_DOCS
1018 // format used in Eigen's documentation
1019 // needed to define it here as escaping characters in CMake add_definition's argument seems very problematic.
1020 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat(3, 0, " ", "\n", "", "")
1021 #else
1022 #define EIGEN_DEFAULT_IO_FORMAT Eigen::IOFormat()
1023 #endif
1024 #endif
1025 
1026 // just an empty macro !
1027 #define EIGEN_EMPTY
1028 
1029 
1030 // When compiling CUDA/HIP device code with NVCC or HIPCC
1031 // pull in math functions from the global namespace.
1032 // In host mode, and when device code is compiled with clang,
1033 // use the std versions.
1034 #if (defined(EIGEN_CUDA_ARCH) && defined(__NVCC__)) || defined(EIGEN_HIP_DEVICE_COMPILE)
1035  #define EIGEN_USING_STD(FUNC) using ::FUNC;
1036 #else
1037  #define EIGEN_USING_STD(FUNC) using std::FUNC;
1038 #endif
1039 
1040 #if EIGEN_COMP_MSVC_STRICT && EIGEN_COMP_NVCC
1041  // Wwhen compiling with NVCC, using the base operator is necessary,
1042  // otherwise we get duplicate definition errors
1043  // For later MSVC versions, we require explicit operator= definition, otherwise we get
1044  // use of implicitly deleted operator errors.
1045  // (cf Bugs 920, 1000, 1324, 2291)
1046  #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1047  using Base::operator =;
1048 #elif EIGEN_COMP_CLANG // workaround clang bug (see http://forum.kde.org/viewtopic.php?f=74&t=102653)
1049  #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1050  using Base::operator =; \
1051  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) { Base::operator=(other); return *this; } \
1052  template <typename OtherDerived> \
1053  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other) { Base::operator=(other.derived()); return *this; }
1054 #else
1055  #define EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1056  using Base::operator =; \
1057  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const Derived& other) \
1058  { \
1059  Base::operator=(other); \
1060  return *this; \
1061  }
1062 #endif
1063 
1064 
1070 #define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS) EIGEN_DEVICE_FUNC CLASS(const CLASS&) = default;
1071 
1072 
1073 
1079 #define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived) \
1080  EIGEN_INHERIT_ASSIGNMENT_EQUAL_OPERATOR(Derived) \
1081  EIGEN_DEFAULT_COPY_CONSTRUCTOR(Derived)
1082 
1090 #define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived) \
1091  EIGEN_DEVICE_FUNC Derived() = default; \
1092  EIGEN_DEVICE_FUNC ~Derived() = default;
1093 
1094 
1095 
1096 
1097 
1106 #define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
1107  typedef typename Eigen::internal::traits<Derived>::Scalar Scalar; \
1108  typedef typename Eigen::NumTraits<Scalar>::Real RealScalar; \
1109  typedef typename Base::CoeffReturnType CoeffReturnType; \
1110  typedef typename Eigen::internal::ref_selector<Derived>::type Nested; \
1111  typedef typename Eigen::internal::traits<Derived>::StorageKind StorageKind; \
1112  typedef typename Eigen::internal::traits<Derived>::StorageIndex StorageIndex; \
1113  enum CompileTimeTraits \
1114  { RowsAtCompileTime = Eigen::internal::traits<Derived>::RowsAtCompileTime, \
1115  ColsAtCompileTime = Eigen::internal::traits<Derived>::ColsAtCompileTime, \
1116  Flags = Eigen::internal::traits<Derived>::Flags, \
1117  SizeAtCompileTime = Base::SizeAtCompileTime, \
1118  MaxSizeAtCompileTime = Base::MaxSizeAtCompileTime, \
1119  IsVectorAtCompileTime = Base::IsVectorAtCompileTime }; \
1120  using Base::derived; \
1121  using Base::const_cast_derived;
1122 
1123 
1124 // FIXME Maybe the EIGEN_DENSE_PUBLIC_INTERFACE could be removed as importing PacketScalar is rarely needed
1125 #define EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \
1126  EIGEN_GENERIC_PUBLIC_INTERFACE(Derived) \
1127  typedef typename Base::PacketScalar PacketScalar;
1128 
1129 
1130 #if EIGEN_HAS_BUILTIN(__builtin_expect) || EIGEN_COMP_GNUC
1131 #define EIGEN_PREDICT_FALSE(x) (__builtin_expect(x, false))
1132 #define EIGEN_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
1133 #else
1134 #define EIGEN_PREDICT_FALSE(x) (x)
1135 #define EIGEN_PREDICT_TRUE(x) (x)
1136 #endif
1137 
1138 // the expression type of a standard coefficient wise binary operation
1139 #define EIGEN_CWISE_BINARY_RETURN_TYPE(LHS,RHS,OPNAME) \
1140  CwiseBinaryOp< \
1141  EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)< \
1142  typename internal::traits<LHS>::Scalar, \
1143  typename internal::traits<RHS>::Scalar \
1144  >, \
1145  const LHS, \
1146  const RHS \
1147  >
1148 
1149 #define EIGEN_MAKE_CWISE_BINARY_OP(METHOD,OPNAME) \
1150  template<typename OtherDerived> \
1151  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,OPNAME) \
1152  (METHOD)(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const \
1153  { \
1154  return EIGEN_CWISE_BINARY_RETURN_TYPE(Derived,OtherDerived,OPNAME)(derived(), other.derived()); \
1155  }
1156 
1157 #define EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,TYPEA,TYPEB) \
1158  (Eigen::internal::has_ReturnType<Eigen::ScalarBinaryOpTraits<TYPEA,TYPEB,EIGEN_CAT(EIGEN_CAT(Eigen::internal::scalar_,OPNAME),_op)<TYPEA,TYPEB> > >::value)
1159 
1160 #define EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(EXPR,SCALAR,OPNAME) \
1161  CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<typename internal::traits<EXPR>::Scalar,SCALAR>, const EXPR, \
1162  const typename internal::plain_constant_type<EXPR,SCALAR>::type>
1163 
1164 #define EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(SCALAR,EXPR,OPNAME) \
1165  CwiseBinaryOp<EIGEN_CAT(EIGEN_CAT(internal::scalar_,OPNAME),_op)<SCALAR,typename internal::traits<EXPR>::Scalar>, \
1166  const typename internal::plain_constant_type<EXPR,SCALAR>::type, const EXPR>
1167 
1168 #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME) \
1169  template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
1170  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)\
1171  (METHOD)(const T& scalar) const { \
1172  typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,Scalar,T)>::type PromotedT; \
1173  return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedT,OPNAME)(derived(), \
1174  typename internal::plain_constant_type<Derived,PromotedT>::type(derived().rows(), derived().cols(), internal::scalar_constant_op<PromotedT>(scalar))); \
1175  }
1176 
1177 #define EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \
1178  template <typename T> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE friend \
1179  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) \
1180  (METHOD)(const T& scalar, const StorageBaseType& matrix) { \
1181  typedef typename internal::promote_scalar_arg<Scalar,T,EIGEN_SCALAR_BINARY_SUPPORTED(OPNAME,T,Scalar)>::type PromotedT; \
1182  return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedT,Derived,OPNAME)( \
1183  typename internal::plain_constant_type<Derived,PromotedT>::type(matrix.derived().rows(), matrix.derived().cols(), internal::scalar_constant_op<PromotedT>(scalar)), matrix.derived()); \
1184  }
1185 
1186 #define EIGEN_MAKE_SCALAR_BINARY_OP(METHOD,OPNAME) \
1187  EIGEN_MAKE_SCALAR_BINARY_OP_ONTHELEFT(METHOD,OPNAME) \
1188  EIGEN_MAKE_SCALAR_BINARY_OP_ONTHERIGHT(METHOD,OPNAME)
1189 
1190 
1191 #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_CUDA_ARCH) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL) && !defined(EIGEN_HIP_DEVICE_COMPILE)
1192  #define EIGEN_EXCEPTIONS
1193 #endif
1194 
1195 
1196 #ifdef EIGEN_EXCEPTIONS
1197 # define EIGEN_THROW_X(X) throw X
1198 # define EIGEN_THROW throw
1199 # define EIGEN_TRY try
1200 # define EIGEN_CATCH(X) catch (X)
1201 #else
1202 # if defined(EIGEN_CUDA_ARCH)
1203 # define EIGEN_THROW_X(X) asm("trap;")
1204 # define EIGEN_THROW asm("trap;")
1205 # elif defined(EIGEN_HIP_DEVICE_COMPILE)
1206 # define EIGEN_THROW_X(X) asm("s_trap 0")
1207 # define EIGEN_THROW asm("s_trap 0")
1208 # else
1209 # define EIGEN_THROW_X(X) std::abort()
1210 # define EIGEN_THROW std::abort()
1211 # endif
1212 # define EIGEN_TRY if (true)
1213 # define EIGEN_CATCH(X) else
1214 #endif
1215 
1216 
1217 #define EIGEN_NOEXCEPT noexcept
1218 #define EIGEN_NOEXCEPT_IF(x) noexcept(x)
1219 #define EIGEN_NO_THROW noexcept(true)
1220 #define EIGEN_EXCEPTION_SPEC(X) noexcept(false)
1221 
1222 
1223 // The all function is used to enable a variadic version of eigen_assert which can take a parameter pack as its input.
1224 namespace Eigen {
1225 namespace internal {
1226 
1227 inline bool all(){ return true; }
1228 
1229 template<typename T, typename ...Ts>
1230 bool all(T t, Ts ... ts){ return t && all(ts...); }
1231 
1232 }
1233 }
1234 
1235 // provide override and final specifiers if they are available:
1236 #define EIGEN_OVERRIDE override
1237 #define EIGEN_FINAL final
1238 
1239 // Wrapping #pragma unroll in a macro since it is required for SYCL
1240 #if defined(SYCL_DEVICE_ONLY)
1241  #if defined(_MSC_VER)
1242  #define EIGEN_UNROLL_LOOP __pragma(unroll)
1243  #else
1244  #define EIGEN_UNROLL_LOOP _Pragma("unroll")
1245  #endif
1246 #else
1247  #define EIGEN_UNROLL_LOOP
1248 #endif
1249 
1250 #endif // EIGEN_MACROS_H
static const Eigen::internal::all_t all
Definition: IndexedViewHelper.h:189
Namespace containing all symbols from the Eigen library.
Definition: Core:139