2009-05-06 23:48:28 +08:00
// This file is part of Eigen, a lightweight C++ template library
2009-05-23 02:25:33 +08:00
// for linear algebra.
2009-05-06 23:48:28 +08:00
//
2010-06-25 05:21:58 +08:00
// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
2011-01-27 23:34:44 +08:00
// Copyright (C) 2007-2011 Benoit Jacob <jacob.benoit.1@gmail.com>
2009-05-06 23:48:28 +08:00
//
2012-07-14 02:42:47 +08:00
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
2009-05-06 23:48:28 +08:00
2008-03-26 17:13:11 +08:00
#ifndef EIGEN_CORE_H
#define EIGEN_CORE_H
2016-10-14 23:39:41 +08:00
// first thing Eigen does: stop the compiler from committing suicide
#include "src/Core/util/DisableStupidWarnings.h"
2013-02-22 02:05:23 +08:00
2018-07-12 22:57:41 +08:00
// then include this file where all our macros are defined. It's really important to do it first because
// it's where we do all the compiler/OS/arch detections and define most defaults.
#include "src/Core/util/Macros.h"
2016-09-19 19:44:13 +08:00
2018-07-12 22:57:41 +08:00
// This detects SSE/AVX/NEON/etc. and configure alignment settings
#include "src/Core/util/ConfigureVectorization.h"
2018-06-06 22:12:58 +08:00
2018-07-12 22:57:41 +08:00
// We need cuda_runtime.h/hip_runtime.h to ensure that
// the EIGEN_USING_STD_MATH macro works properly on the device side
#if defined(EIGEN_CUDACC)
2018-06-12 00:33:24 +08:00
#include <cuda_runtime.h>
2018-07-11 21:17:33 +08:00
#elif defined(EIGEN_HIPCC)
#include <hip/hip_runtime.h>
2018-06-14 22:21:54 +08:00
#endif
2014-07-22 19:16:44 +08:00
#ifdef EIGEN_EXCEPTIONS
#include <new>
#endif
2013-07-06 05:47:40 +08:00
// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3)
// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details.
2014-11-05 04:58:52 +08:00
#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6)
2013-07-06 05:47:40 +08:00
#pragma GCC optimize ("-fno-ipa-cp-clone")
#endif
2012-02-11 05:49:09 +08:00
#include <complex>
2011-12-09 17:06:49 +08:00
// this include file manages BLAS and MKL related macros
// and inclusion of their respective header files
#include "src/Core/util/MKL_support.h"
2018-06-06 22:12:58 +08:00
2018-06-14 22:21:54 +08:00
#if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16)
#define EIGEN_HAS_GPU_FP16
#endif
2010-04-26 23:08:54 +08:00
#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE)
2010-02-22 18:08:37 +08:00
#define EIGEN_HAS_OPENMP
#endif
#ifdef EIGEN_HAS_OPENMP
#include <omp.h>
#endif
2010-10-08 00:09:15 +08:00
// MSVC for windows mobile does not have the errno.h file
2014-11-05 04:58:52 +08:00
#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM
2010-10-08 00:09:15 +08:00
#define EIGEN_HAS_ERRNO
#endif
#ifdef EIGEN_HAS_ERRNO
2010-02-28 21:32:57 +08:00
#include <cerrno>
2010-10-08 00:09:15 +08:00
#endif
2011-04-19 22:34:25 +08:00
#include <cstddef>
2008-08-28 23:28:23 +08:00
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
2010-02-28 08:04:22 +08:00
#include <iosfwd>
2008-08-03 23:44:06 +08:00
#include <cstring>
2008-08-21 21:17:21 +08:00
#include <string>
2009-01-09 08:55:53 +08:00
#include <limits>
2011-02-07 23:55:41 +08:00
#include <climits> // for CHAR_BIT
2009-07-10 22:10:03 +08:00
// for min/max:
#include <algorithm>
2008-05-03 20:21:23 +08:00
2018-07-13 19:06:44 +08:00
#if EIGEN_HAS_CXX11
#include <array>
#endif
2016-06-03 20:28:25 +08:00
// for std::is_nothrow_move_assignable
#ifdef EIGEN_INCLUDE_TYPE_TRAITS
#include <type_traits>
#endif
2010-02-28 08:04:22 +08:00
// for outputting debug info
#ifdef EIGEN_DEBUG_ASSIGN
2011-02-16 21:50:19 +08:00
#include <iostream>
2010-02-28 08:04:22 +08:00
#endif
2010-06-22 00:39:24 +08:00
// required for __cpuid, needs to be included after cmath
2014-11-05 04:58:52 +08:00
#if EIGEN_COMP_MSVC && EIGEN_ARCH_i386_OR_x86_64 && !EIGEN_OS_WINCE
2010-06-22 00:39:24 +08:00
#include <intrin.h>
#endif
2016-11-17 19:47:13 +08:00
#if defined(__SYCL_DEVICE_ONLY__)
#undef min
#undef max
#undef isnan
#undef isinf
#undef isfinite
#include <SYCL/sycl.hpp>
#endif
2012-04-15 18:06:28 +08:00
2014-07-01 22:58:11 +08:00
#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
// This will generate an error message:
#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
2010-04-23 08:49:01 +08:00
#endif
2017-01-24 05:03:57 +08:00
namespace Eigen {
2018-03-11 22:01:44 +08:00
// we use size_t frequently and we'll never remember to prepend it with std:: every time just to
2010-02-12 22:03:16 +08:00
// ensure QNX/QCC support
using std::size_t;
2016-04-02 01:27:59 +08:00
// gcc 4.6.0 wants std:: for ptrdiff_t
2011-05-06 00:48:18 +08:00
using std::ptrdiff_t;
2010-02-12 22:03:16 +08:00
2017-01-24 05:03:57 +08:00
}
2008-08-27 03:12:23 +08:00
/** \defgroup Core_Module Core module
2008-08-27 07:07:33 +08:00
* This is the main module of Eigen providing dense matrix and vector support
* (both fixed and dynamic size) with all the features corresponding to a BLAS library
* and much more...
2008-08-27 03:12:23 +08:00
*
* \code
* #include <Eigen/Core>
* \endcode
*/
2008-08-28 23:28:23 +08:00
#include "src/Core/util/Constants.h"
#include "src/Core/util/Meta.h"
2014-02-18 18:03:59 +08:00
#include "src/Core/util/ForwardDeclarations.h"
2008-08-28 23:28:23 +08:00
#include "src/Core/util/StaticAssert.h"
2013-06-11 05:40:56 +08:00
#include "src/Core/util/XprHelper.h"
2008-08-27 03:12:23 +08:00
#include "src/Core/util/Memory.h"
2017-01-17 05:21:23 +08:00
#include "src/Core/util/IntegralConstant.h"
2017-01-20 02:25:29 +08:00
#include "src/Core/util/SymbolicIndex.h"
2017-01-17 05:21:23 +08:00
2007-12-29 00:20:00 +08:00
#include "src/Core/NumTraits.h"
#include "src/Core/MathFunctions.h"
2008-08-27 03:12:23 +08:00
#include "src/Core/GenericPacketMath.h"
2016-08-23 20:23:08 +08:00
#include "src/Core/MathFunctionsImpl.h"
2017-06-15 16:16:30 +08:00
#include "src/Core/arch/Default/ConjHelper.h"
2008-05-12 16:30:42 +08:00
2015-12-11 07:34:57 +08:00
#if defined EIGEN_VECTORIZE_AVX512
#include "src/Core/arch/SSE/PacketMath.h"
#include "src/Core/arch/AVX/PacketMath.h"
#include "src/Core/arch/AVX512/PacketMath.h"
2016-12-19 23:32:48 +08:00
#include "src/Core/arch/SSE/MathFunctions.h"
#include "src/Core/arch/AVX/MathFunctions.h"
2016-02-05 02:34:10 +08:00
#include "src/Core/arch/AVX512/MathFunctions.h"
2015-12-11 07:34:57 +08:00
#elif defined EIGEN_VECTORIZE_AVX
2014-01-30 03:43:05 +08:00
// Use AVX for floats and doubles, SSE for integers
2014-03-27 21:47:00 +08:00
#include "src/Core/arch/SSE/PacketMath.h"
#include "src/Core/arch/SSE/Complex.h"
2015-08-07 23:40:39 +08:00
#include "src/Core/arch/SSE/MathFunctions.h"
2014-01-30 03:43:05 +08:00
#include "src/Core/arch/AVX/PacketMath.h"
2015-02-14 08:07:08 +08:00
#include "src/Core/arch/AVX/MathFunctions.h"
2014-01-30 03:43:05 +08:00
#include "src/Core/arch/AVX/Complex.h"
2015-02-28 00:46:04 +08:00
#include "src/Core/arch/AVX/TypeCasting.h"
2018-05-30 02:46:46 +08:00
#include "src/Core/arch/SSE/TypeCasting.h"
2014-01-30 03:43:05 +08:00
#elif defined EIGEN_VECTORIZE_SSE
2008-12-16 23:17:29 +08:00
#include "src/Core/arch/SSE/PacketMath.h"
2009-03-27 22:41:46 +08:00
#include "src/Core/arch/SSE/MathFunctions.h"
2010-07-05 22:18:09 +08:00
#include "src/Core/arch/SSE/Complex.h"
2015-02-28 00:46:04 +08:00
#include "src/Core/arch/SSE/TypeCasting.h"
2014-09-10 00:58:48 +08:00
#elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX)
2014-08-30 04:03:49 +08:00
#include "src/Core/arch/AltiVec/PacketMath.h"
2015-07-31 02:12:42 +08:00
#include "src/Core/arch/AltiVec/MathFunctions.h"
2014-08-30 04:03:49 +08:00
#include "src/Core/arch/AltiVec/Complex.h"
2010-03-04 01:25:41 +08:00
#elif defined EIGEN_VECTORIZE_NEON
#include "src/Core/arch/NEON/PacketMath.h"
2015-02-11 06:02:38 +08:00
#include "src/Core/arch/NEON/MathFunctions.h"
2010-07-10 05:09:29 +08:00
#include "src/Core/arch/NEON/Complex.h"
2018-07-27 05:28:48 +08:00
#include "src/Core/arch/NEON/TypeCasting.h"
2016-03-28 06:47:49 +08:00
#elif defined EIGEN_VECTORIZE_ZVECTOR
#include "src/Core/arch/ZVector/PacketMath.h"
2016-04-05 17:59:30 +08:00
#include "src/Core/arch/ZVector/MathFunctions.h"
#include "src/Core/arch/ZVector/Complex.h"
2018-07-19 03:27:50 +08:00
#elif defined EIGEN_VECTORIZE_MSA
#include "src/Core/arch/MSA/PacketMath.h"
#include "src/Core/arch/MSA/MathFunctions.h"
#include "src/Core/arch/MSA/Complex.h"
2008-05-06 01:19:47 +08:00
#endif
2016-05-24 06:21:40 +08:00
// Half float support
2018-06-14 22:21:54 +08:00
#include "src/Core/arch/GPU/Half.h"
#include "src/Core/arch/GPU/PacketMathHalf.h"
#include "src/Core/arch/GPU/TypeCasting.h"
2016-03-12 09:21:42 +08:00
2018-07-11 22:39:54 +08:00
#if defined EIGEN_VECTORIZE_GPU
#include "src/Core/arch/GPU/PacketMath.h"
#include "src/Core/arch/GPU/MathFunctions.h"
2014-10-04 10:45:19 +08:00
#endif
2018-08-03 23:59:15 +08:00
#if defined EIGEN_VECTORIZE_SYCL
#include "src/Core/arch/SYCL/InteropHeaders.h"
#include "src/Core/arch/SYCL/PacketMath.h"
#include "src/Core/arch/SYCL/MathFunctions.h"
#include "src/Core/arch/SYCL/TypeCasting.h"
#endif
2010-03-04 01:47:58 +08:00
#include "src/Core/arch/Default/Settings.h"
2008-05-13 01:34:46 +08:00
2016-06-03 08:04:19 +08:00
#include "src/Core/functors/TernaryFunctors.h"
2013-11-06 17:36:10 +08:00
#include "src/Core/functors/BinaryFunctors.h"
#include "src/Core/functors/UnaryFunctors.h"
#include "src/Core/functors/NullaryFunctors.h"
#include "src/Core/functors/StlFunctors.h"
2013-12-02 22:07:45 +08:00
#include "src/Core/functors/AssignmentFunctors.h"
2013-11-06 17:36:10 +08:00
2016-10-04 02:06:24 +08:00
// Specialized functors to enable the processing of complex numbers
// on CUDA devices
2018-07-18 19:51:36 +08:00
#ifdef EIGEN_CUDACC
2016-10-04 02:06:24 +08:00
#include "src/Core/arch/CUDA/Complex.h"
2018-07-18 19:51:36 +08:00
#endif
2016-10-04 02:06:24 +08:00
2017-01-12 00:24:02 +08:00
#include "src/Core/util/IndexedViewHelper.h"
2017-01-06 07:01:44 +08:00
#include "src/Core/ArithmeticSequence.h"
2017-02-13 16:46:20 +08:00
#include "src/Core/IO.h"
2010-05-09 04:02:13 +08:00
#include "src/Core/DenseCoeffsBase.h"
2009-12-05 06:17:14 +08:00
#include "src/Core/DenseBase.h"
2007-12-29 00:20:00 +08:00
#include "src/Core/MatrixBase.h"
2010-02-20 22:26:02 +08:00
#include "src/Core/EigenBase.h"
2008-12-16 23:17:29 +08:00
2013-11-07 23:38:14 +08:00
#include "src/Core/Product.h"
#include "src/Core/CoreEvaluators.h"
#include "src/Core/AssignEvaluator.h"
2008-06-03 03:29:23 +08:00
#ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874
// at least confirmed with Doxygen 1.5.5 and 1.5.6
2008-12-16 23:17:29 +08:00
#include "src/Core/Assign.h"
2008-06-03 03:29:23 +08:00
#endif
2008-12-16 23:17:29 +08:00
2013-08-19 22:40:50 +08:00
#include "src/Core/ArrayBase.h"
2009-08-16 04:19:29 +08:00
#include "src/Core/util/BlasUtil.h"
2010-10-20 21:34:13 +08:00
#include "src/Core/DenseStorage.h"
2008-05-28 13:14:16 +08:00
#include "src/Core/NestByValue.h"
2014-09-18 21:15:27 +08:00
// #include "src/Core/ForceAlignedAccess.h"
2009-03-04 21:00:00 +08:00
#include "src/Core/ReturnByValue.h"
2009-08-16 00:35:51 +08:00
#include "src/Core/NoAlias.h"
2010-10-20 21:34:13 +08:00
#include "src/Core/PlainObjectBase.h"
2007-12-29 00:20:00 +08:00
#include "src/Core/Matrix.h"
2010-12-15 22:19:51 +08:00
#include "src/Core/Array.h"
2016-06-03 08:04:19 +08:00
#include "src/Core/CwiseTernaryOp.h"
2008-02-29 22:35:14 +08:00
#include "src/Core/CwiseBinaryOp.h"
2008-03-03 18:52:44 +08:00
#include "src/Core/CwiseUnaryOp.h"
2008-04-25 02:35:39 +08:00
#include "src/Core/CwiseNullaryOp.h"
2009-05-20 21:41:23 +08:00
#include "src/Core/CwiseUnaryView.h"
2010-07-20 05:32:13 +08:00
#include "src/Core/SelfCwiseBinaryOp.h"
2008-07-10 06:30:18 +08:00
#include "src/Core/Dot.h"
2009-07-17 22:22:39 +08:00
#include "src/Core/StableNorm.h"
2010-02-19 09:42:38 +08:00
#include "src/Core/Stride.h"
2014-02-18 18:03:59 +08:00
#include "src/Core/MapBase.h"
2008-08-10 02:41:24 +08:00
#include "src/Core/Map.h"
2014-02-18 18:03:59 +08:00
#include "src/Core/Ref.h"
2007-12-29 00:20:00 +08:00
#include "src/Core/Block.h"
2009-07-05 17:33:55 +08:00
#include "src/Core/VectorBlock.h"
2017-01-06 07:01:44 +08:00
#include "src/Core/IndexedView.h"
2007-12-29 00:20:00 +08:00
#include "src/Core/Transpose.h"
#include "src/Core/DiagonalMatrix.h"
2009-05-11 00:24:39 +08:00
#include "src/Core/Diagonal.h"
2009-06-29 03:27:37 +08:00
#include "src/Core/DiagonalProduct.h"
2008-03-16 22:36:25 +08:00
#include "src/Core/Redux.h"
#include "src/Core/Visitor.h"
2007-12-29 00:20:00 +08:00
#include "src/Core/Fuzzy.h"
2008-01-15 21:55:47 +08:00
#include "src/Core/Swap.h"
2008-03-09 03:02:24 +08:00
#include "src/Core/CommaInitializer.h"
2011-03-23 23:12:21 +08:00
#include "src/Core/GeneralProduct.h"
2014-02-19 18:33:29 +08:00
#include "src/Core/Solve.h"
2014-02-24 18:49:30 +08:00
#include "src/Core/Inverse.h"
2015-12-01 21:38:47 +08:00
#include "src/Core/SolverBase.h"
2015-10-09 00:36:39 +08:00
#include "src/Core/PermutationMatrix.h"
#include "src/Core/Transpositions.h"
2009-07-07 05:43:20 +08:00
#include "src/Core/TriangularMatrix.h"
#include "src/Core/SelfAdjointView.h"
2012-06-14 20:24:15 +08:00
#include "src/Core/products/GeneralBlockPanelKernel.h"
2010-02-22 18:08:37 +08:00
#include "src/Core/products/Parallelizer.h"
2014-02-21 23:43:03 +08:00
#include "src/Core/ProductEvaluators.h"
2009-08-06 18:20:02 +08:00
#include "src/Core/products/GeneralMatrixVector.h"
#include "src/Core/products/GeneralMatrixMatrix.h"
2012-06-12 17:40:33 +08:00
#include "src/Core/SolveTriangular.h"
2010-11-11 01:58:55 +08:00
#include "src/Core/products/GeneralMatrixMatrixTriangular.h"
2009-08-06 18:20:02 +08:00
#include "src/Core/products/SelfadjointMatrixVector.h"
#include "src/Core/products/SelfadjointMatrixMatrix.h"
2009-07-24 01:01:20 +08:00
#include "src/Core/products/SelfadjointProduct.h"
2009-07-12 03:14:59 +08:00
#include "src/Core/products/SelfadjointRank2Update.h"
2009-07-13 19:17:55 +08:00
#include "src/Core/products/TriangularMatrixVector.h"
2009-07-27 16:27:01 +08:00
#include "src/Core/products/TriangularMatrixMatrix.h"
2009-08-06 18:20:02 +08:00
#include "src/Core/products/TriangularSolverMatrix.h"
2010-11-05 19:43:14 +08:00
#include "src/Core/products/TriangularSolverVector.h"
2009-07-15 05:27:37 +08:00
#include "src/Core/BandMatrix.h"
2013-01-16 05:03:54 +08:00
#include "src/Core/CoreIterators.h"
2016-04-02 01:27:59 +08:00
#include "src/Core/ConditionEstimator.h"
2008-06-01 07:21:49 +08:00
2010-06-20 05:36:38 +08:00
#include "src/Core/BooleanRedux.h"
#include "src/Core/Select.h"
#include "src/Core/VectorwiseOp.h"
#include "src/Core/Random.h"
#include "src/Core/Replicate.h"
#include "src/Core/Reverse.h"
#include "src/Core/ArrayWrapper.h"
2010-01-21 03:51:01 +08:00
2011-12-09 17:06:49 +08:00
#ifdef EIGEN_USE_BLAS
2016-04-11 22:04:09 +08:00
#include "src/Core/products/GeneralMatrixMatrix_BLAS.h"
#include "src/Core/products/GeneralMatrixVector_BLAS.h"
#include "src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h"
#include "src/Core/products/SelfadjointMatrixMatrix_BLAS.h"
#include "src/Core/products/SelfadjointMatrixVector_BLAS.h"
#include "src/Core/products/TriangularMatrixMatrix_BLAS.h"
#include "src/Core/products/TriangularMatrixVector_BLAS.h"
#include "src/Core/products/TriangularSolverMatrix_BLAS.h"
2011-12-09 17:06:49 +08:00
#endif // EIGEN_USE_BLAS
#ifdef EIGEN_USE_MKL_VML
2011-12-05 15:52:21 +08:00
#include "src/Core/Assign_MKL.h"
#endif
2011-03-23 18:54:00 +08:00
2010-06-20 05:36:38 +08:00
#include "src/Core/GlobalFunctions.h"
2010-01-28 06:23:59 +08:00
2011-02-22 22:31:22 +08:00
#include "src/Core/util/ReenableStupidWarnings.h"
2008-12-19 04:48:02 +08:00
2008-03-26 17:13:11 +08:00
#endif // EIGEN_CORE_H