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