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>
2010-02-19 09:42:38 +08:00
// Copyright (C) 2007-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
2009-05-06 23:48:28 +08:00
//
// Eigen is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 3 of the License, or (at your option) any later version.
//
// Alternatively, you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of
// the License, or (at your option) any later version.
//
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License and a copy of the GNU General Public License along with
// Eigen. If not, see <http://www.gnu.org/licenses/>.
2008-03-26 17:13:11 +08:00
#ifndef EIGEN_CORE_H
#define EIGEN_CORE_H
2008-12-16 23:17:29 +08:00
// first thing Eigen does: prevent MSVC from committing suicide
2008-12-19 04:48:02 +08:00
#include "src/Core/util/DisableMSVCWarnings.h"
2009-01-10 22:10:40 +08:00
2010-03-06 22:05:15 +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 alignment settings (platform detection and honoring the user's will if he
// defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization.
2010-12-27 23:07:11 +08:00
#include "src/Core/util/Macros.h"
2010-03-06 22:05:15 +08:00
// if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into
// account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks
#if !EIGEN_ALIGN
#ifndef EIGEN_DONT_VECTORIZE
#define EIGEN_DONT_VECTORIZE
#endif
#endif
2008-08-28 23:28:23 +08:00
#ifdef _MSC_VER
2009-01-10 22:10:40 +08:00
#include <malloc.h> // for _aligned_malloc -- need it regardless of whether vectorization is enabled
2008-12-16 23:17:29 +08:00
#if (_MSC_VER >= 1500) // 2008 or later
2009-05-04 20:13:37 +08:00
// Remember that usage of defined() in a #define is undefined by the standard.
// a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP.
#if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64)
#define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
2009-02-06 17:01:50 +08:00
#endif
2008-12-16 23:17:29 +08:00
#endif
2008-08-28 23:28:23 +08:00
#endif
2008-12-16 23:17:29 +08:00
// Remember that usage of defined() in a #define is undefined by the standard
#if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) )
#define EIGEN_SSE2_BUT_NOT_OLD_GCC
#endif
2008-12-16 05:20:40 +08:00
2008-12-16 23:17:29 +08:00
#ifndef EIGEN_DONT_VECTORIZE
2010-03-06 22:05:15 +08:00
2008-12-16 23:17:29 +08:00
#if defined (EIGEN_SSE2_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
2010-02-25 04:43:30 +08:00
// Defines symbols for compile-time detection of which instructions are
// used.
// EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used
2008-08-28 23:28:23 +08:00
#define EIGEN_VECTORIZE
#define EIGEN_VECTORIZE_SSE
2010-02-25 04:43:30 +08:00
#define EIGEN_VECTORIZE_SSE2
// Detect sse3/ssse3/sse4:
2010-04-23 08:40:31 +08:00
// gcc and icc defines __SSE3__, ...
2010-02-25 04:43:30 +08:00
// there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you
// want to force the use of those instructions with msvc.
#ifdef __SSE3__
#define EIGEN_VECTORIZE_SSE3
#endif
#ifdef __SSSE3__
#define EIGEN_VECTORIZE_SSSE3
#endif
#ifdef __SSE4_1__
#define EIGEN_VECTORIZE_SSE4_1
#endif
#ifdef __SSE4_2__
#define EIGEN_VECTORIZE_SSE4_2
#endif
// include files
2010-12-04 06:24:06 +08:00
2010-12-07 15:17:15 +08:00
// This extern "C" works around a MINGW-w64 compilation issue
2010-12-04 06:24:06 +08:00
// https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354
// In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do).
// However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations
// with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know;
// so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too.
2010-12-07 15:17:15 +08:00
// notice that since these are C headers, the extern "C" is theoretically needed anyways.
2010-12-04 06:24:06 +08:00
extern "C" {
#include <emmintrin.h>
#include <xmmintrin.h>
#ifdef EIGEN_VECTORIZE_SSE3
2008-08-28 23:28:23 +08:00
#include <pmmintrin.h>
2010-12-04 06:24:06 +08:00
#endif
#ifdef EIGEN_VECTORIZE_SSSE3
2008-08-28 23:28:23 +08:00
#include <tmmintrin.h>
2010-12-04 06:24:06 +08:00
#endif
#ifdef EIGEN_VECTORIZE_SSE4_1
2009-11-25 04:12:43 +08:00
#include <smmintrin.h>
2010-12-04 06:24:06 +08:00
#endif
#ifdef EIGEN_VECTORIZE_SSE4_2
2009-11-25 04:12:43 +08:00
#include <nmmintrin.h>
2010-12-04 06:24:06 +08:00
#endif
} // end extern "C"
2008-12-16 23:17:29 +08:00
#elif defined __ALTIVEC__
2008-08-28 23:28:23 +08:00
#define EIGEN_VECTORIZE
#define EIGEN_VECTORIZE_ALTIVEC
#include <altivec.h>
2008-12-16 23:17:29 +08:00
// We need to #undef all these ugly tokens defined in <altivec.h>
2008-08-28 23:28:23 +08:00
// => use __vector instead of vector
#undef bool
#undef vector
#undef pixel
2010-03-04 01:25:41 +08:00
#elif defined __ARM_NEON__
#define EIGEN_VECTORIZE
#define EIGEN_VECTORIZE_NEON
2010-03-04 02:15:34 +08:00
#include <arm_neon.h>
2008-08-28 23:28:23 +08:00
#endif
#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
#if !(defined(_MSC_VER) && defined(_WIN32_WCE))
#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
2008-08-28 23:28:23 +08:00
#include <cstdlib>
#include <cmath>
#include <complex>
#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>
2009-07-10 22:10:03 +08:00
// for min/max:
#include <algorithm>
2008-05-03 20:21:23 +08:00
2010-02-28 08:04:22 +08:00
// for outputting debug info
#ifdef EIGEN_DEBUG_ASSIGN
#include<iostream>
#endif
2010-06-22 00:39:24 +08:00
// required for __cpuid, needs to be included after cmath
2010-10-27 17:07:38 +08:00
#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64))
2010-06-22 00:39:24 +08:00
#include <intrin.h>
2010-12-17 03:08:22 +08:00
// When available, intrin.h pulls in all SSE headers which allows us
// to check which SSE level is supported on MSVC systems
#ifndef EIGEN_DONT_VECTORIZE
#ifdef _INCLUDED_PMM
#define EIGEN_VECTORIZE_SSE3
#endif
#ifdef _INCLUDED_TMM
#define EIGEN_VECTORIZE_SSSE3
#endif
#ifdef _INCLUDED_SMM
#define EIGEN_VECTORIZE_SSE4_1
#endif
#ifdef _INCLUDED_NMM
#define EIGEN_VECTORIZE_SSE4_2
#endif
#endif
2010-06-22 00:39:24 +08:00
#endif
2008-12-16 23:17:29 +08:00
#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_NO_EXCEPTIONS)
#define EIGEN_EXCEPTIONS
#endif
#ifdef EIGEN_EXCEPTIONS
#include <new>
2008-12-15 23:54:33 +08:00
#endif
2009-01-19 21:23:41 +08:00
// this needs to be done after all possible windows C header includes and before any Eigen source includes
// (system C++ includes are supposed to be able to deal with this already):
// windows.h defines min and max macros which would make Eigen fail to compile.
#if defined(min) || defined(max)
#error The preprocessor symbols 'min' or 'max' are defined. If you are compiling on Windows, do #define NOMINMAX to prevent windows.h from defining these symbols.
#endif
2009-09-20 07:14:28 +08:00
// defined in bits/termios.h
#undef B0
2007-12-29 00:20:00 +08:00
namespace Eigen {
2010-02-25 19:43:45 +08:00
inline static const char *SimdInstructionSetsInUse(void) {
2010-02-25 04:52:08 +08:00
#if defined(EIGEN_VECTORIZE_SSE4_2)
2010-02-25 19:43:45 +08:00
return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2";
2010-02-25 12:31:22 +08:00
#elif defined(EIGEN_VECTORIZE_SSE4_1)
2010-02-25 19:43:45 +08:00
return "SSE, SSE2, SSE3, SSSE3, SSE4.1";
2010-02-25 04:52:08 +08:00
#elif defined(EIGEN_VECTORIZE_SSSE3)
2010-02-25 19:43:45 +08:00
return "SSE, SSE2, SSE3, SSSE3";
2010-02-25 04:52:08 +08:00
#elif defined(EIGEN_VECTORIZE_SSE3)
2010-02-25 19:43:45 +08:00
return "SSE, SSE2, SSE3";
2010-02-25 04:52:08 +08:00
#elif defined(EIGEN_VECTORIZE_SSE2)
2010-02-25 19:43:45 +08:00
return "SSE, SSE2";
2010-02-25 04:52:08 +08:00
#elif defined(EIGEN_VECTORIZE_ALTIVEC)
2010-02-25 19:43:45 +08:00
return "AltiVec";
2010-03-04 01:25:41 +08:00
#elif defined(EIGEN_VECTORIZE_NEON)
return "ARM NEON";
2010-02-25 04:52:08 +08:00
#else
return "None";
#endif
}
2011-01-24 07:22:18 +08:00
#define STAGE10_FULL_EIGEN2_API 10
#define STAGE15_RESOLVE_API_CONFLICTS_WARN 15
#define STAGE20_RESOLVE_API_CONFLICTS 20
#define STAGE30_FULL_EIGEN3_API 30
#define STAGE40_FULL_EIGEN3_STRICTNESS 40
#define STAGE99_NO_EIGEN2_SUPPORT 99
2011-01-21 22:51:03 +08:00
2011-01-24 07:22:18 +08:00
#ifdef EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API
2011-01-21 22:51:03 +08:00
#define EIGEN2_SUPPORT
2011-01-24 07:22:18 +08:00
#define EIGEN2_SUPPORT_STAGE STAGE10_FULL_EIGEN2_API
#elif defined EIGEN2_SUPPORT_STAGE15_RESOLVE_API_CONFLICTS_WARN
2011-01-21 22:51:03 +08:00
#define EIGEN2_SUPPORT
2011-01-24 07:22:18 +08:00
#define EIGEN2_SUPPORT_STAGE STAGE15_RESOLVE_API_CONFLICTS_WARN
#elif defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS
2011-01-21 22:51:03 +08:00
#define EIGEN2_SUPPORT
2011-01-24 07:22:18 +08:00
#define EIGEN2_SUPPORT_STAGE STAGE20_RESOLVE_API_CONFLICTS
#elif defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API
2011-01-21 23:42:19 +08:00
#define EIGEN2_SUPPORT
2011-01-24 07:22:18 +08:00
#define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API
#elif defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS
#define EIGEN2_SUPPORT
#define EIGEN2_SUPPORT_STAGE STAGE40_FULL_EIGEN3_STRICTNESS
2011-01-21 22:51:03 +08:00
#elif defined EIGEN2_SUPPORT
// default to stage 3, that's what it's always meant
2011-01-24 07:22:18 +08:00
#define EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API
#define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API
2011-01-21 22:51:03 +08:00
#else
2011-01-24 07:22:18 +08:00
#define EIGEN2_SUPPORT_STAGE STAGE99_NO_EIGEN2_SUPPORT
#endif
2011-01-21 22:51:03 +08:00
2010-04-23 08:49:01 +08:00
#ifdef EIGEN2_SUPPORT
#undef minor
#endif
2010-02-12 22:03:16 +08:00
// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to
// ensure QNX/QCC support
using std::size_t;
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/ForwardDeclarations.h"
#include "src/Core/util/Meta.h"
#include "src/Core/util/XprHelper.h"
#include "src/Core/util/StaticAssert.h"
2008-08-27 03:12:23 +08:00
#include "src/Core/util/Memory.h"
2008-08-28 08:33:58 +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"
2008-05-12 16:30:42 +08:00
2008-05-06 01:19:47 +08:00
#if 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"
2008-05-06 01:19:47 +08:00
#elif defined EIGEN_VECTORIZE_ALTIVEC
2008-12-16 23:17:29 +08:00
#include "src/Core/arch/AltiVec/PacketMath.h"
2010-07-09 22:56:53 +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"
2010-07-10 05:09:29 +08:00
#include "src/Core/arch/NEON/Complex.h"
2008-05-06 01:19:47 +08:00
#endif
2010-03-04 01:47:58 +08:00
#include "src/Core/arch/Default/Settings.h"
2008-05-13 01:34:46 +08:00
2008-04-09 20:31:55 +08:00
#include "src/Core/Functors.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
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
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"
2009-11-20 23:30:14 +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"
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"
2008-08-10 02:41:24 +08:00
#include "src/Core/MapBase.h"
2010-02-19 09:42:38 +08:00
#include "src/Core/Stride.h"
2008-08-10 02:41:24 +08:00
#include "src/Core/Map.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"
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"
2009-11-16 10:12:15 +08:00
#include "src/Core/PermutationMatrix.h"
2010-06-05 05:17:57 +08:00
#include "src/Core/Transpositions.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"
#include "src/Core/IO.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"
2010-02-05 01:28:09 +08:00
#include "src/Core/Flagged.h"
2009-08-04 22:54:17 +08:00
#include "src/Core/ProductBase.h"
2009-03-05 18:25:22 +08:00
#include "src/Core/Product.h"
2009-07-07 05:43:20 +08:00
#include "src/Core/TriangularMatrix.h"
#include "src/Core/SelfAdjointView.h"
#include "src/Core/SolveTriangular.h"
2010-02-22 18:08:37 +08:00
#include "src/Core/products/Parallelizer.h"
2010-02-09 18:05:39 +08:00
#include "src/Core/products/CoeffBasedProduct.h"
2009-08-06 18:20:02 +08:00
#include "src/Core/products/GeneralBlockPanelKernel.h"
#include "src/Core/products/GeneralMatrixVector.h"
#include "src/Core/products/GeneralMatrixMatrix.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"
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/ArrayBase.h"
#include "src/Core/ArrayWrapper.h"
2010-01-21 03:51:01 +08:00
2007-12-29 00:20:00 +08:00
} // namespace Eigen
2008-03-03 18:52:44 +08:00
2010-06-20 05:36:38 +08:00
#include "src/Core/GlobalFunctions.h"
2010-01-28 06:23:59 +08:00
2008-12-19 04:48:02 +08:00
#include "src/Core/util/EnableMSVCWarnings.h"
2010-01-08 04:15:32 +08:00
#ifdef EIGEN2_SUPPORT
#include "Eigen2Support"
#endif
2008-03-26 17:13:11 +08:00
#endif // EIGEN_CORE_H