mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-27 07:29:52 +08:00
270 lines
8.8 KiB
Plaintext
270 lines
8.8 KiB
Plaintext
// This file is part of Eigen, a lightweight C++ template library
|
|
// for linear algebra.
|
|
//
|
|
// Copyright (C) 2008 Gael Guennebaud <g.gael@free.fr>
|
|
// Copyright (C) 2007-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
|
|
//
|
|
// 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/>.
|
|
|
|
#ifndef EIGEN_CORE_H
|
|
#define EIGEN_CORE_H
|
|
|
|
// first thing Eigen does: prevent MSVC from committing suicide
|
|
#include "src/Core/util/DisableMSVCWarnings.h"
|
|
|
|
#ifdef _MSC_VER
|
|
#include <malloc.h> // for _aligned_malloc -- need it regardless of whether vectorization is enabled
|
|
#if (_MSC_VER >= 1500) // 2008 or later
|
|
// 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
|
|
#endif
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef __GNUC__
|
|
#define EIGEN_GNUC_AT_LEAST(x,y) ((__GNUC__>=x && __GNUC_MINOR__>=y) || __GNUC__>x)
|
|
#else
|
|
#define EIGEN_GNUC_AT_LEAST(x,y) 0
|
|
#endif
|
|
|
|
// 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
|
|
|
|
#ifdef EIGEN_DONT_ALIGN
|
|
#define EIGEN_DONT_VECTORIZE
|
|
#endif
|
|
|
|
#ifdef __clang__
|
|
#define EIGEN_DONT_VECTORIZE
|
|
#endif
|
|
|
|
#ifndef EIGEN_DONT_VECTORIZE
|
|
#if defined (EIGEN_SSE2_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
|
|
#define EIGEN_VECTORIZE
|
|
#define EIGEN_VECTORIZE_SSE
|
|
#include <emmintrin.h>
|
|
#include <xmmintrin.h>
|
|
#ifdef __SSE3__
|
|
#include <pmmintrin.h>
|
|
#endif
|
|
#ifdef __SSSE3__
|
|
#include <tmmintrin.h>
|
|
#endif
|
|
#ifdef __SSE4_1__
|
|
#include <smmintrin.h>
|
|
#endif
|
|
#ifdef __SSE4_2__
|
|
#include <nmmintrin.h>
|
|
#endif
|
|
#elif defined __ALTIVEC__
|
|
#define EIGEN_VECTORIZE
|
|
#define EIGEN_VECTORIZE_ALTIVEC
|
|
#include <altivec.h>
|
|
// We need to #undef all these ugly tokens defined in <altivec.h>
|
|
// => use __vector instead of vector
|
|
#undef bool
|
|
#undef vector
|
|
#undef pixel
|
|
#endif
|
|
#endif
|
|
|
|
#include <cstdlib>
|
|
#include <cmath>
|
|
#include <complex>
|
|
#include <cassert>
|
|
#include <functional>
|
|
#include <iostream>
|
|
#include <cstring>
|
|
#include <string>
|
|
#include <limits>
|
|
// for min/max:
|
|
#include <algorithm>
|
|
|
|
#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_NO_EXCEPTIONS)
|
|
#define EIGEN_EXCEPTIONS
|
|
#endif
|
|
|
|
#ifdef EIGEN_EXCEPTIONS
|
|
#include <new>
|
|
#endif
|
|
|
|
// 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
|
|
|
|
// defined in bits/termios.h
|
|
#undef B0
|
|
|
|
namespace Eigen {
|
|
|
|
// 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;
|
|
|
|
/** \defgroup Core_Module Core module
|
|
* 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...
|
|
*
|
|
* \code
|
|
* #include <Eigen/Core>
|
|
* \endcode
|
|
*/
|
|
|
|
/** The type used to identify a dense storage. */
|
|
struct Dense {};
|
|
|
|
#include "src/Core/util/Macros.h"
|
|
#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"
|
|
#include "src/Core/util/Memory.h"
|
|
|
|
#include "src/Core/NumTraits.h"
|
|
#include "src/Core/MathFunctions.h"
|
|
#include "src/Core/GenericPacketMath.h"
|
|
|
|
#if defined EIGEN_VECTORIZE_SSE
|
|
#include "src/Core/arch/SSE/PacketMath.h"
|
|
#include "src/Core/arch/SSE/MathFunctions.h"
|
|
#elif defined EIGEN_VECTORIZE_ALTIVEC
|
|
#include "src/Core/arch/AltiVec/PacketMath.h"
|
|
#endif
|
|
|
|
#ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD
|
|
#define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8
|
|
#endif
|
|
|
|
#include "src/Core/Functors.h"
|
|
#include "src/Core/DenseBase.h"
|
|
#include "src/Core/MatrixBase.h"
|
|
#include "src/Core/AnyMatrixBase.h"
|
|
#include "src/Core/Coeffs.h"
|
|
|
|
#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
|
|
#include "src/Core/Assign.h"
|
|
#endif
|
|
|
|
#include "src/Core/util/BlasUtil.h"
|
|
#include "src/Core/MatrixStorage.h"
|
|
#include "src/Core/NestByValue.h"
|
|
#include "src/Core/ForceAlignedAccess.h"
|
|
#include "src/Core/ReturnByValue.h"
|
|
#include "src/Core/NoAlias.h"
|
|
#include "src/Core/DenseStorageBase.h"
|
|
#include "src/Core/Matrix.h"
|
|
#include "src/Core/SelfCwiseBinaryOp.h"
|
|
#include "src/Core/CwiseBinaryOp.h"
|
|
#include "src/Core/CwiseUnaryOp.h"
|
|
#include "src/Core/CwiseNullaryOp.h"
|
|
#include "src/Core/CwiseUnaryView.h"
|
|
#include "src/Core/Dot.h"
|
|
#include "src/Core/StableNorm.h"
|
|
#include "src/Core/MapBase.h"
|
|
#include "src/Core/Map.h"
|
|
#include "src/Core/Block.h"
|
|
#include "src/Core/VectorBlock.h"
|
|
#include "src/Core/Minor.h"
|
|
#include "src/Core/Transpose.h"
|
|
#include "src/Core/DiagonalMatrix.h"
|
|
#include "src/Core/Diagonal.h"
|
|
#include "src/Core/DiagonalProduct.h"
|
|
#include "src/Core/PermutationMatrix.h"
|
|
#include "src/Core/Redux.h"
|
|
#include "src/Core/Visitor.h"
|
|
#include "src/Core/Fuzzy.h"
|
|
#include "src/Core/IO.h"
|
|
#include "src/Core/Swap.h"
|
|
#include "src/Core/CommaInitializer.h"
|
|
#include "src/Core/Flagged.h"
|
|
#include "src/Core/ProductBase.h"
|
|
#include "src/Core/Product.h"
|
|
#include "src/Core/TriangularMatrix.h"
|
|
#include "src/Core/SelfAdjointView.h"
|
|
#include "src/Core/SolveTriangular.h"
|
|
#include "src/Core/products/CoeffBasedProduct.h"
|
|
#include "src/Core/products/GeneralBlockPanelKernel.h"
|
|
#include "src/Core/products/GeneralMatrixVector.h"
|
|
#include "src/Core/products/GeneralMatrixMatrix.h"
|
|
#include "src/Core/products/SelfadjointMatrixVector.h"
|
|
#include "src/Core/products/SelfadjointMatrixMatrix.h"
|
|
#include "src/Core/products/SelfadjointProduct.h"
|
|
#include "src/Core/products/SelfadjointRank2Update.h"
|
|
#include "src/Core/products/TriangularMatrixVector.h"
|
|
#include "src/Core/products/TriangularMatrixMatrix.h"
|
|
#include "src/Core/products/TriangularSolverMatrix.h"
|
|
#include "src/Core/BandMatrix.h"
|
|
|
|
/** \defgroup Array_Module Array module
|
|
* \ingroup Core_Module
|
|
* This module provides several handy features to manipulate matrices as simple array of values.
|
|
* In addition to listed classes, it defines various methods of the Cwise interface
|
|
* (accessible from MatrixBase::cwise()), including:
|
|
* - matrix-scalar sum,
|
|
* - coeff-wise comparison operators,
|
|
* - sin, cos, sqrt, pow, exp, log, square, cube, inverse (reciprocal).
|
|
*
|
|
* This module also provides various MatrixBase methods, including:
|
|
* - boolean reductions: \ref MatrixBase::all() "all", \ref MatrixBase::any() "any", \ref MatrixBase::count() "count",
|
|
* - \ref MatrixBase::Random() "random matrix initialization",
|
|
* - a \ref MatrixBase::select() "select" function mimicking the trivariate ?: operator,
|
|
* - \ref MatrixBase::colwise() "column-wise" and \ref MatrixBase::rowwise() "row-wise" reductions,
|
|
* - \ref MatrixBase::reverse() "matrix reverse",
|
|
* - \ref MatrixBase::lpNorm() "generic matrix norm".
|
|
*
|
|
* \code
|
|
* #include <Eigen/Core>
|
|
* \endcode
|
|
*/
|
|
|
|
#include "src/Array/Functors.h"
|
|
#include "src/Array/BooleanRedux.h"
|
|
#include "src/Array/Select.h"
|
|
#include "src/Array/VectorwiseOp.h"
|
|
#include "src/Array/Random.h"
|
|
#include "src/Array/Norms.h"
|
|
#include "src/Array/Replicate.h"
|
|
#include "src/Array/Reverse.h"
|
|
#include "src/Array/ArrayBase.h"
|
|
#include "src/Array/ArrayWrapper.h"
|
|
#include "src/Array/Array.h"
|
|
|
|
} // namespace Eigen
|
|
|
|
#include "src/Array/GlobalFunctions.h"
|
|
|
|
#include "src/Core/util/EnableMSVCWarnings.h"
|
|
|
|
#ifdef EIGEN2_SUPPORT
|
|
#include "Eigen2Support"
|
|
#endif
|
|
|
|
#endif // EIGEN_CORE_H
|