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