Coverage Report

Created: 2023-12-08 06:52

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