1 | // This file is part of Eigen, a lightweight C++ template library |
---|---|
2 | // for linear algebra. |
3 | // |
4 | // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> |
5 | // Copyright (C) 2007-2011 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_CORE_H |
12 | #define EIGEN_CORE_H |
13 | |
14 | // first thing Eigen does: stop the compiler from reporting useless warnings. |
15 | #include "src/Core/util/DisableStupidWarnings.h" |
16 | |
17 | // then include this file where all our macros are defined. It's really important to do it first because |
18 | // it's where we do all the compiler/OS/arch detections and define most defaults. |
19 | #include "src/Core/util/Macros.h" |
20 | |
21 | // This detects SSE/AVX/NEON/etc. and configure alignment settings |
22 | #include "src/Core/util/ConfigureVectorization.h" |
23 | |
24 | // We need cuda_runtime.h/hip_runtime.h to ensure that |
25 | // the EIGEN_USING_STD macro works properly on the device side |
26 | #if defined(EIGEN_CUDACC) |
27 | #include <cuda_runtime.h> |
28 | #elif defined(EIGEN_HIPCC) |
29 | #include <hip/hip_runtime.h> |
30 | #endif |
31 | |
32 | |
33 | #ifdef EIGEN_EXCEPTIONS |
34 | #include <new> |
35 | #endif |
36 | |
37 | // Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3) |
38 | // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details. |
39 | #if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6) && EIGEN_GNUC_AT_MOST(5,5) |
40 | #pragma GCC optimize ("-fno-ipa-cp-clone") |
41 | #endif |
42 | |
43 | // Prevent ICC from specializing std::complex operators that silently fail |
44 | // on device. This allows us to use our own device-compatible specializations |
45 | // instead. |
46 | #if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \ |
47 | && !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_) |
48 | #define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1 |
49 | #endif |
50 | #include <complex> |
51 | |
52 | // this include file manages BLAS and MKL related macros |
53 | // and inclusion of their respective header files |
54 | #include "src/Core/util/MKL_support.h" |
55 | |
56 | |
57 | #if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16) |
58 | #define EIGEN_HAS_GPU_FP16 |
59 | #endif |
60 | |
61 | #if defined(EIGEN_HAS_CUDA_BF16) || defined(EIGEN_HAS_HIP_BF16) |
62 | #define EIGEN_HAS_GPU_BF16 |
63 | #endif |
64 | |
65 | #if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) |
66 | #define EIGEN_HAS_OPENMP |
67 | #endif |
68 | |
69 | #ifdef EIGEN_HAS_OPENMP |
70 | #include <omp.h> |
71 | #endif |
72 | |
73 | // MSVC for windows mobile does not have the errno.h file |
74 | #if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM |
75 | #define EIGEN_HAS_ERRNO |
76 | #endif |
77 | |
78 | #ifdef EIGEN_HAS_ERRNO |
79 | #include <cerrno> |
80 | #endif |
81 | #include <cstddef> |
82 | #include <cstdlib> |
83 | #include <cmath> |
84 | #include <cassert> |
85 | #include <functional> |
86 | #include <sstream> |
87 | #ifndef EIGEN_NO_IO |
88 | #include <iosfwd> |
89 | #endif |
90 | #include <cstring> |
91 | #include <string> |
92 | #include <limits> |
93 | #include <climits> // for CHAR_BIT |
94 | // for min/max: |
95 | #include <algorithm> |
96 | |
97 | #if EIGEN_HAS_CXX11 |
98 | #include <array> |
99 | #endif |
100 | |
101 | // for std::is_nothrow_move_assignable |
102 | #ifdef EIGEN_INCLUDE_TYPE_TRAITS |
103 | #include <type_traits> |
104 | #endif |
105 | |
106 | // for outputting debug info |
107 | #ifdef EIGEN_DEBUG_ASSIGN |
108 | #include <iostream> |
109 | #endif |
110 | |
111 | // required for __cpuid, needs to be included after cmath |
112 | #if EIGEN_COMP_MSVC && EIGEN_ARCH_i386_OR_x86_64 && !EIGEN_OS_WINCE |
113 | #include <intrin.h> |
114 | #endif |
115 | |
116 | #if defined(EIGEN_USE_SYCL) |
117 | #undef min |
118 | #undef max |
119 | #undef isnan |
120 | #undef isinf |
121 | #undef isfinite |
122 | #include <CL/sycl.hpp> |
123 | #include <map> |
124 | #include <memory> |
125 | #include <utility> |
126 | #include <thread> |
127 | #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM0 |
128 | #define EIGEN_SYCL_LOCAL_THREAD_DIM0 16 |
129 | #endif |
130 | #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM1 |
131 | #define EIGEN_SYCL_LOCAL_THREAD_DIM1 16 |
132 | #endif |
133 | #endif |
134 | |
135 | |
136 | #if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS || defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API || defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS || defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API || defined EIGEN2_SUPPORT |
137 | // This will generate an error message: |
138 | #error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information |
139 | #endif |
140 | |
141 | namespace Eigen { |
142 | |
143 | // we use size_t frequently and we'll never remember to prepend it with std:: every time just to |
144 | // ensure QNX/QCC support |
145 | using std::size_t; |
146 | // gcc 4.6.0 wants std:: for ptrdiff_t |
147 | using std::ptrdiff_t; |
148 | |
149 | } |
150 | |
151 | /** \defgroup Core_Module Core module |
152 | * This is the main module of Eigen providing dense matrix and vector support |
153 | * (both fixed and dynamic size) with all the features corresponding to a BLAS library |
154 | * and much more... |
155 | * |
156 | * \code |
157 | * #include <Eigen/Core> |
158 | * \endcode |
159 | */ |
160 | |
161 | #include "src/Core/util/Constants.h" |
162 | #include "src/Core/util/Meta.h" |
163 | #include "src/Core/util/ForwardDeclarations.h" |
164 | #include "src/Core/util/StaticAssert.h" |
165 | #include "src/Core/util/XprHelper.h" |
166 | #include "src/Core/util/Memory.h" |
167 | #include "src/Core/util/IntegralConstant.h" |
168 | #include "src/Core/util/SymbolicIndex.h" |
169 | |
170 | #include "src/Core/NumTraits.h" |
171 | #include "src/Core/MathFunctions.h" |
172 | #include "src/Core/GenericPacketMath.h" |
173 | #include "src/Core/MathFunctionsImpl.h" |
174 | #include "src/Core/arch/Default/ConjHelper.h" |
175 | // Generic half float support |
176 | #include "src/Core/arch/Default/Half.h" |
177 | #include "src/Core/arch/Default/BFloat16.h" |
178 | #include "src/Core/arch/Default/TypeCasting.h" |
179 | #include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h" |
180 | |
181 | #if defined EIGEN_VECTORIZE_AVX512 |
182 | #include "src/Core/arch/SSE/PacketMath.h" |
183 | #include "src/Core/arch/SSE/TypeCasting.h" |
184 | #include "src/Core/arch/SSE/Complex.h" |
185 | #include "src/Core/arch/AVX/PacketMath.h" |
186 | #include "src/Core/arch/AVX/TypeCasting.h" |
187 | #include "src/Core/arch/AVX/Complex.h" |
188 | #include "src/Core/arch/AVX512/PacketMath.h" |
189 | #include "src/Core/arch/AVX512/TypeCasting.h" |
190 | #include "src/Core/arch/AVX512/Complex.h" |
191 | #include "src/Core/arch/SSE/MathFunctions.h" |
192 | #include "src/Core/arch/AVX/MathFunctions.h" |
193 | #include "src/Core/arch/AVX512/MathFunctions.h" |
194 | #elif defined EIGEN_VECTORIZE_AVX |
195 | // Use AVX for floats and doubles, SSE for integers |
196 | #include "src/Core/arch/SSE/PacketMath.h" |
197 | #include "src/Core/arch/SSE/TypeCasting.h" |
198 | #include "src/Core/arch/SSE/Complex.h" |
199 | #include "src/Core/arch/AVX/PacketMath.h" |
200 | #include "src/Core/arch/AVX/TypeCasting.h" |
201 | #include "src/Core/arch/AVX/Complex.h" |
202 | #include "src/Core/arch/SSE/MathFunctions.h" |
203 | #include "src/Core/arch/AVX/MathFunctions.h" |
204 | #elif defined EIGEN_VECTORIZE_SSE |
205 | #include "src/Core/arch/SSE/PacketMath.h" |
206 | #include "src/Core/arch/SSE/TypeCasting.h" |
207 | #include "src/Core/arch/SSE/MathFunctions.h" |
208 | #include "src/Core/arch/SSE/Complex.h" |
209 | #elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) |
210 | #include "src/Core/arch/AltiVec/PacketMath.h" |
211 | #include "src/Core/arch/AltiVec/MathFunctions.h" |
212 | #include "src/Core/arch/AltiVec/Complex.h" |
213 | #elif defined EIGEN_VECTORIZE_NEON |
214 | #include "src/Core/arch/NEON/PacketMath.h" |
215 | #include "src/Core/arch/NEON/TypeCasting.h" |
216 | #include "src/Core/arch/NEON/MathFunctions.h" |
217 | #include "src/Core/arch/NEON/Complex.h" |
218 | #elif defined EIGEN_VECTORIZE_SVE |
219 | #include "src/Core/arch/SVE/PacketMath.h" |
220 | #include "src/Core/arch/SVE/TypeCasting.h" |
221 | #include "src/Core/arch/SVE/MathFunctions.h" |
222 | #elif defined EIGEN_VECTORIZE_ZVECTOR |
223 | #include "src/Core/arch/ZVector/PacketMath.h" |
224 | #include "src/Core/arch/ZVector/MathFunctions.h" |
225 | #include "src/Core/arch/ZVector/Complex.h" |
226 | #elif defined EIGEN_VECTORIZE_MSA |
227 | #include "src/Core/arch/MSA/PacketMath.h" |
228 | #include "src/Core/arch/MSA/MathFunctions.h" |
229 | #include "src/Core/arch/MSA/Complex.h" |
230 | #endif |
231 | |
232 | #if defined EIGEN_VECTORIZE_GPU |
233 | #include "src/Core/arch/GPU/PacketMath.h" |
234 | #include "src/Core/arch/GPU/MathFunctions.h" |
235 | #include "src/Core/arch/GPU/TypeCasting.h" |
236 | #endif |
237 | |
238 | #if defined(EIGEN_USE_SYCL) |
239 | #include "src/Core/arch/SYCL/SyclMemoryModel.h" |
240 | #include "src/Core/arch/SYCL/InteropHeaders.h" |
241 | #if !defined(EIGEN_DONT_VECTORIZE_SYCL) |
242 | #include "src/Core/arch/SYCL/PacketMath.h" |
243 | #include "src/Core/arch/SYCL/MathFunctions.h" |
244 | #include "src/Core/arch/SYCL/TypeCasting.h" |
245 | #endif |
246 | #endif |
247 | |
248 | #include "src/Core/arch/Default/Settings.h" |
249 | // This file provides generic implementations valid for scalar as well |
250 | #include "src/Core/arch/Default/GenericPacketMathFunctions.h" |
251 | |
252 | #include "src/Core/functors/TernaryFunctors.h" |
253 | #include "src/Core/functors/BinaryFunctors.h" |
254 | #include "src/Core/functors/UnaryFunctors.h" |
255 | #include "src/Core/functors/NullaryFunctors.h" |
256 | #include "src/Core/functors/StlFunctors.h" |
257 | #include "src/Core/functors/AssignmentFunctors.h" |
258 | |
259 | // Specialized functors to enable the processing of complex numbers |
260 | // on CUDA devices |
261 | #ifdef EIGEN_CUDACC |
262 | #include "src/Core/arch/CUDA/Complex.h" |
263 | #endif |
264 | |
265 | #include "src/Core/util/IndexedViewHelper.h" |
266 | #include "src/Core/util/ReshapedHelper.h" |
267 | #include "src/Core/ArithmeticSequence.h" |
268 | #ifndef EIGEN_NO_IO |
269 | #include "src/Core/IO.h" |
270 | #endif |
271 | #include "src/Core/DenseCoeffsBase.h" |
272 | #include "src/Core/DenseBase.h" |
273 | #include "src/Core/MatrixBase.h" |
274 | #include "src/Core/EigenBase.h" |
275 | |
276 | #include "src/Core/Product.h" |
277 | #include "src/Core/CoreEvaluators.h" |
278 | #include "src/Core/AssignEvaluator.h" |
279 | |
280 | #ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 |
281 | // at least confirmed with Doxygen 1.5.5 and 1.5.6 |
282 | #include "src/Core/Assign.h" |
283 | #endif |
284 | |
285 | #include "src/Core/ArrayBase.h" |
286 | #include "src/Core/util/BlasUtil.h" |
287 | #include "src/Core/DenseStorage.h" |
288 | #include "src/Core/NestByValue.h" |
289 | |
290 | // #include "src/Core/ForceAlignedAccess.h" |
291 | |
292 | #include "src/Core/ReturnByValue.h" |
293 | #include "src/Core/NoAlias.h" |
294 | #include "src/Core/PlainObjectBase.h" |
295 | #include "src/Core/Matrix.h" |
296 | #include "src/Core/Array.h" |
297 | #include "src/Core/CwiseTernaryOp.h" |
298 | #include "src/Core/CwiseBinaryOp.h" |
299 | #include "src/Core/CwiseUnaryOp.h" |
300 | #include "src/Core/CwiseNullaryOp.h" |
301 | #include "src/Core/CwiseUnaryView.h" |
302 | #include "src/Core/SelfCwiseBinaryOp.h" |
303 | #include "src/Core/Dot.h" |
304 | #include "src/Core/StableNorm.h" |
305 | #include "src/Core/Stride.h" |
306 | #include "src/Core/MapBase.h" |
307 | #include "src/Core/Map.h" |
308 | #include "src/Core/Ref.h" |
309 | #include "src/Core/Block.h" |
310 | #include "src/Core/VectorBlock.h" |
311 | #include "src/Core/IndexedView.h" |
312 | #include "src/Core/Reshaped.h" |
313 | #include "src/Core/Transpose.h" |
314 | #include "src/Core/DiagonalMatrix.h" |
315 | #include "src/Core/Diagonal.h" |
316 | #include "src/Core/DiagonalProduct.h" |
317 | #include "src/Core/Redux.h" |
318 | #include "src/Core/Visitor.h" |
319 | #include "src/Core/Fuzzy.h" |
320 | #include "src/Core/Swap.h" |
321 | #include "src/Core/CommaInitializer.h" |
322 | #include "src/Core/GeneralProduct.h" |
323 | #include "src/Core/Solve.h" |
324 | #include "src/Core/Inverse.h" |
325 | #include "src/Core/SolverBase.h" |
326 | #include "src/Core/PermutationMatrix.h" |
327 | #include "src/Core/Transpositions.h" |
328 | #include "src/Core/TriangularMatrix.h" |
329 | #include "src/Core/SelfAdjointView.h" |
330 | #include "src/Core/products/GeneralBlockPanelKernel.h" |
331 | #include "src/Core/products/Parallelizer.h" |
332 | #include "src/Core/ProductEvaluators.h" |
333 | #include "src/Core/products/GeneralMatrixVector.h" |
334 | #include "src/Core/products/GeneralMatrixMatrix.h" |
335 | #include "src/Core/SolveTriangular.h" |
336 | #include "src/Core/products/GeneralMatrixMatrixTriangular.h" |
337 | #include "src/Core/products/SelfadjointMatrixVector.h" |
338 | #include "src/Core/products/SelfadjointMatrixMatrix.h" |
339 | #include "src/Core/products/SelfadjointProduct.h" |
340 | #include "src/Core/products/SelfadjointRank2Update.h" |
341 | #include "src/Core/products/TriangularMatrixVector.h" |
342 | #include "src/Core/products/TriangularMatrixMatrix.h" |
343 | #include "src/Core/products/TriangularSolverMatrix.h" |
344 | #include "src/Core/products/TriangularSolverVector.h" |
345 | #include "src/Core/BandMatrix.h" |
346 | #include "src/Core/CoreIterators.h" |
347 | #include "src/Core/ConditionEstimator.h" |
348 | |
349 | #if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) |
350 | #include "src/Core/arch/AltiVec/MatrixProduct.h" |
351 | #elif defined EIGEN_VECTORIZE_NEON |
352 | #include "src/Core/arch/NEON/GeneralBlockPanelKernel.h" |
353 | #endif |
354 | |
355 | #include "src/Core/BooleanRedux.h" |
356 | #include "src/Core/Select.h" |
357 | #include "src/Core/VectorwiseOp.h" |
358 | #include "src/Core/PartialReduxEvaluator.h" |
359 | #include "src/Core/Random.h" |
360 | #include "src/Core/Replicate.h" |
361 | #include "src/Core/Reverse.h" |
362 | #include "src/Core/ArrayWrapper.h" |
363 | #include "src/Core/StlIterators.h" |
364 | |
365 | #ifdef EIGEN_USE_BLAS |
366 | #include "src/Core/products/GeneralMatrixMatrix_BLAS.h" |
367 | #include "src/Core/products/GeneralMatrixVector_BLAS.h" |
368 | #include "src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h" |
369 | #include "src/Core/products/SelfadjointMatrixMatrix_BLAS.h" |
370 | #include "src/Core/products/SelfadjointMatrixVector_BLAS.h" |
371 | #include "src/Core/products/TriangularMatrixMatrix_BLAS.h" |
372 | #include "src/Core/products/TriangularMatrixVector_BLAS.h" |
373 | #include "src/Core/products/TriangularSolverMatrix_BLAS.h" |
374 | #endif // EIGEN_USE_BLAS |
375 | |
376 | #ifdef EIGEN_USE_MKL_VML |
377 | #include "src/Core/Assign_MKL.h" |
378 | #endif |
379 | |
380 | #include "src/Core/GlobalFunctions.h" |
381 | |
382 | #include "src/Core/util/ReenableStupidWarnings.h" |
383 | |
384 | #endif // EIGEN_CORE_H |
385 |