Main MRPT website > C++ reference
MRPT logo
Core
Go to the documentation of this file.
00001 // This file is part of Eigen, a lightweight C++ template library
00002 // for linear algebra.
00003 //
00004 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
00005 // Copyright (C) 2007-2011 Benoit Jacob <jacob.benoit.1@gmail.com>
00006 //
00007 // Eigen is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public
00009 // License as published by the Free Software Foundation; either
00010 // version 3 of the License, or (at your option) any later version.
00011 //
00012 // Alternatively, you can redistribute it and/or
00013 // modify it under the terms of the GNU General Public License as
00014 // published by the Free Software Foundation; either version 2 of
00015 // the License, or (at your option) any later version.
00016 //
00017 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
00018 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00019 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU Lesser General Public
00023 // License and a copy of the GNU General Public License along with
00024 // Eigen. If not, see <http://www.gnu.org/licenses/>.
00025 
00026 #ifndef EIGEN_CORE_H
00027 #define EIGEN_CORE_H
00028 
00029 // first thing Eigen does: stop the compiler from committing suicide
00030 #include "src/Core/util/DisableStupidWarnings.h"
00031 
00032 // then include this file where all our macros are defined. It's really important to do it first because
00033 // it's where we do all the alignment settings (platform detection and honoring the user's will if he
00034 // defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization.
00035 #include "src/Core/util/Macros.h"
00036 
00037 // if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into
00038 // account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks
00039 #if !EIGEN_ALIGN
00040   #ifndef EIGEN_DONT_VECTORIZE
00041     #define EIGEN_DONT_VECTORIZE
00042   #endif
00043 #endif
00044 
00045 #ifdef _MSC_VER
00046   #include <malloc.h> // for _aligned_malloc -- need it regardless of whether vectorization is enabled
00047   #if (_MSC_VER >= 1500) // 2008 or later
00048     // Remember that usage of defined() in a #define is undefined by the standard.
00049     // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP.
00050     #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64)
00051       #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER
00052     #endif
00053   #endif
00054 #else
00055   // Remember that usage of defined() in a #define is undefined by the standard
00056   #if (defined __SSE2__) && ( (!defined __GNUC__) || EIGEN_GNUC_AT_LEAST(4,2) )
00057     #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC
00058   #endif
00059 #endif
00060 
00061 #ifndef EIGEN_DONT_VECTORIZE
00062 
00063   #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER)
00064 
00065     // Defines symbols for compile-time detection of which instructions are
00066     // used.
00067     // EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used
00068     #define EIGEN_VECTORIZE
00069     #define EIGEN_VECTORIZE_SSE
00070     #define EIGEN_VECTORIZE_SSE2
00071 
00072     // Detect sse3/ssse3/sse4:
00073     // gcc and icc defines __SSE3__, ...
00074     // there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you
00075     // want to force the use of those instructions with msvc.
00076     #ifdef __SSE3__
00077       #define EIGEN_VECTORIZE_SSE3
00078     #endif
00079     #ifdef __SSSE3__
00080       #define EIGEN_VECTORIZE_SSSE3
00081     #endif
00082     #ifdef __SSE4_1__
00083       #define EIGEN_VECTORIZE_SSE4_1
00084     #endif
00085     #ifdef __SSE4_2__
00086       #define EIGEN_VECTORIZE_SSE4_2
00087     #endif
00088 
00089     // include files
00090 
00091     // This extern "C" works around a MINGW-w64 compilation issue
00092     // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354
00093     // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do).
00094     // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations
00095     // with conflicting linkage.  The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know;
00096     // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too.
00097     // notice that since these are C headers, the extern "C" is theoretically needed anyways.
00098     extern "C" {
00099       #include <emmintrin.h>
00100       #include <xmmintrin.h>
00101       #ifdef  EIGEN_VECTORIZE_SSE3
00102       #include <pmmintrin.h>
00103       #endif
00104       #ifdef EIGEN_VECTORIZE_SSSE3
00105       #include <tmmintrin.h>
00106       #endif
00107       #ifdef EIGEN_VECTORIZE_SSE4_1
00108       #include <smmintrin.h>
00109       #endif
00110       #ifdef EIGEN_VECTORIZE_SSE4_2
00111       #include <nmmintrin.h>
00112       #endif
00113     } // end extern "C"
00114   #elif defined __ALTIVEC__
00115     #define EIGEN_VECTORIZE
00116     #define EIGEN_VECTORIZE_ALTIVEC
00117     #include <altivec.h>
00118     // We need to #undef all these ugly tokens defined in <altivec.h>
00119     // => use __vector instead of vector
00120     #undef bool
00121     #undef vector
00122     #undef pixel
00123   #elif defined  __ARM_NEON__
00124     #define EIGEN_VECTORIZE
00125     #define EIGEN_VECTORIZE_NEON
00126     #include <arm_neon.h>
00127   #endif
00128 #endif
00129 
00130 #if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE)
00131   #define EIGEN_HAS_OPENMP
00132 #endif
00133 
00134 #ifdef EIGEN_HAS_OPENMP
00135 #include <omp.h>
00136 #endif
00137 
00138 // MSVC for windows mobile does not have the errno.h file
00139 #if !(defined(_MSC_VER) && defined(_WIN32_WCE))
00140 #define EIGEN_HAS_ERRNO
00141 #endif
00142 
00143 #ifdef EIGEN_HAS_ERRNO
00144 #include <cerrno>
00145 #endif
00146 #include <cstddef>
00147 #include <cstdlib>
00148 #include <cmath>
00149 #include <complex>
00150 #include <cassert>
00151 #include <functional>
00152 #include <iosfwd>
00153 #include <cstring>
00154 #include <string>
00155 #include <limits>
00156 #include <climits> // for CHAR_BIT
00157 // for min/max:
00158 #include <algorithm>
00159 
00160 // for outputting debug info
00161 #ifdef EIGEN_DEBUG_ASSIGN
00162 #include <iostream>
00163 #endif
00164 
00165 // required for __cpuid, needs to be included after cmath
00166 #if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64))
00167   #include <intrin.h>
00168 #endif
00169 
00170 #if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(EIGEN_NO_EXCEPTIONS)
00171   #define EIGEN_EXCEPTIONS
00172 #endif
00173 
00174 #ifdef EIGEN_EXCEPTIONS
00175   #include <new>
00176 #endif
00177 
00178 // this needs to be done after all possible windows C header includes and before any Eigen source includes
00179 // (system C++ includes are supposed to be able to deal with this already):
00180 // windows.h defines min and max macros which would make Eigen fail to compile.
00181 #if defined(min) || defined(max)
00182 #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.
00183 #endif
00184 
00185 // defined in bits/termios.h
00186 #undef B0
00187 
00188 /** \brief Namespace containing all symbols from the %Eigen library. */
00189 namespace Eigen {
00190 
00191 inline static const char *SimdInstructionSetsInUse(void) {
00192 #if defined(EIGEN_VECTORIZE_SSE4_2)
00193   return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2";
00194 #elif defined(EIGEN_VECTORIZE_SSE4_1)
00195   return "SSE, SSE2, SSE3, SSSE3, SSE4.1";
00196 #elif defined(EIGEN_VECTORIZE_SSSE3)
00197   return "SSE, SSE2, SSE3, SSSE3";
00198 #elif defined(EIGEN_VECTORIZE_SSE3)
00199   return "SSE, SSE2, SSE3";
00200 #elif defined(EIGEN_VECTORIZE_SSE2)
00201   return "SSE, SSE2";
00202 #elif defined(EIGEN_VECTORIZE_ALTIVEC)
00203   return "AltiVec";
00204 #elif defined(EIGEN_VECTORIZE_NEON)
00205   return "ARM NEON";
00206 #else
00207   return "None";
00208 #endif
00209 }
00210 
00211 #define STAGE10_FULL_EIGEN2_API             10
00212 #define STAGE20_RESOLVE_API_CONFLICTS       20
00213 #define STAGE30_FULL_EIGEN3_API             30
00214 #define STAGE40_FULL_EIGEN3_STRICTNESS      40
00215 #define STAGE99_NO_EIGEN2_SUPPORT           99
00216 
00217 #if   defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS
00218   #define EIGEN2_SUPPORT
00219   #define EIGEN2_SUPPORT_STAGE STAGE40_FULL_EIGEN3_STRICTNESS
00220 #elif defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API
00221   #define EIGEN2_SUPPORT
00222   #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API
00223 #elif defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS
00224   #define EIGEN2_SUPPORT
00225   #define EIGEN2_SUPPORT_STAGE STAGE20_RESOLVE_API_CONFLICTS
00226 #elif defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API
00227   #define EIGEN2_SUPPORT
00228   #define EIGEN2_SUPPORT_STAGE STAGE10_FULL_EIGEN2_API
00229 #elif defined EIGEN2_SUPPORT
00230   // default to stage 3, that's what it's always meant
00231   #define EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API
00232   #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API
00233 #else
00234   #define EIGEN2_SUPPORT_STAGE STAGE99_NO_EIGEN2_SUPPORT
00235 #endif
00236 
00237 #ifdef EIGEN2_SUPPORT
00238 #undef minor
00239 #endif
00240 
00241 // we use size_t frequently and we'll never remember to prepend it with std:: everytime just to
00242 // ensure QNX/QCC support
00243 using std::size_t;
00244 // gcc 4.6.0 wants std:: for ptrdiff_t 
00245 using std::ptrdiff_t;
00246 
00247 /** \defgroup eigen_grp The Eigen3 library 
00248   \defgroup Core_Module Core module 
00249  * \ingroup eigen_grp
00250   * This is the main module of Eigen providing dense matrix and vector support
00251   * (both fixed and dynamic size) with all the features corresponding to a BLAS library
00252   * and much more...
00253   *
00254   * \code
00255   * #include <Eigen/Core>
00256   * \endcode
00257   */
00258 
00259 #include "src/Core/util/Constants.h"
00260 #include "src/Core/util/ForwardDeclarations.h"
00261 #include "src/Core/util/Meta.h"
00262 #include "src/Core/util/XprHelper.h"
00263 #include "src/Core/util/StaticAssert.h"
00264 #include "src/Core/util/Memory.h"
00265 
00266 #include "src/Core/NumTraits.h"
00267 #include "src/Core/MathFunctions.h"
00268 #include "src/Core/GenericPacketMath.h"
00269 
00270 #if defined EIGEN_VECTORIZE_SSE
00271   #include "src/Core/arch/SSE/PacketMath.h"
00272   #include "src/Core/arch/SSE/MathFunctions.h"
00273   #include "src/Core/arch/SSE/Complex.h"
00274 #elif defined EIGEN_VECTORIZE_ALTIVEC
00275   #include "src/Core/arch/AltiVec/PacketMath.h"
00276   #include "src/Core/arch/AltiVec/Complex.h"
00277 #elif defined EIGEN_VECTORIZE_NEON
00278   #include "src/Core/arch/NEON/PacketMath.h"
00279   #include "src/Core/arch/NEON/Complex.h"
00280 #endif
00281 
00282 #include "src/Core/arch/Default/Settings.h"
00283 
00284 #include "src/Core/Functors.h"
00285 #include "src/Core/DenseCoeffsBase.h"
00286 #include "src/Core/DenseBase.h"
00287 #include "src/Core/MatrixBase.h"
00288 #include "src/Core/EigenBase.h"
00289 
00290 #ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874
00291                                 // at least confirmed with Doxygen 1.5.5 and 1.5.6
00292   #include "src/Core/Assign.h"
00293 #endif
00294 
00295 #include "src/Core/util/BlasUtil.h"
00296 #include "src/Core/DenseStorage.h"
00297 #include "src/Core/NestByValue.h"
00298 #include "src/Core/ForceAlignedAccess.h"
00299 #include "src/Core/ReturnByValue.h"
00300 #include "src/Core/NoAlias.h"
00301 #include "src/Core/PlainObjectBase.h"
00302 #include "src/Core/Matrix.h"
00303 #include "src/Core/Array.h"
00304 #include "src/Core/CwiseBinaryOp.h"
00305 #include "src/Core/CwiseUnaryOp.h"
00306 #include "src/Core/CwiseNullaryOp.h"
00307 #include "src/Core/CwiseUnaryView.h"
00308 #include "src/Core/SelfCwiseBinaryOp.h"
00309 #include "src/Core/Dot.h"
00310 #include "src/Core/StableNorm.h"
00311 #include "src/Core/MapBase.h"
00312 #include "src/Core/Stride.h"
00313 #include "src/Core/Map.h"
00314 #include "src/Core/Block.h"
00315 #include "src/Core/VectorBlock.h"
00316 #include "src/Core/Transpose.h"
00317 #include "src/Core/DiagonalMatrix.h"
00318 #include "src/Core/Diagonal.h"
00319 #include "src/Core/DiagonalProduct.h"
00320 #include "src/Core/PermutationMatrix.h"
00321 #include "src/Core/Transpositions.h"
00322 #include "src/Core/Redux.h"
00323 #include "src/Core/Visitor.h"
00324 #include "src/Core/Fuzzy.h"
00325 #include "src/Core/IO.h"
00326 #include "src/Core/Swap.h"
00327 #include "src/Core/CommaInitializer.h"
00328 #include "src/Core/Flagged.h"
00329 #include "src/Core/ProductBase.h"
00330 #include "src/Core/GeneralProduct.h"
00331 #include "src/Core/TriangularMatrix.h"
00332 #include "src/Core/SelfAdjointView.h"
00333 #include "src/Core/SolveTriangular.h"
00334 #include "src/Core/products/Parallelizer.h"
00335 #include "src/Core/products/CoeffBasedProduct.h"
00336 #include "src/Core/products/GeneralBlockPanelKernel.h"
00337 #include "src/Core/products/GeneralMatrixVector.h"
00338 #include "src/Core/products/GeneralMatrixMatrix.h"
00339 #include "src/Core/products/GeneralMatrixMatrixTriangular.h"
00340 #include "src/Core/products/SelfadjointMatrixVector.h"
00341 #include "src/Core/products/SelfadjointMatrixMatrix.h"
00342 #include "src/Core/products/SelfadjointProduct.h"
00343 #include "src/Core/products/SelfadjointRank2Update.h"
00344 #include "src/Core/products/TriangularMatrixVector.h"
00345 #include "src/Core/products/TriangularMatrixMatrix.h"
00346 #include "src/Core/products/TriangularSolverMatrix.h"
00347 #include "src/Core/products/TriangularSolverVector.h"
00348 #include "src/Core/BandMatrix.h"
00349 
00350 #include "src/Core/BooleanRedux.h"
00351 #include "src/Core/Select.h"
00352 #include "src/Core/VectorwiseOp.h"
00353 #include "src/Core/Random.h"
00354 #include "src/Core/Replicate.h"
00355 #include "src/Core/Reverse.h"
00356 #include "src/Core/ArrayBase.h"
00357 #include "src/Core/ArrayWrapper.h"
00358 
00359 #ifdef EIGEN_ENABLE_EVALUATORS
00360 #include "src/Core/Product.h"
00361 #include "src/Core/CoreEvaluators.h"
00362 #include "src/Core/AssignEvaluator.h"
00363 #endif 
00364 
00365 } // namespace Eigen
00366 
00367 #include "src/Core/GlobalFunctions.h"
00368 
00369 #include "src/Core/util/ReenableStupidWarnings.h"
00370 
00371 #ifdef EIGEN2_SUPPORT
00372 #include "Eigen2Support"
00373 #endif
00374 
00375 #endif // EIGEN_CORE_H



Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011