├── COPYING.GPL ├── COPYING.LGPL ├── Eigen ├── Array ├── CMakeLists.txt ├── Cholesky ├── Core ├── Dense ├── Eigen ├── Eigen2Support ├── Eigenvalues ├── Geometry ├── Householder ├── Jacobi ├── LU ├── LeastSquares ├── QR ├── QtAlignedMalloc ├── SVD ├── Sparse ├── StdDeque ├── StdList ├── StdVector └── src │ ├── CMakeLists.txt │ ├── Cholesky │ ├── CMakeLists.txt │ ├── LDLT.h │ └── LLT.h │ ├── Core │ ├── Array.h │ ├── ArrayBase.h │ ├── ArrayWrapper.h │ ├── Assign.h │ ├── BandMatrix.h │ ├── Block.h │ ├── BooleanRedux.h │ ├── CMakeLists.txt │ ├── CommaInitializer.h │ ├── CwiseBinaryOp.h │ ├── CwiseNullaryOp.h │ ├── CwiseUnaryOp.h │ ├── CwiseUnaryView.h │ ├── DenseBase.h │ ├── DenseCoeffsBase.h │ ├── DenseStorage.h │ ├── Diagonal.h │ ├── DiagonalMatrix.h │ ├── DiagonalProduct.h │ ├── Dot.h │ ├── EigenBase.h │ ├── Flagged.h │ ├── ForceAlignedAccess.h │ ├── Functors.h │ ├── Fuzzy.h │ ├── GenericPacketMath.h │ ├── GlobalFunctions.h │ ├── IO.h │ ├── Map.h │ ├── MapBase.h │ ├── MathFunctions.h │ ├── Matrix.h │ ├── MatrixBase.h │ ├── NestByValue.h │ ├── NoAlias.h │ ├── NumTraits.h │ ├── PermutationMatrix.h │ ├── PlainObjectBase.h │ ├── Product.h │ ├── ProductBase.h │ ├── Random.h │ ├── Redux.h │ ├── Replicate.h │ ├── ReturnByValue.h │ ├── Reverse.h │ ├── Select.h │ ├── SelfAdjointView.h │ ├── SelfCwiseBinaryOp.h │ ├── SolveTriangular.h │ ├── StableNorm.h │ ├── Stride.h │ ├── Swap.h │ ├── Transpose.h │ ├── Transpositions.h │ ├── TriangularMatrix.h │ ├── VectorBlock.h │ ├── VectorwiseOp.h │ ├── Visitor.h │ ├── arch │ │ ├── AltiVec │ │ │ ├── CMakeLists.txt │ │ │ ├── Complex.h │ │ │ └── PacketMath.h │ │ ├── CMakeLists.txt │ │ ├── Default │ │ │ ├── CMakeLists.txt │ │ │ └── Settings.h │ │ ├── NEON │ │ │ ├── CMakeLists.txt │ │ │ ├── Complex.h │ │ │ └── PacketMath.h │ │ └── SSE │ │ │ ├── CMakeLists.txt │ │ │ ├── Complex.h │ │ │ ├── MathFunctions.h │ │ │ └── PacketMath.h │ ├── products │ │ ├── CMakeLists.txt │ │ ├── CoeffBasedProduct.h │ │ ├── GeneralBlockPanelKernel.h │ │ ├── GeneralMatrixMatrix.h │ │ ├── GeneralMatrixMatrixTriangular.h │ │ ├── GeneralMatrixVector.h │ │ ├── Parallelizer.h │ │ ├── SelfadjointMatrixMatrix.h │ │ ├── SelfadjointMatrixVector.h │ │ ├── SelfadjointProduct.h │ │ ├── SelfadjointRank2Update.h │ │ ├── TriangularMatrixMatrix.h │ │ ├── TriangularMatrixVector.h │ │ ├── TriangularSolverMatrix.h │ │ └── TriangularSolverVector.h │ └── util │ │ ├── BlasUtil.h │ │ ├── CMakeLists.txt │ │ ├── Constants.h │ │ ├── DisableStupidWarnings.h │ │ ├── ForwardDeclarations.h │ │ ├── Macros.h │ │ ├── Memory.h │ │ ├── Meta.h │ │ ├── ReenableStupidWarnings.h │ │ ├── StaticAssert.h │ │ └── XprHelper.h │ ├── Eigen2Support │ ├── Block.h │ ├── CMakeLists.txt │ ├── Cwise.h │ ├── CwiseOperators.h │ ├── Geometry │ │ ├── AlignedBox.h │ │ ├── All.h │ │ ├── AngleAxis.h │ │ ├── CMakeLists.txt │ │ ├── Hyperplane.h │ │ ├── ParametrizedLine.h │ │ ├── Quaternion.h │ │ ├── Rotation2D.h │ │ ├── RotationBase.h │ │ ├── Scaling.h │ │ ├── Transform.h │ │ └── Translation.h │ ├── LU.h │ ├── Lazy.h │ ├── LeastSquares.h │ ├── Macros.h │ ├── MathFunctions.h │ ├── Memory.h │ ├── Meta.h │ ├── Minor.h │ ├── QR.h │ ├── SVD.h │ ├── TriangularSolver.h │ └── VectorBlock.h │ ├── Eigenvalues │ ├── CMakeLists.txt │ ├── ComplexEigenSolver.h │ ├── ComplexSchur.h │ ├── EigenSolver.h │ ├── EigenvaluesCommon.h │ ├── GeneralizedSelfAdjointEigenSolver.h │ ├── HessenbergDecomposition.h │ ├── MatrixBaseEigenvalues.h │ ├── RealSchur.h │ ├── SelfAdjointEigenSolver.h │ └── Tridiagonalization.h │ ├── Geometry │ ├── AlignedBox.h │ ├── AngleAxis.h │ ├── CMakeLists.txt │ ├── EulerAngles.h │ ├── Homogeneous.h │ ├── Hyperplane.h │ ├── OrthoMethods.h │ ├── ParametrizedLine.h │ ├── Quaternion.h │ ├── Rotation2D.h │ ├── RotationBase.h │ ├── Scaling.h │ ├── Transform.h │ ├── Translation.h │ ├── Umeyama.h │ └── arch │ │ ├── CMakeLists.txt │ │ └── Geometry_SSE.h │ ├── Householder │ ├── BlockHouseholder.h │ ├── CMakeLists.txt │ ├── Householder.h │ └── HouseholderSequence.h │ ├── Jacobi │ ├── CMakeLists.txt │ └── Jacobi.h │ ├── LU │ ├── CMakeLists.txt │ ├── Determinant.h │ ├── FullPivLU.h │ ├── Inverse.h │ ├── PartialPivLU.h │ └── arch │ │ ├── CMakeLists.txt │ │ └── Inverse_SSE.h │ ├── QR │ ├── CMakeLists.txt │ ├── ColPivHouseholderQR.h │ ├── FullPivHouseholderQR.h │ └── HouseholderQR.h │ ├── SVD │ ├── CMakeLists.txt │ ├── JacobiSVD.h │ └── UpperBidiagonalization.h │ ├── Sparse │ ├── AmbiVector.h │ ├── CMakeLists.txt │ ├── CompressedStorage.h │ ├── CoreIterators.h │ ├── DynamicSparseMatrix.h │ ├── MappedSparseMatrix.h │ ├── SparseAssign.h │ ├── SparseBlock.h │ ├── SparseCwiseBinaryOp.h │ ├── SparseCwiseUnaryOp.h │ ├── SparseDenseProduct.h │ ├── SparseDiagonalProduct.h │ ├── SparseDot.h │ ├── SparseFuzzy.h │ ├── SparseMatrix.h │ ├── SparseMatrixBase.h │ ├── SparseProduct.h │ ├── SparseRedux.h │ ├── SparseSelfAdjointView.h │ ├── SparseSparseProduct.h │ ├── SparseTranspose.h │ ├── SparseTriangularView.h │ ├── SparseUtil.h │ ├── SparseVector.h │ ├── SparseView.h │ └── TriangularSolver.h │ ├── StlSupport │ ├── CMakeLists.txt │ ├── StdDeque.h │ ├── StdList.h │ ├── StdVector.h │ └── details.h │ ├── misc │ ├── CMakeLists.txt │ ├── Image.h │ ├── Kernel.h │ └── Solve.h │ └── plugins │ ├── ArrayCwiseBinaryOps.h │ ├── ArrayCwiseUnaryOps.h │ ├── BlockMethods.h │ ├── CMakeLists.txt │ ├── CommonCwiseBinaryOps.h │ ├── CommonCwiseUnaryOps.h │ ├── MatrixCwiseBinaryOps.h │ └── MatrixCwiseUnaryOps.h ├── Eigen30.h ├── EigenAVR.h ├── README.mkd └── generate_restore_macros.sh /Eigen/Array: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_ARRAY_MODULE_H 2 | #define EIGEN_ARRAY_MODULE_H 3 | 4 | // include Core first to handle Eigen2 support macros 5 | #include "Core" 6 | 7 | #ifndef EIGEN2_SUPPORT 8 | #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. 9 | #endif 10 | 11 | #endif // EIGEN_ARRAY_MODULE_H 12 | -------------------------------------------------------------------------------- /Eigen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(RegexUtils) 2 | test_escape_string_as_regex() 3 | 4 | file(GLOB Eigen_directory_files "*") 5 | 6 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 7 | 8 | foreach(f ${Eigen_directory_files}) 9 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") 10 | list(APPEND Eigen_directory_files_to_install ${f}) 11 | endif() 12 | endforeach(f ${Eigen_directory_files}) 13 | 14 | install(FILES 15 | ${Eigen_directory_files_to_install} 16 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel 17 | ) 18 | 19 | add_subdirectory(src) 20 | -------------------------------------------------------------------------------- /Eigen/Cholesky: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_CHOLESKY_MODULE_H 2 | #define EIGEN_CHOLESKY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup Cholesky_Module Cholesky module 11 | * 12 | * 13 | * 14 | * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. 15 | * Those decompositions are accessible via the following MatrixBase methods: 16 | * - MatrixBase::llt(), 17 | * - MatrixBase::ldlt() 18 | * 19 | * \code 20 | * #include 21 | * \endcode 22 | */ 23 | 24 | #include "src/misc/Solve.h" 25 | #include "src/Cholesky/LLT.h" 26 | #include "src/Cholesky/LDLT.h" 27 | 28 | } // namespace Eigen 29 | 30 | #include "src/Core/util/ReenableStupidWarnings.h" 31 | 32 | #endif // EIGEN_CHOLESKY_MODULE_H 33 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 34 | -------------------------------------------------------------------------------- /Eigen/Dense: -------------------------------------------------------------------------------- 1 | #include "Core" 2 | #include "LU" 3 | #include "Cholesky" 4 | #include "QR" 5 | #include "SVD" 6 | #include "Geometry" 7 | #include "Eigenvalues" 8 | -------------------------------------------------------------------------------- /Eigen/Eigen: -------------------------------------------------------------------------------- 1 | #include "Dense" 2 | //#include "Sparse" 3 | -------------------------------------------------------------------------------- /Eigen/Eigen2Support: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2SUPPORT_H 26 | #define EIGEN2SUPPORT_H 27 | 28 | #if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) 29 | #error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header 30 | #endif 31 | 32 | #include "src/Core/util/DisableStupidWarnings.h" 33 | 34 | namespace Eigen { 35 | 36 | /** \defgroup Eigen2Support_Module Eigen2 support module 37 | * This module provides a couple of deprecated functions improving the compatibility with Eigen2. 38 | * 39 | * To use it, define EIGEN2_SUPPORT before including any Eigen header 40 | * \code 41 | * #define EIGEN2_SUPPORT 42 | * \endcode 43 | * 44 | */ 45 | 46 | #include "src/Eigen2Support/Macros.h" 47 | #include "src/Eigen2Support/Memory.h" 48 | #include "src/Eigen2Support/Meta.h" 49 | #include "src/Eigen2Support/Lazy.h" 50 | #include "src/Eigen2Support/Cwise.h" 51 | #include "src/Eigen2Support/CwiseOperators.h" 52 | #include "src/Eigen2Support/TriangularSolver.h" 53 | #include "src/Eigen2Support/Block.h" 54 | #include "src/Eigen2Support/VectorBlock.h" 55 | #include "src/Eigen2Support/Minor.h" 56 | #include "src/Eigen2Support/MathFunctions.h" 57 | 58 | 59 | } // namespace Eigen 60 | 61 | #include "src/Core/util/ReenableStupidWarnings.h" 62 | 63 | // Eigen2 used to include iostream 64 | #include 65 | 66 | #define USING_PART_OF_NAMESPACE_EIGEN \ 67 | EIGEN_USING_MATRIX_TYPEDEFS \ 68 | using Eigen::Matrix; \ 69 | using Eigen::MatrixBase; \ 70 | using Eigen::ei_random; \ 71 | using Eigen::ei_real; \ 72 | using Eigen::ei_imag; \ 73 | using Eigen::ei_conj; \ 74 | using Eigen::ei_abs; \ 75 | using Eigen::ei_abs2; \ 76 | using Eigen::ei_sqrt; \ 77 | using Eigen::ei_exp; \ 78 | using Eigen::ei_log; \ 79 | using Eigen::ei_sin; \ 80 | using Eigen::ei_cos; 81 | 82 | #endif // EIGEN2SUPPORT_H 83 | -------------------------------------------------------------------------------- /Eigen/Eigenvalues: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_EIGENVALUES_MODULE_H 2 | #define EIGEN_EIGENVALUES_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | #include "LU" 12 | 13 | namespace Eigen { 14 | 15 | /** \defgroup Eigenvalues_Module Eigenvalues module 16 | * 17 | * 18 | * 19 | * This module mainly provides various eigenvalue solvers. 20 | * This module also provides some MatrixBase methods, including: 21 | * - MatrixBase::eigenvalues(), 22 | * - MatrixBase::operatorNorm() 23 | * 24 | * \code 25 | * #include 26 | * \endcode 27 | */ 28 | 29 | #include "src/Eigenvalues/Tridiagonalization.h" 30 | #include "src/Eigenvalues/RealSchur.h" 31 | #include "src/Eigenvalues/EigenSolver.h" 32 | #include "src/Eigenvalues/SelfAdjointEigenSolver.h" 33 | #include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" 34 | #include "src/Eigenvalues/HessenbergDecomposition.h" 35 | #include "src/Eigenvalues/ComplexSchur.h" 36 | #include "src/Eigenvalues/ComplexEigenSolver.h" 37 | #include "src/Eigenvalues/MatrixBaseEigenvalues.h" 38 | 39 | } // namespace Eigen 40 | 41 | #include "src/Core/util/ReenableStupidWarnings.h" 42 | 43 | #endif // EIGEN_EIGENVALUES_MODULE_H 44 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 45 | -------------------------------------------------------------------------------- /Eigen/Geometry: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_GEOMETRY_MODULE_H 2 | #define EIGEN_GEOMETRY_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "SVD" 9 | #include "LU" 10 | #include 11 | 12 | #ifndef M_PI 13 | #define M_PI 3.14159265358979323846 14 | #endif 15 | 16 | namespace Eigen { 17 | 18 | /** \defgroup Geometry_Module Geometry module 19 | * 20 | * 21 | * 22 | * This module provides support for: 23 | * - fixed-size homogeneous transformations 24 | * - translation, scaling, 2D and 3D rotations 25 | * - quaternions 26 | * - \ref MatrixBase::cross() "cross product" 27 | * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" 28 | * - some linear components: parametrized-lines and hyperplanes 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | #include "src/Geometry/OrthoMethods.h" 36 | #include "src/Geometry/EulerAngles.h" 37 | 38 | #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 39 | #include "src/Geometry/Homogeneous.h" 40 | #include "src/Geometry/RotationBase.h" 41 | #include "src/Geometry/Rotation2D.h" 42 | #include "src/Geometry/Quaternion.h" 43 | #include "src/Geometry/AngleAxis.h" 44 | #include "src/Geometry/Transform.h" 45 | #include "src/Geometry/Translation.h" 46 | #include "src/Geometry/Scaling.h" 47 | #include "src/Geometry/Hyperplane.h" 48 | #include "src/Geometry/ParametrizedLine.h" 49 | #include "src/Geometry/AlignedBox.h" 50 | #include "src/Geometry/Umeyama.h" 51 | 52 | #if defined EIGEN_VECTORIZE_SSE 53 | #include "src/Geometry/arch/Geometry_SSE.h" 54 | #endif 55 | #endif 56 | 57 | #ifdef EIGEN2_SUPPORT 58 | #include "src/Eigen2Support/Geometry/All.h" 59 | #endif 60 | 61 | } // namespace Eigen 62 | 63 | #include "src/Core/util/ReenableStupidWarnings.h" 64 | 65 | #endif // EIGEN_GEOMETRY_MODULE_H 66 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 67 | 68 | -------------------------------------------------------------------------------- /Eigen/Householder: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_HOUSEHOLDER_MODULE_H 2 | #define EIGEN_HOUSEHOLDER_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup Householder_Module Householder module 11 | * This module provides Householder transformations. 12 | * 13 | * \code 14 | * #include 15 | * \endcode 16 | */ 17 | 18 | #include "src/Householder/Householder.h" 19 | #include "src/Householder/HouseholderSequence.h" 20 | #include "src/Householder/BlockHouseholder.h" 21 | 22 | } // namespace Eigen 23 | 24 | #include "src/Core/util/ReenableStupidWarnings.h" 25 | 26 | #endif // EIGEN_HOUSEHOLDER_MODULE_H 27 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 28 | -------------------------------------------------------------------------------- /Eigen/Jacobi: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_JACOBI_MODULE_H 2 | #define EIGEN_JACOBI_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup Jacobi_Module Jacobi module 11 | * This module provides Jacobi and Givens rotations. 12 | * 13 | * \code 14 | * #include 15 | * \endcode 16 | * 17 | * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: 18 | * - MatrixBase::applyOnTheLeft() 19 | * - MatrixBase::applyOnTheRight(). 20 | */ 21 | 22 | #include "src/Jacobi/Jacobi.h" 23 | 24 | } // namespace Eigen 25 | 26 | #include "src/Core/util/ReenableStupidWarnings.h" 27 | 28 | #endif // EIGEN_JACOBI_MODULE_H 29 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 30 | 31 | -------------------------------------------------------------------------------- /Eigen/LU: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_LU_MODULE_H 2 | #define EIGEN_LU_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | namespace Eigen { 9 | 10 | /** \defgroup LU_Module LU module 11 | * This module includes %LU decomposition and related notions such as matrix inversion and determinant. 12 | * This module defines the following MatrixBase methods: 13 | * - MatrixBase::inverse() 14 | * - MatrixBase::determinant() 15 | * 16 | * \code 17 | * #include 18 | * \endcode 19 | */ 20 | 21 | #include "src/misc/Solve.h" 22 | #include "src/misc/Kernel.h" 23 | #include "src/misc/Image.h" 24 | #include "src/LU/FullPivLU.h" 25 | #include "src/LU/PartialPivLU.h" 26 | #include "src/LU/Determinant.h" 27 | #include "src/LU/Inverse.h" 28 | 29 | #if defined EIGEN_VECTORIZE_SSE 30 | #include "src/LU/arch/Inverse_SSE.h" 31 | #endif 32 | 33 | #ifdef EIGEN2_SUPPORT 34 | #include "src/Eigen2Support/LU.h" 35 | #endif 36 | 37 | } // namespace Eigen 38 | 39 | #include "src/Core/util/ReenableStupidWarnings.h" 40 | 41 | #endif // EIGEN_LU_MODULE_H 42 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 43 | -------------------------------------------------------------------------------- /Eigen/LeastSquares: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_REGRESSION_MODULE_H 2 | #define EIGEN_REGRESSION_MODULE_H 3 | 4 | #ifndef EIGEN2_SUPPORT 5 | #error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) 6 | #endif 7 | 8 | // exclude from normal eigen3-only documentation 9 | #ifdef EIGEN2_SUPPORT 10 | 11 | #include "Core" 12 | 13 | #include "src/Core/util/DisableStupidWarnings.h" 14 | 15 | #include "Eigenvalues" 16 | #include "Geometry" 17 | 18 | namespace Eigen { 19 | 20 | /** \defgroup LeastSquares_Module LeastSquares module 21 | * This module provides linear regression and related features. 22 | * 23 | * \code 24 | * #include 25 | * \endcode 26 | */ 27 | 28 | #include "src/Eigen2Support/LeastSquares.h" 29 | 30 | } // namespace Eigen 31 | 32 | #include "src/Core/util/ReenableStupidWarnings.h" 33 | 34 | #endif // EIGEN2_SUPPORT 35 | 36 | #endif // EIGEN_REGRESSION_MODULE_H 37 | -------------------------------------------------------------------------------- /Eigen/QR: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_QR_MODULE_H 2 | #define EIGEN_QR_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include "Cholesky" 9 | #include "Jacobi" 10 | #include "Householder" 11 | 12 | namespace Eigen { 13 | 14 | /** \defgroup QR_Module QR module 15 | * 16 | * 17 | * 18 | * This module provides various QR decompositions 19 | * This module also provides some MatrixBase methods, including: 20 | * - MatrixBase::qr(), 21 | * 22 | * \code 23 | * #include 24 | * \endcode 25 | */ 26 | 27 | #include "src/misc/Solve.h" 28 | #include "src/QR/HouseholderQR.h" 29 | #include "src/QR/FullPivHouseholderQR.h" 30 | #include "src/QR/ColPivHouseholderQR.h" 31 | 32 | #ifdef EIGEN2_SUPPORT 33 | #include "src/Eigen2Support/QR.h" 34 | #endif 35 | 36 | } // namespace Eigen 37 | 38 | #include "src/Core/util/ReenableStupidWarnings.h" 39 | 40 | #ifdef EIGEN2_SUPPORT 41 | #include "Eigenvalues" 42 | #endif 43 | 44 | #endif // EIGEN_QR_MODULE_H 45 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 46 | -------------------------------------------------------------------------------- /Eigen/QtAlignedMalloc: -------------------------------------------------------------------------------- 1 | 2 | #ifndef EIGEN_QTMALLOC_MODULE_H 3 | #define EIGEN_QTMALLOC_MODULE_H 4 | 5 | #include "Core" 6 | 7 | #if (!EIGEN_MALLOC_ALREADY_ALIGNED) 8 | 9 | #include "src/Core/util/DisableStupidWarnings.h" 10 | 11 | void *qMalloc(size_t size) 12 | { 13 | return Eigen::internal::aligned_malloc(size); 14 | } 15 | 16 | void qFree(void *ptr) 17 | { 18 | Eigen::internal::aligned_free(ptr); 19 | } 20 | 21 | void *qRealloc(void *ptr, size_t size) 22 | { 23 | void* newPtr = Eigen::internal::aligned_malloc(size); 24 | memcpy(newPtr, ptr, size); 25 | Eigen::internal::aligned_free(ptr); 26 | return newPtr; 27 | } 28 | 29 | #include "src/Core/util/ReenableStupidWarnings.h" 30 | 31 | #endif 32 | 33 | #endif // EIGEN_QTMALLOC_MODULE_H 34 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 35 | -------------------------------------------------------------------------------- /Eigen/SVD: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SVD_MODULE_H 2 | #define EIGEN_SVD_MODULE_H 3 | 4 | #include "QR" 5 | #include "Householder" 6 | #include "Jacobi" 7 | 8 | #include "src/Core/util/DisableStupidWarnings.h" 9 | 10 | namespace Eigen { 11 | 12 | /** \defgroup SVD_Module SVD module 13 | * 14 | * 15 | * 16 | * This module provides SVD decomposition for matrices (both real and complex). 17 | * This decomposition is accessible via the following MatrixBase method: 18 | * - MatrixBase::jacobiSvd() 19 | * 20 | * \code 21 | * #include 22 | * \endcode 23 | */ 24 | 25 | #include "src/misc/Solve.h" 26 | #include "src/SVD/JacobiSVD.h" 27 | #include "src/SVD/UpperBidiagonalization.h" 28 | 29 | #ifdef EIGEN2_SUPPORT 30 | #include "src/Eigen2Support/SVD.h" 31 | #endif 32 | 33 | } // namespace Eigen 34 | 35 | #include "src/Core/util/ReenableStupidWarnings.h" 36 | 37 | #endif // EIGEN_SVD_MODULE_H 38 | /* vim: set filetype=cpp et sw=2 ts=2 ai: */ 39 | -------------------------------------------------------------------------------- /Eigen/Sparse: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_SPARSE_MODULE_H 2 | #define EIGEN_SPARSE_MODULE_H 3 | 4 | #include "Core" 5 | 6 | #include "src/Core/util/DisableStupidWarnings.h" 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #ifdef EIGEN2_SUPPORT 15 | #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 16 | #endif 17 | 18 | #ifndef EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET 19 | #error The sparse module API is not stable yet. To use it anyway, please define the EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET preprocessor token. 20 | #endif 21 | 22 | namespace Eigen { 23 | 24 | /** \defgroup Sparse_Module Sparse module 25 | * 26 | * 27 | * 28 | * See the \ref TutorialSparse "Sparse tutorial" 29 | * 30 | * \code 31 | * #include 32 | * \endcode 33 | */ 34 | 35 | /** The type used to identify a general sparse storage. */ 36 | struct Sparse {}; 37 | 38 | #include "src/Sparse/SparseUtil.h" 39 | #include "src/Sparse/SparseMatrixBase.h" 40 | #include "src/Sparse/CompressedStorage.h" 41 | #include "src/Sparse/AmbiVector.h" 42 | #include "src/Sparse/SparseMatrix.h" 43 | #include "src/Sparse/DynamicSparseMatrix.h" 44 | #include "src/Sparse/MappedSparseMatrix.h" 45 | #include "src/Sparse/SparseVector.h" 46 | #include "src/Sparse/CoreIterators.h" 47 | #include "src/Sparse/SparseBlock.h" 48 | #include "src/Sparse/SparseTranspose.h" 49 | #include "src/Sparse/SparseCwiseUnaryOp.h" 50 | #include "src/Sparse/SparseCwiseBinaryOp.h" 51 | #include "src/Sparse/SparseDot.h" 52 | #include "src/Sparse/SparseAssign.h" 53 | #include "src/Sparse/SparseRedux.h" 54 | #include "src/Sparse/SparseFuzzy.h" 55 | #include "src/Sparse/SparseProduct.h" 56 | #include "src/Sparse/SparseSparseProduct.h" 57 | #include "src/Sparse/SparseDenseProduct.h" 58 | #include "src/Sparse/SparseDiagonalProduct.h" 59 | #include "src/Sparse/SparseTriangularView.h" 60 | #include "src/Sparse/SparseSelfAdjointView.h" 61 | #include "src/Sparse/TriangularSolver.h" 62 | #include "src/Sparse/SparseView.h" 63 | 64 | } // namespace Eigen 65 | 66 | #include "src/Core/util/ReenableStupidWarnings.h" 67 | 68 | #endif // EIGEN_SPARSE_MODULE_H 69 | 70 | -------------------------------------------------------------------------------- /Eigen/StdDeque: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_STDDEQUE_MODULE_H 27 | #define EIGEN_STDDEQUE_MODULE_H 28 | 29 | #include "Core" 30 | #include 31 | 32 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 33 | 34 | #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) 35 | 36 | #else 37 | 38 | #include "src/StlSupport/StdDeque.h" 39 | 40 | #endif 41 | 42 | #endif // EIGEN_STDDEQUE_MODULE_H 43 | -------------------------------------------------------------------------------- /Eigen/StdList: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_STDLIST_MODULE_H 26 | #define EIGEN_STDLIST_MODULE_H 27 | 28 | #include "Core" 29 | #include 30 | 31 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 32 | 33 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) 34 | 35 | #else 36 | 37 | #include "src/StlSupport/StdList.h" 38 | 39 | #endif 40 | 41 | #endif // EIGEN_STDLIST_MODULE_H 42 | -------------------------------------------------------------------------------- /Eigen/StdVector: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_STDVECTOR_MODULE_H 27 | #define EIGEN_STDVECTOR_MODULE_H 28 | 29 | #include "Core" 30 | #include 31 | 32 | #if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ 33 | 34 | #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) 35 | 36 | #else 37 | 38 | #include "src/StlSupport/StdVector.h" 39 | 40 | #endif 41 | 42 | #endif // EIGEN_STDVECTOR_MODULE_H 43 | -------------------------------------------------------------------------------- /Eigen/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB Eigen_src_subdirectories "*") 2 | escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") 3 | foreach(f ${Eigen_src_subdirectories}) 4 | if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) 5 | add_subdirectory(${f}) 6 | endif() 7 | endforeach() 8 | -------------------------------------------------------------------------------- /Eigen/src/Cholesky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Cholesky_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Cholesky_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/BooleanRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_ALLANDANY_H 26 | #define EIGEN_ALLANDANY_H 27 | 28 | namespace internal { 29 | 30 | template 31 | struct all_unroller 32 | { 33 | enum { 34 | col = (UnrollCount-1) / Derived::RowsAtCompileTime, 35 | row = (UnrollCount-1) % Derived::RowsAtCompileTime 36 | }; 37 | 38 | inline static bool run(const Derived &mat) 39 | { 40 | return all_unroller::run(mat) && mat.coeff(row, col); 41 | } 42 | }; 43 | 44 | template 45 | struct all_unroller 46 | { 47 | inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } 48 | }; 49 | 50 | template 51 | struct all_unroller 52 | { 53 | inline static bool run(const Derived &) { return false; } 54 | }; 55 | 56 | template 57 | struct any_unroller 58 | { 59 | enum { 60 | col = (UnrollCount-1) / Derived::RowsAtCompileTime, 61 | row = (UnrollCount-1) % Derived::RowsAtCompileTime 62 | }; 63 | 64 | inline static bool run(const Derived &mat) 65 | { 66 | return any_unroller::run(mat) || mat.coeff(row, col); 67 | } 68 | }; 69 | 70 | template 71 | struct any_unroller 72 | { 73 | inline static bool run(const Derived &mat) { return mat.coeff(0, 0); } 74 | }; 75 | 76 | template 77 | struct any_unroller 78 | { 79 | inline static bool run(const Derived &) { return false; } 80 | }; 81 | 82 | } // end namespace internal 83 | 84 | /** \returns true if all coefficients are true 85 | * 86 | * Example: \include MatrixBase_all.cpp 87 | * Output: \verbinclude MatrixBase_all.out 88 | * 89 | * \sa any(), Cwise::operator<() 90 | */ 91 | template 92 | inline bool DenseBase::all() const 93 | { 94 | enum { 95 | unroll = SizeAtCompileTime != Dynamic 96 | && CoeffReadCost != Dynamic 97 | && NumTraits::AddCost != Dynamic 98 | && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT 99 | }; 100 | if(unroll) 101 | return internal::all_unroller::run(derived()); 104 | else 105 | { 106 | for(Index j = 0; j < cols(); ++j) 107 | for(Index i = 0; i < rows(); ++i) 108 | if (!coeff(i, j)) return false; 109 | return true; 110 | } 111 | } 112 | 113 | /** \returns true if at least one coefficient is true 114 | * 115 | * \sa all() 116 | */ 117 | template 118 | inline bool DenseBase::any() const 119 | { 120 | enum { 121 | unroll = SizeAtCompileTime != Dynamic 122 | && CoeffReadCost != Dynamic 123 | && NumTraits::AddCost != Dynamic 124 | && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT 125 | }; 126 | if(unroll) 127 | return internal::any_unroller::run(derived()); 130 | else 131 | { 132 | for(Index j = 0; j < cols(); ++j) 133 | for(Index i = 0; i < rows(); ++i) 134 | if (coeff(i, j)) return true; 135 | return false; 136 | } 137 | } 138 | 139 | /** \returns the number of coefficients which evaluate to true 140 | * 141 | * \sa all(), any() 142 | */ 143 | template 144 | inline typename DenseBase::Index DenseBase::count() const 145 | { 146 | return derived().template cast().template cast().sum(); 147 | } 148 | 149 | #endif // EIGEN_ALLANDANY_H 150 | -------------------------------------------------------------------------------- /Eigen/src/Core/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(products) 9 | ADD_SUBDIRECTORY(util) 10 | ADD_SUBDIRECTORY(arch) 11 | -------------------------------------------------------------------------------- /Eigen/src/Core/Flagged.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_FLAGGED_H 26 | #define EIGEN_FLAGGED_H 27 | 28 | /** \class Flagged 29 | * \ingroup Core_Module 30 | * 31 | * \brief Expression with modified flags 32 | * 33 | * \param ExpressionType the type of the object of which we are modifying the flags 34 | * \param Added the flags added to the expression 35 | * \param Removed the flags removed from the expression (has priority over Added). 36 | * 37 | * This class represents an expression whose flags have been modified. 38 | * It is the return type of MatrixBase::flagged() 39 | * and most of the time this is the only way it is used. 40 | * 41 | * \sa MatrixBase::flagged() 42 | */ 43 | 44 | namespace internal { 45 | template 46 | struct traits > : traits 47 | { 48 | enum { Flags = (ExpressionType::Flags | Added) & ~Removed }; 49 | }; 50 | } 51 | 52 | template class Flagged 53 | : public MatrixBase > 54 | { 55 | public: 56 | 57 | typedef MatrixBase Base; 58 | 59 | EIGEN_DENSE_PUBLIC_INTERFACE(Flagged) 60 | typedef typename internal::conditional::ret, 61 | ExpressionType, const ExpressionType&>::type ExpressionTypeNested; 62 | typedef typename ExpressionType::InnerIterator InnerIterator; 63 | 64 | inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {} 65 | 66 | inline Index rows() const { return m_matrix.rows(); } 67 | inline Index cols() const { return m_matrix.cols(); } 68 | inline Index outerStride() const { return m_matrix.outerStride(); } 69 | inline Index innerStride() const { return m_matrix.innerStride(); } 70 | 71 | inline CoeffReturnType coeff(Index row, Index col) const 72 | { 73 | return m_matrix.coeff(row, col); 74 | } 75 | 76 | inline CoeffReturnType coeff(Index index) const 77 | { 78 | return m_matrix.coeff(index); 79 | } 80 | 81 | inline const Scalar& coeffRef(Index row, Index col) const 82 | { 83 | return m_matrix.const_cast_derived().coeffRef(row, col); 84 | } 85 | 86 | inline const Scalar& coeffRef(Index index) const 87 | { 88 | return m_matrix.const_cast_derived().coeffRef(index); 89 | } 90 | 91 | inline Scalar& coeffRef(Index row, Index col) 92 | { 93 | return m_matrix.const_cast_derived().coeffRef(row, col); 94 | } 95 | 96 | inline Scalar& coeffRef(Index index) 97 | { 98 | return m_matrix.const_cast_derived().coeffRef(index); 99 | } 100 | 101 | template 102 | inline const PacketScalar packet(Index row, Index col) const 103 | { 104 | return m_matrix.template packet(row, col); 105 | } 106 | 107 | template 108 | inline void writePacket(Index row, Index col, const PacketScalar& x) 109 | { 110 | m_matrix.const_cast_derived().template writePacket(row, col, x); 111 | } 112 | 113 | template 114 | inline const PacketScalar packet(Index index) const 115 | { 116 | return m_matrix.template packet(index); 117 | } 118 | 119 | template 120 | inline void writePacket(Index index, const PacketScalar& x) 121 | { 122 | m_matrix.const_cast_derived().template writePacket(index, x); 123 | } 124 | 125 | const ExpressionType& _expression() const { return m_matrix; } 126 | 127 | template 128 | typename ExpressionType::PlainObject solveTriangular(const MatrixBase& other) const; 129 | 130 | template 131 | void solveTriangularInPlace(const MatrixBase& other) const; 132 | 133 | protected: 134 | ExpressionTypeNested m_matrix; 135 | }; 136 | 137 | /** \returns an expression of *this with added and removed flags 138 | * 139 | * This is mostly for internal use. 140 | * 141 | * \sa class Flagged 142 | */ 143 | template 144 | template 145 | inline const Flagged 146 | DenseBase::flagged() const 147 | { 148 | return derived(); 149 | } 150 | 151 | #endif // EIGEN_FLAGGED_H 152 | -------------------------------------------------------------------------------- /Eigen/src/Core/ForceAlignedAccess.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_FORCEALIGNEDACCESS_H 26 | #define EIGEN_FORCEALIGNEDACCESS_H 27 | 28 | /** \class ForceAlignedAccess 29 | * \ingroup Core_Module 30 | * 31 | * \brief Enforce aligned packet loads and stores regardless of what is requested 32 | * 33 | * \param ExpressionType the type of the object of which we are forcing aligned packet access 34 | * 35 | * This class is the return type of MatrixBase::forceAlignedAccess() 36 | * and most of the time this is the only way it is used. 37 | * 38 | * \sa MatrixBase::forceAlignedAccess() 39 | */ 40 | 41 | namespace internal { 42 | template 43 | struct traits > : public traits 44 | {}; 45 | } 46 | 47 | template class ForceAlignedAccess 48 | : public internal::dense_xpr_base< ForceAlignedAccess >::type 49 | { 50 | public: 51 | 52 | typedef typename internal::dense_xpr_base::type Base; 53 | EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) 54 | 55 | inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} 56 | 57 | inline Index rows() const { return m_expression.rows(); } 58 | inline Index cols() const { return m_expression.cols(); } 59 | inline Index outerStride() const { return m_expression.outerStride(); } 60 | inline Index innerStride() const { return m_expression.innerStride(); } 61 | 62 | inline const CoeffReturnType coeff(Index row, Index col) const 63 | { 64 | return m_expression.coeff(row, col); 65 | } 66 | 67 | inline Scalar& coeffRef(Index row, Index col) 68 | { 69 | return m_expression.const_cast_derived().coeffRef(row, col); 70 | } 71 | 72 | inline const CoeffReturnType coeff(Index index) const 73 | { 74 | return m_expression.coeff(index); 75 | } 76 | 77 | inline Scalar& coeffRef(Index index) 78 | { 79 | return m_expression.const_cast_derived().coeffRef(index); 80 | } 81 | 82 | template 83 | inline const PacketScalar packet(Index row, Index col) const 84 | { 85 | return m_expression.template packet(row, col); 86 | } 87 | 88 | template 89 | inline void writePacket(Index row, Index col, const PacketScalar& x) 90 | { 91 | m_expression.const_cast_derived().template writePacket(row, col, x); 92 | } 93 | 94 | template 95 | inline const PacketScalar packet(Index index) const 96 | { 97 | return m_expression.template packet(index); 98 | } 99 | 100 | template 101 | inline void writePacket(Index index, const PacketScalar& x) 102 | { 103 | m_expression.const_cast_derived().template writePacket(index, x); 104 | } 105 | 106 | operator const ExpressionType&() const { return m_expression; } 107 | 108 | protected: 109 | const ExpressionType& m_expression; 110 | 111 | private: 112 | ForceAlignedAccess& operator=(const ForceAlignedAccess&); 113 | }; 114 | 115 | /** \returns an expression of *this with forced aligned access 116 | * \sa forceAlignedAccessIf(),class ForceAlignedAccess 117 | */ 118 | template 119 | inline const ForceAlignedAccess 120 | MatrixBase::forceAlignedAccess() const 121 | { 122 | return ForceAlignedAccess(derived()); 123 | } 124 | 125 | /** \returns an expression of *this with forced aligned access 126 | * \sa forceAlignedAccessIf(), class ForceAlignedAccess 127 | */ 128 | template 129 | inline ForceAlignedAccess 130 | MatrixBase::forceAlignedAccess() 131 | { 132 | return ForceAlignedAccess(derived()); 133 | } 134 | 135 | /** \returns an expression of *this with forced aligned access if \a Enable is true. 136 | * \sa forceAlignedAccess(), class ForceAlignedAccess 137 | */ 138 | template 139 | template 140 | inline typename internal::add_const_on_value_type,Derived&>::type>::type 141 | MatrixBase::forceAlignedAccessIf() const 142 | { 143 | return derived(); 144 | } 145 | 146 | /** \returns an expression of *this with forced aligned access if \a Enable is true. 147 | * \sa forceAlignedAccess(), class ForceAlignedAccess 148 | */ 149 | template 150 | template 151 | inline typename internal::conditional,Derived&>::type 152 | MatrixBase::forceAlignedAccessIf() 153 | { 154 | return derived(); 155 | } 156 | 157 | #endif // EIGEN_FORCEALIGNEDACCESS_H 158 | -------------------------------------------------------------------------------- /Eigen/src/Core/GlobalFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // Copyright (C) 2010 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_GLOBAL_FUNCTIONS_H 27 | #define EIGEN_GLOBAL_FUNCTIONS_H 28 | 29 | #define EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(NAME,FUNCTOR) \ 30 | template \ 31 | inline const Eigen::CwiseUnaryOp, const Derived> \ 32 | NAME(const Eigen::ArrayBase& x) { \ 33 | return x.derived(); \ 34 | } 35 | 36 | #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ 37 | \ 38 | template \ 39 | struct NAME##_retval > \ 40 | { \ 41 | typedef const Eigen::CwiseUnaryOp, const Derived> type; \ 42 | }; \ 43 | template \ 44 | struct NAME##_impl > \ 45 | { \ 46 | static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \ 47 | { \ 48 | return x.derived(); \ 49 | } \ 50 | }; 51 | 52 | 53 | namespace std 54 | { 55 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(real,scalar_real_op) 56 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(imag,scalar_imag_op) 57 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sin,scalar_sin_op) 58 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(cos,scalar_cos_op) 59 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(asin,scalar_asin_op) 60 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(acos,scalar_acos_op) 61 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(tan,scalar_tan_op) 62 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(exp,scalar_exp_op) 63 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(log,scalar_log_op) 64 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(abs,scalar_abs_op) 65 | EIGEN_ARRAY_DECLARE_GLOBAL_STD_UNARY(sqrt,scalar_sqrt_op) 66 | 67 | template 68 | inline const Eigen::CwiseUnaryOp, const Derived> 69 | pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) { \ 70 | return x.derived().pow(exponent); \ 71 | } 72 | } 73 | 74 | namespace Eigen 75 | { 76 | namespace internal 77 | { 78 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op) 79 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op) 80 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sin,scalar_sin_op) 81 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(cos,scalar_cos_op) 82 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(asin,scalar_asin_op) 83 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(acos,scalar_acos_op) 84 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(tan,scalar_tan_op) 85 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(exp,scalar_exp_op) 86 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(log,scalar_log_op) 87 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs,scalar_abs_op) 88 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op) 89 | EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(sqrt,scalar_sqrt_op) 90 | } 91 | } 92 | 93 | // TODO: cleanly disable those functions that are not supported on Array (internal::real_ref, internal::random, internal::isApprox...) 94 | 95 | #endif // EIGEN_GLOBAL_FUNCTIONS_H 96 | -------------------------------------------------------------------------------- /Eigen/src/Core/NestByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_NESTBYVALUE_H 27 | #define EIGEN_NESTBYVALUE_H 28 | 29 | /** \class NestByValue 30 | * \ingroup Core_Module 31 | * 32 | * \brief Expression which must be nested by value 33 | * 34 | * \param ExpressionType the type of the object of which we are requiring nesting-by-value 35 | * 36 | * This class is the return type of MatrixBase::nestByValue() 37 | * and most of the time this is the only way it is used. 38 | * 39 | * \sa MatrixBase::nestByValue() 40 | */ 41 | 42 | namespace internal { 43 | template 44 | struct traits > : public traits 45 | {}; 46 | } 47 | 48 | template class NestByValue 49 | : public internal::dense_xpr_base< NestByValue >::type 50 | { 51 | public: 52 | 53 | typedef typename internal::dense_xpr_base::type Base; 54 | EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) 55 | 56 | inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} 57 | 58 | inline Index rows() const { return m_expression.rows(); } 59 | inline Index cols() const { return m_expression.cols(); } 60 | inline Index outerStride() const { return m_expression.outerStride(); } 61 | inline Index innerStride() const { return m_expression.innerStride(); } 62 | 63 | inline const CoeffReturnType coeff(Index row, Index col) const 64 | { 65 | return m_expression.coeff(row, col); 66 | } 67 | 68 | inline Scalar& coeffRef(Index row, Index col) 69 | { 70 | return m_expression.const_cast_derived().coeffRef(row, col); 71 | } 72 | 73 | inline const CoeffReturnType coeff(Index index) const 74 | { 75 | return m_expression.coeff(index); 76 | } 77 | 78 | inline Scalar& coeffRef(Index index) 79 | { 80 | return m_expression.const_cast_derived().coeffRef(index); 81 | } 82 | 83 | template 84 | inline const PacketScalar packet(Index row, Index col) const 85 | { 86 | return m_expression.template packet(row, col); 87 | } 88 | 89 | template 90 | inline void writePacket(Index row, Index col, const PacketScalar& x) 91 | { 92 | m_expression.const_cast_derived().template writePacket(row, col, x); 93 | } 94 | 95 | template 96 | inline const PacketScalar packet(Index index) const 97 | { 98 | return m_expression.template packet(index); 99 | } 100 | 101 | template 102 | inline void writePacket(Index index, const PacketScalar& x) 103 | { 104 | m_expression.const_cast_derived().template writePacket(index, x); 105 | } 106 | 107 | operator const ExpressionType&() const { return m_expression; } 108 | 109 | protected: 110 | const ExpressionType m_expression; 111 | }; 112 | 113 | /** \returns an expression of the temporary version of *this. 114 | */ 115 | template 116 | inline const NestByValue 117 | DenseBase::nestByValue() const 118 | { 119 | return NestByValue(derived()); 120 | } 121 | 122 | #endif // EIGEN_NESTBYVALUE_H 123 | -------------------------------------------------------------------------------- /Eigen/src/Core/ReturnByValue.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009-2010 Gael Guennebaud 5 | // Copyright (C) 2009-2010 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_RETURNBYVALUE_H 27 | #define EIGEN_RETURNBYVALUE_H 28 | 29 | /** \class ReturnByValue 30 | * \ingroup Core_Module 31 | * 32 | */ 33 | 34 | namespace internal { 35 | 36 | template 37 | struct traits > 38 | : public traits::ReturnType> 39 | { 40 | enum { 41 | // We're disabling the DirectAccess because e.g. the constructor of 42 | // the Block-with-DirectAccess expression requires to have a coeffRef method. 43 | // Also, we don't want to have to implement the stride stuff. 44 | Flags = (traits::ReturnType>::Flags 45 | | EvalBeforeNestingBit) & ~DirectAccessBit 46 | }; 47 | }; 48 | 49 | /* The ReturnByValue object doesn't even have a coeff() method. 50 | * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. 51 | * So internal::nested always gives the plain return matrix type. 52 | * 53 | * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? 54 | */ 55 | template 56 | struct nested, n, PlainObject> 57 | { 58 | typedef typename traits::ReturnType type; 59 | }; 60 | 61 | } // end namespace internal 62 | 63 | template class ReturnByValue 64 | : public internal::dense_xpr_base< ReturnByValue >::type 65 | { 66 | public: 67 | typedef typename internal::traits::ReturnType ReturnType; 68 | 69 | typedef typename internal::dense_xpr_base::type Base; 70 | EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) 71 | 72 | template 73 | inline void evalTo(Dest& dst) const 74 | { static_cast(this)->evalTo(dst); } 75 | inline Index rows() const { return static_cast(this)->rows(); } 76 | inline Index cols() const { return static_cast(this)->cols(); } 77 | 78 | #ifndef EIGEN_PARSED_BY_DOXYGEN 79 | #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT 80 | class Unusable{ 81 | Unusable(const Unusable&) {} 82 | Unusable& operator=(const Unusable&) {return *this;} 83 | }; 84 | const Unusable& coeff(Index) const { return *reinterpret_cast(this); } 85 | const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } 86 | Unusable& coeffRef(Index) { return *reinterpret_cast(this); } 87 | Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } 88 | #endif 89 | }; 90 | 91 | template 92 | template 93 | Derived& DenseBase::operator=(const ReturnByValue& other) 94 | { 95 | other.evalTo(derived()); 96 | return derived(); 97 | } 98 | 99 | #endif // EIGEN_RETURNBYVALUE_H 100 | -------------------------------------------------------------------------------- /Eigen/src/Core/Stride.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_STRIDE_H 26 | #define EIGEN_STRIDE_H 27 | 28 | /** \class Stride 29 | * \ingroup Core_Module 30 | * 31 | * \brief Holds strides information for Map 32 | * 33 | * This class holds the strides information for mapping arrays with strides with class Map. 34 | * 35 | * It holds two values: the inner stride and the outer stride. 36 | * 37 | * The inner stride is the pointer increment between two consecutive entries within a given row of a 38 | * row-major matrix or within a given column of a column-major matrix. 39 | * 40 | * The outer stride is the pointer increment between two consecutive rows of a row-major matrix or 41 | * between two consecutive columns of a column-major matrix. 42 | * 43 | * These two values can be passed either at compile-time as template parameters, or at runtime as 44 | * arguments to the constructor. 45 | * 46 | * Indeed, this class takes two template parameters: 47 | * \param _OuterStrideAtCompileTime the outer stride, or Dynamic if you want to specify it at runtime. 48 | * \param _InnerStrideAtCompileTime the inner stride, or Dynamic if you want to specify it at runtime. 49 | * 50 | * Here is an example: 51 | * \include Map_general_stride.cpp 52 | * Output: \verbinclude Map_general_stride.out 53 | * 54 | * \sa class InnerStride, class OuterStride, \ref TopicStorageOrders 55 | */ 56 | template 57 | class Stride 58 | { 59 | public: 60 | typedef DenseIndex Index; 61 | enum { 62 | InnerStrideAtCompileTime = _InnerStrideAtCompileTime, 63 | OuterStrideAtCompileTime = _OuterStrideAtCompileTime 64 | }; 65 | 66 | /** Default constructor, for use when strides are fixed at compile time */ 67 | Stride() 68 | : m_outer(OuterStrideAtCompileTime), m_inner(InnerStrideAtCompileTime) 69 | { 70 | eigen_assert(InnerStrideAtCompileTime != Dynamic && OuterStrideAtCompileTime != Dynamic); 71 | } 72 | 73 | /** Constructor allowing to pass the strides at runtime */ 74 | Stride(Index outerStride, Index innerStride) 75 | : m_outer(outerStride), m_inner(innerStride) 76 | { 77 | eigen_assert(innerStride>=0 && outerStride>=0); 78 | } 79 | 80 | /** Copy constructor */ 81 | Stride(const Stride& other) 82 | : m_outer(other.outer()), m_inner(other.inner()) 83 | {} 84 | 85 | /** \returns the outer stride */ 86 | inline Index outer() const { return m_outer.value(); } 87 | /** \returns the inner stride */ 88 | inline Index inner() const { return m_inner.value(); } 89 | 90 | protected: 91 | internal::variable_if_dynamic m_outer; 92 | internal::variable_if_dynamic m_inner; 93 | }; 94 | 95 | /** \brief Convenience specialization of Stride to specify only an inner stride 96 | * See class Map for some examples */ 97 | template 98 | class InnerStride : public Stride<0, Value> 99 | { 100 | typedef Stride<0, Value> Base; 101 | public: 102 | typedef DenseIndex Index; 103 | InnerStride() : Base() {} 104 | InnerStride(Index v) : Base(0, v) {} 105 | }; 106 | 107 | /** \brief Convenience specialization of Stride to specify only an outer stride 108 | * See class Map for some examples */ 109 | template 110 | class OuterStride : public Stride 111 | { 112 | typedef Stride Base; 113 | public: 114 | typedef DenseIndex Index; 115 | OuterStride() : Base() {} 116 | OuterStride(Index v) : Base(v,0) {} 117 | }; 118 | 119 | #endif // EIGEN_STRIDE_H 120 | -------------------------------------------------------------------------------- /Eigen/src/Core/Swap.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2006-2008 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SWAP_H 26 | #define EIGEN_SWAP_H 27 | 28 | /** \class SwapWrapper 29 | * \ingroup Core_Module 30 | * 31 | * \internal 32 | * 33 | * \brief Internal helper class for swapping two expressions 34 | */ 35 | namespace internal { 36 | template 37 | struct traits > : traits {}; 38 | } 39 | 40 | template class SwapWrapper 41 | : public internal::dense_xpr_base >::type 42 | { 43 | public: 44 | 45 | typedef typename internal::dense_xpr_base::type Base; 46 | EIGEN_DENSE_PUBLIC_INTERFACE(SwapWrapper) 47 | typedef typename internal::packet_traits::type Packet; 48 | 49 | inline SwapWrapper(ExpressionType& xpr) : m_expression(xpr) {} 50 | 51 | inline Index rows() const { return m_expression.rows(); } 52 | inline Index cols() const { return m_expression.cols(); } 53 | inline Index outerStride() const { return m_expression.outerStride(); } 54 | inline Index innerStride() const { return m_expression.innerStride(); } 55 | 56 | inline Scalar& coeffRef(Index row, Index col) 57 | { 58 | return m_expression.const_cast_derived().coeffRef(row, col); 59 | } 60 | 61 | inline Scalar& coeffRef(Index index) 62 | { 63 | return m_expression.const_cast_derived().coeffRef(index); 64 | } 65 | 66 | inline Scalar& coeffRef(Index row, Index col) const 67 | { 68 | return m_expression.coeffRef(row, col); 69 | } 70 | 71 | inline Scalar& coeffRef(Index index) const 72 | { 73 | return m_expression.coeffRef(index); 74 | } 75 | 76 | template 77 | void copyCoeff(Index row, Index col, const DenseBase& other) 78 | { 79 | OtherDerived& _other = other.const_cast_derived(); 80 | eigen_internal_assert(row >= 0 && row < rows() 81 | && col >= 0 && col < cols()); 82 | Scalar tmp = m_expression.coeff(row, col); 83 | m_expression.coeffRef(row, col) = _other.coeff(row, col); 84 | _other.coeffRef(row, col) = tmp; 85 | } 86 | 87 | template 88 | void copyCoeff(Index index, const DenseBase& other) 89 | { 90 | OtherDerived& _other = other.const_cast_derived(); 91 | eigen_internal_assert(index >= 0 && index < m_expression.size()); 92 | Scalar tmp = m_expression.coeff(index); 93 | m_expression.coeffRef(index) = _other.coeff(index); 94 | _other.coeffRef(index) = tmp; 95 | } 96 | 97 | template 98 | void copyPacket(Index row, Index col, const DenseBase& other) 99 | { 100 | OtherDerived& _other = other.const_cast_derived(); 101 | eigen_internal_assert(row >= 0 && row < rows() 102 | && col >= 0 && col < cols()); 103 | Packet tmp = m_expression.template packet(row, col); 104 | m_expression.template writePacket(row, col, 105 | _other.template packet(row, col) 106 | ); 107 | _other.template writePacket(row, col, tmp); 108 | } 109 | 110 | template 111 | void copyPacket(Index index, const DenseBase& other) 112 | { 113 | OtherDerived& _other = other.const_cast_derived(); 114 | eigen_internal_assert(index >= 0 && index < m_expression.size()); 115 | Packet tmp = m_expression.template packet(index); 116 | m_expression.template writePacket(index, 117 | _other.template packet(index) 118 | ); 119 | _other.template writePacket(index, tmp); 120 | } 121 | 122 | protected: 123 | ExpressionType& m_expression; 124 | }; 125 | 126 | #endif // EIGEN_SWAP_H 127 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/AltiVec/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_AltiVec_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_AltiVec_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/AltiVec COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | ADD_SUBDIRECTORY(SSE) 2 | ADD_SUBDIRECTORY(AltiVec) 3 | ADD_SUBDIRECTORY(NEON) 4 | ADD_SUBDIRECTORY(Default) 5 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/Default/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_Default_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_Default_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/Default COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/Default/Settings.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | 27 | /* All the parameters defined in this file can be specialized in the 28 | * architecture specific files, and/or by the user. 29 | * More to come... */ 30 | 31 | #ifndef EIGEN_DEFAULT_SETTINGS_H 32 | #define EIGEN_DEFAULT_SETTINGS_H 33 | 34 | /** Defines the maximal loop size to enable meta unrolling of loops. 35 | * Note that the value here is expressed in Eigen's own notion of "number of FLOPS", 36 | * it does not correspond to the number of iterations or the number of instructions 37 | */ 38 | #ifndef EIGEN_UNROLLING_LIMIT 39 | #define EIGEN_UNROLLING_LIMIT 100 40 | #endif 41 | 42 | /** Defines the threshold between a "small" and a "large" matrix. 43 | * This threshold is mainly used to select the proper product implementation. 44 | */ 45 | #ifndef EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 46 | #define EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD 8 47 | #endif 48 | 49 | /** Defines the maximal width of the blocks used in the triangular product and solver 50 | * for vectors (level 2 blas xTRMV and xTRSV). The default is 8. 51 | */ 52 | #ifndef EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 53 | #define EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH 8 54 | #endif 55 | 56 | 57 | /** Defines the default number of registers available for that architecture. 58 | * Currently it must be 8 or 16. Other values will fail. 59 | */ 60 | #ifndef EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 61 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 8 62 | #endif 63 | 64 | #endif // EIGEN_DEFAULT_SETTINGS_H 65 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/NEON/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_NEON_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_NEON_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/NEON COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/arch/SSE/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_arch_SSE_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_arch_SSE_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/arch/SSE COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/products/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_Product_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_Product_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/products COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/products/Parallelizer.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_PARALLELIZER_H 26 | #define EIGEN_PARALLELIZER_H 27 | 28 | namespace internal { 29 | 30 | /** \internal */ 31 | inline void manage_multi_threading(Action action, int* v) 32 | { 33 | static EIGEN_UNUSED int m_maxThreads = -1; 34 | 35 | if(action==SetAction) 36 | { 37 | eigen_internal_assert(v!=0); 38 | m_maxThreads = *v; 39 | } 40 | else if(action==GetAction) 41 | { 42 | eigen_internal_assert(v!=0); 43 | #ifdef EIGEN_HAS_OPENMP 44 | if(m_maxThreads>0) 45 | *v = m_maxThreads; 46 | else 47 | *v = omp_get_max_threads(); 48 | #else 49 | *v = 1; 50 | #endif 51 | } 52 | else 53 | { 54 | eigen_internal_assert(false); 55 | } 56 | } 57 | 58 | /** \returns the max number of threads reserved for Eigen 59 | * \sa setNbThreads */ 60 | inline int nbThreads() 61 | { 62 | int ret; 63 | manage_multi_threading(GetAction, &ret); 64 | return ret; 65 | } 66 | 67 | /** Sets the max number of threads reserved for Eigen 68 | * \sa nbThreads */ 69 | inline void setNbThreads(int v) 70 | { 71 | manage_multi_threading(SetAction, &v); 72 | } 73 | 74 | template struct GemmParallelInfo 75 | { 76 | GemmParallelInfo() : sync(-1), users(0), rhs_start(0), rhs_length(0) {} 77 | 78 | int volatile sync; 79 | int volatile users; 80 | 81 | Index rhs_start; 82 | Index rhs_length; 83 | }; 84 | 85 | template 86 | void parallelize_gemm(const Functor& func, Index rows, Index cols, bool transpose) 87 | { 88 | #ifndef EIGEN_HAS_OPENMP 89 | // FIXME the transpose variable is only needed to properly split 90 | // the matrix product when multithreading is enabled. This is a temporary 91 | // fix to support row-major destination matrices. This whole 92 | // parallelizer mechanism has to be redisigned anyway. 93 | EIGEN_UNUSED_VARIABLE(transpose); 94 | func(0,rows, 0,cols); 95 | #else 96 | 97 | // Dynamically check whether we should enable or disable OpenMP. 98 | // The conditions are: 99 | // - the max number of threads we can create is greater than 1 100 | // - we are not already in a parallel code 101 | // - the sizes are large enough 102 | 103 | // 1- are we already in a parallel session? 104 | // FIXME omp_get_num_threads()>1 only works for openmp, what if the user does not use openmp? 105 | if((!Condition) || (omp_get_num_threads()>1)) 106 | return func(0,rows, 0,cols); 107 | 108 | Index size = transpose ? cols : rows; 109 | 110 | // 2- compute the maximal number of threads from the size of the product: 111 | // FIXME this has to be fine tuned 112 | Index max_threads = std::max(1,size / 32); 113 | 114 | // 3 - compute the number of threads we are going to use 115 | Index threads = std::min(nbThreads(), max_threads); 116 | 117 | if(threads==1) 118 | return func(0,rows, 0,cols); 119 | 120 | func.initParallelSession(); 121 | 122 | if(transpose) 123 | std::swap(rows,cols); 124 | 125 | Index blockCols = (cols / threads) & ~Index(0x3); 126 | Index blockRows = (rows / threads) & ~Index(0x7); 127 | 128 | GemmParallelInfo* info = new GemmParallelInfo[threads]; 129 | 130 | #pragma omp parallel for schedule(static,1) num_threads(threads) 131 | for(Index i=0; i 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SELFADJOINTRANK2UPTADE_H 26 | #define EIGEN_SELFADJOINTRANK2UPTADE_H 27 | 28 | namespace internal { 29 | 30 | /* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu' 31 | * It corresponds to the Level2 syr2 BLAS routine 32 | */ 33 | 34 | template 35 | struct selfadjoint_rank2_update_selector; 36 | 37 | template 38 | struct selfadjoint_rank2_update_selector 39 | { 40 | static void run(Scalar* mat, Index stride, const UType& u, const VType& v, Scalar alpha) 41 | { 42 | const Index size = u.size(); 43 | for (Index i=0; i >(mat+stride*i+i, size-i) += 46 | (conj(alpha) * conj(u.coeff(i))) * v.tail(size-i) 47 | + (alpha * conj(v.coeff(i))) * u.tail(size-i); 48 | } 49 | } 50 | }; 51 | 52 | template 53 | struct selfadjoint_rank2_update_selector 54 | { 55 | static void run(Scalar* mat, Index stride, const UType& u, const VType& v, Scalar alpha) 56 | { 57 | const Index size = u.size(); 58 | for (Index i=0; i >(mat+stride*i, i+1) += 60 | (conj(alpha) * conj(u.coeff(i))) * v.head(i+1) 61 | + (alpha * conj(v.coeff(i))) * u.head(i+1); 62 | } 63 | }; 64 | 65 | template struct conj_expr_if 66 | : conditional::Scalar>,T> > {}; 68 | 69 | } // end namespace internal 70 | 71 | template 72 | template 73 | SelfAdjointView& SelfAdjointView 74 | ::rankUpdate(const MatrixBase& u, const MatrixBase& v, Scalar alpha) 75 | { 76 | typedef internal::blas_traits UBlasTraits; 77 | typedef typename UBlasTraits::DirectLinearAccessType ActualUType; 78 | typedef typename internal::remove_all::type _ActualUType; 79 | const ActualUType actualU = UBlasTraits::extract(u.derived()); 80 | 81 | typedef internal::blas_traits VBlasTraits; 82 | typedef typename VBlasTraits::DirectLinearAccessType ActualVType; 83 | typedef typename internal::remove_all::type _ActualVType; 84 | const ActualVType actualV = VBlasTraits::extract(v.derived()); 85 | 86 | // If MatrixType is row major, then we use the routine for lower triangular in the upper triangular case and 87 | // vice versa, and take the complex conjugate of all coefficients and vector entries. 88 | 89 | enum { IsRowMajor = (internal::traits::Flags&RowMajorBit) ? 1 : 0 }; 90 | Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived()) 91 | * internal::conj(VBlasTraits::extractScalarFactor(v.derived())); 92 | if (IsRowMajor) 93 | actualAlpha = internal::conj(actualAlpha); 94 | 95 | internal::selfadjoint_rank2_update_selector::type>::type, 97 | typename internal::remove_all::type>::type, 98 | (IsRowMajor ? int(UpLo==Upper ? Lower : Upper) : UpLo)> 99 | ::run(_expression().const_cast_derived().data(),_expression().outerStride(),actualU,actualV,actualAlpha); 100 | 101 | return *this; 102 | } 103 | 104 | #endif // EIGEN_SELFADJOINTRANK2UPTADE_H 105 | -------------------------------------------------------------------------------- /Eigen/src/Core/util/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Core_util_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Core_util_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core/util COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Core/util/DisableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN_WARNINGS_DISABLED 2 | #define EIGEN_WARNINGS_DISABLED 3 | 4 | #ifdef _MSC_VER 5 | // 4100 - unreferenced formal parameter (occurred e.g. in aligned_allocator::destroy(pointer p)) 6 | // 4101 - unreferenced local variable 7 | // 4127 - conditional expression is constant 8 | // 4181 - qualifier applied to reference type ignored 9 | // 4211 - nonstandard extension used : redefined extern to static 10 | // 4244 - 'argument' : conversion from 'type1' to 'type2', possible loss of data 11 | // 4273 - QtAlignedMalloc, inconsistent DLL linkage 12 | // 4324 - structure was padded due to declspec(align()) 13 | // 4512 - assignment operator could not be generated 14 | // 4522 - 'class' : multiple assignment operators specified 15 | // 4700 - uninitialized local variable 'xyz' used 16 | // 4717 - 'function' : recursive on all control paths, function will cause runtime stack overflow 17 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 18 | #pragma warning( push ) 19 | #endif 20 | #pragma warning( disable : 4100 4101 4127 4181 4211 4244 4273 4324 4512 4522 4700 4717 ) 21 | #elif defined __INTEL_COMPILER 22 | // 2196 - routine is both "inline" and "noinline" ("noinline" assumed) 23 | // ICC 12 generates this warning even without any inline keyword, when defining class methods 'inline' i.e. inside of class body 24 | // 2536 - type qualifiers are meaningless here 25 | // ICC 12 generates this warning when a function return type is const qualified, even if that type is a template-parameter-dependent 26 | // typedef that may be a reference type. 27 | // 279 - controlling expression is constant 28 | // ICC 12 generates this warning on assert(constant_expression_depending_on_template_params) and frankly this is a legitimate use case. 29 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 30 | #pragma warning push 31 | #endif 32 | #pragma warning disable 2196 2536 279 33 | #elif defined __clang__ 34 | // -Wconstant-logical-operand - warning: use of logical && with constant operand; switch to bitwise & or remove constant 35 | // this is really a stupid warning as it warns on compile-time expressions involving enums 36 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 37 | #pragma clang diagnostic push 38 | #endif 39 | #pragma clang diagnostic ignored "-Wconstant-logical-operand" 40 | #endif 41 | 42 | #endif // not EIGEN_WARNINGS_DISABLED 43 | -------------------------------------------------------------------------------- /Eigen/src/Core/util/ReenableStupidWarnings.h: -------------------------------------------------------------------------------- 1 | #ifdef EIGEN_WARNINGS_DISABLED 2 | #undef EIGEN_WARNINGS_DISABLED 3 | 4 | #ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS 5 | #ifdef _MSC_VER 6 | #pragma warning( pop ) 7 | #elif defined __INTEL_COMPILER 8 | #pragma warning pop 9 | #elif defined __clang__ 10 | #pragma clang diagnostic pop 11 | #endif 12 | #endif 13 | 14 | #endif // EIGEN_WARNINGS_DISABLED 15 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Block.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_BLOCK2_H 27 | #define EIGEN_BLOCK2_H 28 | 29 | /** \returns a dynamic-size expression of a corner of *this. 30 | * 31 | * \param type the type of corner. Can be \a Eigen::TopLeft, \a Eigen::TopRight, 32 | * \a Eigen::BottomLeft, \a Eigen::BottomRight. 33 | * \param cRows the number of rows in the corner 34 | * \param cCols the number of columns in the corner 35 | * 36 | * Example: \include MatrixBase_corner_enum_int_int.cpp 37 | * Output: \verbinclude MatrixBase_corner_enum_int_int.out 38 | * 39 | * \note Even though the returned expression has dynamic size, in the case 40 | * when it is applied to a fixed-size matrix, it inherits a fixed maximal size, 41 | * which means that evaluating it does not cause a dynamic memory allocation. 42 | * 43 | * \sa class Block, block(Index,Index,Index,Index) 44 | */ 45 | template 46 | inline Block DenseBase 47 | ::corner(CornerType type, Index cRows, Index cCols) 48 | { 49 | switch(type) 50 | { 51 | default: 52 | eigen_assert(false && "Bad corner type."); 53 | case TopLeft: 54 | return Block(derived(), 0, 0, cRows, cCols); 55 | case TopRight: 56 | return Block(derived(), 0, cols() - cCols, cRows, cCols); 57 | case BottomLeft: 58 | return Block(derived(), rows() - cRows, 0, cRows, cCols); 59 | case BottomRight: 60 | return Block(derived(), rows() - cRows, cols() - cCols, cRows, cCols); 61 | } 62 | } 63 | 64 | /** This is the const version of corner(CornerType, Index, Index).*/ 65 | template 66 | inline const Block 67 | DenseBase::corner(CornerType type, Index cRows, Index cCols) const 68 | { 69 | switch(type) 70 | { 71 | default: 72 | eigen_assert(false && "Bad corner type."); 73 | case TopLeft: 74 | return Block(derived(), 0, 0, cRows, cCols); 75 | case TopRight: 76 | return Block(derived(), 0, cols() - cCols, cRows, cCols); 77 | case BottomLeft: 78 | return Block(derived(), rows() - cRows, 0, cRows, cCols); 79 | case BottomRight: 80 | return Block(derived(), rows() - cRows, cols() - cCols, cRows, cCols); 81 | } 82 | } 83 | 84 | /** \returns a fixed-size expression of a corner of *this. 85 | * 86 | * \param type the type of corner. Can be \a Eigen::TopLeft, \a Eigen::TopRight, 87 | * \a Eigen::BottomLeft, \a Eigen::BottomRight. 88 | * 89 | * The template parameters CRows and CCols arethe number of rows and columns in the corner. 90 | * 91 | * Example: \include MatrixBase_template_int_int_corner_enum.cpp 92 | * Output: \verbinclude MatrixBase_template_int_int_corner_enum.out 93 | * 94 | * \sa class Block, block(Index,Index,Index,Index) 95 | */ 96 | template 97 | template 98 | inline Block 99 | DenseBase::corner(CornerType type) 100 | { 101 | switch(type) 102 | { 103 | default: 104 | eigen_assert(false && "Bad corner type."); 105 | case TopLeft: 106 | return Block(derived(), 0, 0); 107 | case TopRight: 108 | return Block(derived(), 0, cols() - CCols); 109 | case BottomLeft: 110 | return Block(derived(), rows() - CRows, 0); 111 | case BottomRight: 112 | return Block(derived(), rows() - CRows, cols() - CCols); 113 | } 114 | } 115 | 116 | /** This is the const version of corner(CornerType).*/ 117 | template 118 | template 119 | inline const Block 120 | DenseBase::corner(CornerType type) const 121 | { 122 | switch(type) 123 | { 124 | default: 125 | eigen_assert(false && "Bad corner type."); 126 | case TopLeft: 127 | return Block(derived(), 0, 0); 128 | case TopRight: 129 | return Block(derived(), 0, cols() - CCols); 130 | case BottomLeft: 131 | return Block(derived(), rows() - CRows, 0); 132 | case BottomRight: 133 | return Block(derived(), rows() - CRows, cols() - CCols); 134 | } 135 | } 136 | 137 | #endif // EIGEN_BLOCK2_H 138 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(Geometry) -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Geometry/All.h: -------------------------------------------------------------------------------- 1 | #ifndef EIGEN2_GEOMETRY_MODULE_H 2 | #define EIGEN2_GEOMETRY_MODULE_H 3 | 4 | #include 5 | 6 | #ifndef M_PI 7 | #define M_PI 3.14159265358979323846 8 | #endif 9 | 10 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 11 | #include "RotationBase.h" 12 | #include "Rotation2D.h" 13 | #include "Quaternion.h" 14 | #include "AngleAxis.h" 15 | #include "Transform.h" 16 | #include "Translation.h" 17 | #include "Scaling.h" 18 | #include "AlignedBox.h" 19 | #include "Hyperplane.h" 20 | #include "ParametrizedLine.h" 21 | #endif 22 | 23 | 24 | #define RotationBase eigen2_RotationBase 25 | #define Rotation2D eigen2_Rotation2D 26 | #define Rotation2Df eigen2_Rotation2Df 27 | #define Rotation2Dd eigen2_Rotation2Dd 28 | 29 | #define Quaternion eigen2_Quaternion 30 | #define Quaternionf eigen2_Quaternionf 31 | #define Quaterniond eigen2_Quaterniond 32 | 33 | #define AngleAxis eigen2_AngleAxis 34 | #define AngleAxisf eigen2_AngleAxisf 35 | #define AngleAxisd eigen2_AngleAxisd 36 | 37 | #define Transform eigen2_Transform 38 | #define Transform2f eigen2_Transform2f 39 | #define Transform2d eigen2_Transform2d 40 | #define Transform3f eigen2_Transform3f 41 | #define Transform3d eigen2_Transform3d 42 | 43 | #define Translation eigen2_Translation 44 | #define Translation2f eigen2_Translation2f 45 | #define Translation2d eigen2_Translation2d 46 | #define Translation3f eigen2_Translation3f 47 | #define Translation3d eigen2_Translation3d 48 | 49 | #define Scaling eigen2_Scaling 50 | #define Scaling2f eigen2_Scaling2f 51 | #define Scaling2d eigen2_Scaling2d 52 | #define Scaling3f eigen2_Scaling3f 53 | #define Scaling3d eigen2_Scaling3d 54 | 55 | #define AlignedBox eigen2_AlignedBox 56 | 57 | #define Hyperplane eigen2_Hyperplane 58 | #define ParametrizedLine eigen2_ParametrizedLine 59 | 60 | #define ei_toRotationMatrix eigen2_ei_toRotationMatrix 61 | #define ei_quaternion_assign_impl eigen2_ei_quaternion_assign_impl 62 | #define ei_transform_product_impl eigen2_ei_transform_product_impl 63 | 64 | #include "RotationBase.h" 65 | #include "Rotation2D.h" 66 | #include "Quaternion.h" 67 | #include "AngleAxis.h" 68 | #include "Transform.h" 69 | #include "Translation.h" 70 | #include "Scaling.h" 71 | #include "AlignedBox.h" 72 | #include "Hyperplane.h" 73 | #include "ParametrizedLine.h" 74 | 75 | #undef ei_toRotationMatrix 76 | #undef ei_quaternion_assign_impl 77 | #undef ei_transform_product_impl 78 | 79 | #undef RotationBase 80 | #undef Rotation2D 81 | #undef Rotation2Df 82 | #undef Rotation2Dd 83 | 84 | #undef Quaternion 85 | #undef Quaternionf 86 | #undef Quaterniond 87 | 88 | #undef AngleAxis 89 | #undef AngleAxisf 90 | #undef AngleAxisd 91 | 92 | #undef Transform 93 | #undef Transform2f 94 | #undef Transform2d 95 | #undef Transform3f 96 | #undef Transform3d 97 | 98 | #undef Translation 99 | #undef Translation2f 100 | #undef Translation2d 101 | #undef Translation3f 102 | #undef Translation3d 103 | 104 | #undef Scaling 105 | #undef Scaling2f 106 | #undef Scaling2d 107 | #undef Scaling3f 108 | #undef Scaling3d 109 | 110 | #undef AlignedBox 111 | 112 | #undef Hyperplane 113 | #undef ParametrizedLine 114 | 115 | #endif // EIGEN2_GEOMETRY_MODULE_H -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Eigen2Support_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Eigen2Support_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigen2Support/Geometry 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Geometry/RotationBase.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. Eigen itself is part of the KDE project. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | // no include guard, we'll include this twice from All.h from Eigen2Support, and it's internal anyway 26 | 27 | // this file aims to contains the various representations of rotation/orientation 28 | // in 2D and 3D space excepted Matrix and Quaternion. 29 | 30 | /** \class RotationBase 31 | * 32 | * \brief Common base class for compact rotation representations 33 | * 34 | * \param Derived is the derived type, i.e., a rotation type 35 | * \param _Dim the dimension of the space 36 | */ 37 | template 38 | class RotationBase 39 | { 40 | public: 41 | enum { Dim = _Dim }; 42 | /** the scalar type of the coefficients */ 43 | typedef typename ei_traits::Scalar Scalar; 44 | 45 | /** corresponding linear transformation matrix type */ 46 | typedef Matrix RotationMatrixType; 47 | 48 | inline const Derived& derived() const { return *static_cast(this); } 49 | inline Derived& derived() { return *static_cast(this); } 50 | 51 | /** \returns an equivalent rotation matrix */ 52 | inline RotationMatrixType toRotationMatrix() const { return derived().toRotationMatrix(); } 53 | 54 | /** \returns the inverse rotation */ 55 | inline Derived inverse() const { return derived().inverse(); } 56 | 57 | /** \returns the concatenation of the rotation \c *this with a translation \a t */ 58 | inline Transform operator*(const Translation& t) const 59 | { return toRotationMatrix() * t; } 60 | 61 | /** \returns the concatenation of the rotation \c *this with a scaling \a s */ 62 | inline RotationMatrixType operator*(const Scaling& s) const 63 | { return toRotationMatrix() * s; } 64 | 65 | /** \returns the concatenation of the rotation \c *this with an affine transformation \a t */ 66 | inline Transform operator*(const Transform& t) const 67 | { return toRotationMatrix() * t; } 68 | }; 69 | 70 | /** \geometry_module 71 | * 72 | * Constructs a Dim x Dim rotation matrix from the rotation \a r 73 | */ 74 | template 75 | template 76 | Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols> 77 | ::Matrix(const RotationBase& r) 78 | { 79 | EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim)) 80 | *this = r.toRotationMatrix(); 81 | } 82 | 83 | /** \geometry_module 84 | * 85 | * Set a Dim x Dim rotation matrix from the rotation \a r 86 | */ 87 | template 88 | template 89 | Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols>& 90 | Matrix<_Scalar, _Rows, _Cols, _Storage, _MaxRows, _MaxCols> 91 | ::operator=(const RotationBase& r) 92 | { 93 | EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Matrix,int(OtherDerived::Dim),int(OtherDerived::Dim)) 94 | return *this = r.toRotationMatrix(); 95 | } 96 | 97 | /** \internal 98 | * 99 | * Helper function to return an arbitrary rotation object to a rotation matrix. 100 | * 101 | * \param Scalar the numeric type of the matrix coefficients 102 | * \param Dim the dimension of the current space 103 | * 104 | * It returns a Dim x Dim fixed size matrix. 105 | * 106 | * Default specializations are provided for: 107 | * - any scalar type (2D), 108 | * - any matrix expression, 109 | * - any type based on RotationBase (e.g., Quaternion, AngleAxis, Rotation2D) 110 | * 111 | * Currently ei_toRotationMatrix is only used by Transform. 112 | * 113 | * \sa class Transform, class Rotation2D, class Quaternion, class AngleAxis 114 | */ 115 | template 116 | inline static Matrix ei_toRotationMatrix(const Scalar& s) 117 | { 118 | EIGEN_STATIC_ASSERT(Dim==2,YOU_MADE_A_PROGRAMMING_MISTAKE) 119 | return Rotation2D(s).toRotationMatrix(); 120 | } 121 | 122 | template 123 | inline static Matrix ei_toRotationMatrix(const RotationBase& r) 124 | { 125 | return r.toRotationMatrix(); 126 | } 127 | 128 | template 129 | inline static const MatrixBase& ei_toRotationMatrix(const MatrixBase& mat) 130 | { 131 | EIGEN_STATIC_ASSERT(OtherDerived::RowsAtCompileTime==Dim && OtherDerived::ColsAtCompileTime==Dim, 132 | YOU_MADE_A_PROGRAMMING_MISTAKE) 133 | return mat; 134 | } 135 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/LU.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_LU_H 26 | #define EIGEN2_LU_H 27 | 28 | template 29 | class LU : public FullPivLU 30 | { 31 | public: 32 | 33 | typedef typename MatrixType::Scalar Scalar; 34 | typedef typename NumTraits::Real RealScalar; 35 | typedef Matrix IntRowVectorType; 36 | typedef Matrix IntColVectorType; 37 | typedef Matrix RowVectorType; 38 | typedef Matrix ColVectorType; 39 | 40 | typedef Matrix KernelResultType; 49 | 50 | typedef Matrix ImageResultType; 58 | 59 | typedef FullPivLU Base; 60 | LU() : Base() {} 61 | 62 | template 63 | explicit LU(const T& t) : Base(t), m_originalMatrix(t) {} 64 | 65 | template 66 | bool solve(const MatrixBase& b, ResultType *result) const 67 | { 68 | *result = static_cast(this)->solve(b); 69 | return true; 70 | } 71 | 72 | template 73 | inline void computeInverse(ResultType *result) const 74 | { 75 | solve(MatrixType::Identity(this->rows(), this->cols()), result); 76 | } 77 | 78 | template 79 | void computeKernel(KernelMatrixType *result) const 80 | { 81 | *result = static_cast(this)->kernel(); 82 | } 83 | 84 | template 85 | void computeImage(ImageMatrixType *result) const 86 | { 87 | *result = static_cast(this)->image(m_originalMatrix); 88 | } 89 | 90 | const ImageResultType image() const 91 | { 92 | return static_cast(this)->image(m_originalMatrix); 93 | } 94 | 95 | const MatrixType& m_originalMatrix; 96 | }; 97 | 98 | #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 99 | /** \lu_module 100 | * 101 | * Synonym of partialPivLu(). 102 | * 103 | * \return the partial-pivoting LU decomposition of \c *this. 104 | * 105 | * \sa class PartialPivLU 106 | */ 107 | template 108 | inline const LU::PlainObject> 109 | MatrixBase::lu() const 110 | { 111 | return LU(eval()); 112 | } 113 | #endif 114 | 115 | #ifdef EIGEN2_SUPPORT 116 | /** \lu_module 117 | * 118 | * Synonym of partialPivLu(). 119 | * 120 | * \return the partial-pivoting LU decomposition of \c *this. 121 | * 122 | * \sa class PartialPivLU 123 | */ 124 | template 125 | inline const LU::PlainObject> 126 | MatrixBase::eigen2_lu() const 127 | { 128 | return LU(eval()); 129 | } 130 | #endif 131 | 132 | 133 | #endif // EIGEN2_LU_H 134 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Lazy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_LAZY_H 26 | #define EIGEN_LAZY_H 27 | 28 | /** \deprecated it is only used by lazy() which is deprecated 29 | * 30 | * \returns an expression of *this with added flags 31 | * 32 | * Example: \include MatrixBase_marked.cpp 33 | * Output: \verbinclude MatrixBase_marked.out 34 | * 35 | * \sa class Flagged, extract(), part() 36 | */ 37 | template 38 | template 39 | inline const Flagged 40 | MatrixBase::marked() const 41 | { 42 | return derived(); 43 | } 44 | 45 | /** \deprecated use MatrixBase::noalias() 46 | * 47 | * \returns an expression of *this with the EvalBeforeAssigningBit flag removed. 48 | * 49 | * Example: \include MatrixBase_lazy.cpp 50 | * Output: \verbinclude MatrixBase_lazy.out 51 | * 52 | * \sa class Flagged, marked() 53 | */ 54 | template 55 | inline const Flagged 56 | MatrixBase::lazy() const 57 | { 58 | return derived(); 59 | } 60 | 61 | 62 | /** \internal 63 | * Overloaded to perform an efficient C += (A*B).lazy() */ 64 | template 65 | template 66 | Derived& MatrixBase::operator+=(const Flagged, 0, 67 | EvalBeforeAssigningBit>& other) 68 | { 69 | other._expression().derived().addTo(derived()); return derived(); 70 | } 71 | 72 | /** \internal 73 | * Overloaded to perform an efficient C -= (A*B).lazy() */ 74 | template 75 | template 76 | Derived& MatrixBase::operator-=(const Flagged, 0, 77 | EvalBeforeAssigningBit>& other) 78 | { 79 | other._expression().derived().subTo(derived()); return derived(); 80 | } 81 | 82 | #endif // EIGEN_LAZY_H 83 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Macros.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MACROS_H 26 | #define EIGEN2_MACROS_H 27 | 28 | #define ei_assert eigen_assert 29 | #define ei_internal_assert eigen_internal_assert 30 | 31 | #define EIGEN_ALIGN_128 EIGEN_ALIGN16 32 | 33 | #define EIGEN_ARCH_WANTS_ALIGNMENT EIGEN_ALIGN_STATICALLY 34 | 35 | #endif // EIGEN2_MACROS_H 36 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/MathFunctions.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MATH_FUNCTIONS_H 26 | #define EIGEN2_MATH_FUNCTIONS_H 27 | 28 | template inline typename NumTraits::Real ei_real(const T& x) { return internal::real(x); } 29 | template inline typename NumTraits::Real ei_imag(const T& x) { return internal::imag(x); } 30 | template inline T ei_conj(const T& x) { return internal::conj(x); } 31 | template inline typename NumTraits::Real ei_abs (const T& x) { return internal::abs(x); } 32 | template inline typename NumTraits::Real ei_abs2(const T& x) { return internal::abs2(x); } 33 | template inline T ei_sqrt(const T& x) { return internal::sqrt(x); } 34 | template inline T ei_exp (const T& x) { return internal::exp(x); } 35 | template inline T ei_log (const T& x) { return internal::log(x); } 36 | template inline T ei_sin (const T& x) { return internal::sin(x); } 37 | template inline T ei_cos (const T& x) { return internal::cos(x); } 38 | template inline T ei_atan2(const T& x,const T& y) { return internal::atan2(x,y); } 39 | template inline T ei_pow (const T& x,const T& y) { return internal::pow(x,y); } 40 | template inline T ei_random () { return internal::random(); } 41 | template inline T ei_random (const T& x, const T& y) { return internal::random(x, y); } 42 | 43 | template inline T precision () { return NumTraits::dummy_precision(); } 44 | template inline T machine_epsilon () { return NumTraits::epsilon(); } 45 | 46 | 47 | template 48 | inline bool ei_isMuchSmallerThan(const Scalar& x, const OtherScalar& y, 49 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 50 | { 51 | return internal::isMuchSmallerThan(x, y, precision); 52 | } 53 | 54 | template 55 | inline bool ei_isApprox(const Scalar& x, const Scalar& y, 56 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 57 | { 58 | return internal::isApprox(x, y, precision); 59 | } 60 | 61 | template 62 | inline bool ei_isApproxOrLessThan(const Scalar& x, const Scalar& y, 63 | typename NumTraits::Real precision = NumTraits::dummy_precision()) 64 | { 65 | return internal::isApproxOrLessThan(x, y, precision); 66 | } 67 | 68 | #endif // EIGEN2_MATH_FUNCTIONS_H 69 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Memory.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_MEMORY_H 26 | #define EIGEN2_MEMORY_H 27 | 28 | inline void* ei_aligned_malloc(size_t size) { return internal::aligned_malloc(size); } 29 | inline void ei_aligned_free(void *ptr) { internal::aligned_free(ptr); } 30 | inline void* ei_aligned_realloc(void *ptr, size_t new_size, size_t old_size) { return internal::aligned_realloc(ptr, new_size, old_size); } 31 | inline void* ei_handmade_aligned_malloc(size_t size) { return internal::handmade_aligned_malloc(size); } 32 | inline void ei_handmade_aligned_free(void *ptr) { internal::handmade_aligned_free(ptr); } 33 | 34 | template inline void* ei_conditional_aligned_malloc(size_t size) 35 | { 36 | return internal::conditional_aligned_malloc(size); 37 | } 38 | template inline void ei_conditional_aligned_free(void *ptr) 39 | { 40 | internal::conditional_aligned_free(ptr); 41 | } 42 | template inline void* ei_conditional_aligned_realloc(void* ptr, size_t new_size, size_t old_size) 43 | { 44 | return internal::conditional_aligned_realloc(ptr, new_size, old_size); 45 | } 46 | 47 | template inline T* ei_aligned_new(size_t size) 48 | { 49 | return internal::aligned_new(size); 50 | } 51 | template inline void ei_aligned_delete(T *ptr, size_t size) 52 | { 53 | return internal::aligned_delete(ptr, size); 54 | } 55 | 56 | 57 | 58 | #endif // EIGEN2_MACROS_H 59 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Meta.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2011 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN2_META_H 26 | #define EIGEN2_META_H 27 | 28 | template 29 | struct ei_traits : internal::traits 30 | {}; 31 | 32 | struct ei_meta_true { enum { ret = 1 }; }; 33 | struct ei_meta_false { enum { ret = 0 }; }; 34 | 35 | template 36 | struct ei_meta_if { typedef Then ret; }; 37 | 38 | template 39 | struct ei_meta_if { typedef Else ret; }; 40 | 41 | template struct ei_is_same_type { enum { ret = 0 }; }; 42 | template struct ei_is_same_type { enum { ret = 1 }; }; 43 | 44 | template struct ei_unref { typedef T type; }; 45 | template struct ei_unref { typedef T type; }; 46 | 47 | template struct ei_unpointer { typedef T type; }; 48 | template struct ei_unpointer { typedef T type; }; 49 | template struct ei_unpointer { typedef T type; }; 50 | 51 | template struct ei_unconst { typedef T type; }; 52 | template struct ei_unconst { typedef T type; }; 53 | template struct ei_unconst { typedef T & type; }; 54 | template struct ei_unconst { typedef T * type; }; 55 | 56 | template struct ei_cleantype { typedef T type; }; 57 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 58 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 59 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 60 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 61 | template struct ei_cleantype { typedef typename ei_cleantype::type type; }; 62 | 63 | /** \internal In short, it computes int(sqrt(\a Y)) with \a Y an integer. 64 | * Usage example: \code ei_meta_sqrt<1023>::ret \endcode 65 | */ 66 | template Y))) > 70 | // use ?: instead of || just to shut up a stupid gcc 4.3 warning 71 | class ei_meta_sqrt 72 | { 73 | enum { 74 | MidX = (InfX+SupX)/2, 75 | TakeInf = MidX*MidX > Y ? 1 : 0, 76 | NewInf = int(TakeInf) ? InfX : int(MidX), 77 | NewSup = int(TakeInf) ? int(MidX) : SupX 78 | }; 79 | public: 80 | enum { ret = ei_meta_sqrt::ret }; 81 | }; 82 | 83 | template 84 | class ei_meta_sqrt { public: enum { ret = (SupX*SupX <= Y) ? SupX : InfX }; }; 85 | 86 | #endif // EIGEN2_META_H 87 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/Minor.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2006-2009 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_MINOR_H 26 | #define EIGEN_MINOR_H 27 | 28 | /** 29 | * \class Minor 30 | * 31 | * \brief Expression of a minor 32 | * 33 | * \param MatrixType the type of the object in which we are taking a minor 34 | * 35 | * This class represents an expression of a minor. It is the return 36 | * type of MatrixBase::minor() and most of the time this is the only way it 37 | * is used. 38 | * 39 | * \sa MatrixBase::minor() 40 | */ 41 | 42 | namespace internal { 43 | template 44 | struct traits > 45 | : traits 46 | { 47 | typedef typename nested::type MatrixTypeNested; 48 | typedef typename remove_reference::type _MatrixTypeNested; 49 | typedef typename MatrixType::StorageKind StorageKind; 50 | enum { 51 | RowsAtCompileTime = (MatrixType::RowsAtCompileTime != Dynamic) ? 52 | int(MatrixType::RowsAtCompileTime) - 1 : Dynamic, 53 | ColsAtCompileTime = (MatrixType::ColsAtCompileTime != Dynamic) ? 54 | int(MatrixType::ColsAtCompileTime) - 1 : Dynamic, 55 | MaxRowsAtCompileTime = (MatrixType::MaxRowsAtCompileTime != Dynamic) ? 56 | int(MatrixType::MaxRowsAtCompileTime) - 1 : Dynamic, 57 | MaxColsAtCompileTime = (MatrixType::MaxColsAtCompileTime != Dynamic) ? 58 | int(MatrixType::MaxColsAtCompileTime) - 1 : Dynamic, 59 | Flags = _MatrixTypeNested::Flags & (HereditaryBits | LvalueBit), 60 | CoeffReadCost = _MatrixTypeNested::CoeffReadCost // minor is used typically on tiny matrices, 61 | // where loops are unrolled and the 'if' evaluates at compile time 62 | }; 63 | }; 64 | } 65 | 66 | template class Minor 67 | : public MatrixBase > 68 | { 69 | public: 70 | 71 | typedef MatrixBase Base; 72 | EIGEN_DENSE_PUBLIC_INTERFACE(Minor) 73 | 74 | inline Minor(const MatrixType& matrix, 75 | Index row, Index col) 76 | : m_matrix(matrix), m_row(row), m_col(col) 77 | { 78 | eigen_assert(row >= 0 && row < matrix.rows() 79 | && col >= 0 && col < matrix.cols()); 80 | } 81 | 82 | EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor) 83 | 84 | inline Index rows() const { return m_matrix.rows() - 1; } 85 | inline Index cols() const { return m_matrix.cols() - 1; } 86 | 87 | inline Scalar& coeffRef(Index row, Index col) 88 | { 89 | return m_matrix.const_cast_derived().coeffRef(row + (row >= m_row), col + (col >= m_col)); 90 | } 91 | 92 | inline const Scalar coeff(Index row, Index col) const 93 | { 94 | return m_matrix.coeff(row + (row >= m_row), col + (col >= m_col)); 95 | } 96 | 97 | protected: 98 | const typename MatrixType::Nested m_matrix; 99 | const Index m_row, m_col; 100 | }; 101 | 102 | /** 103 | * \return an expression of the (\a row, \a col)-minor of *this, 104 | * i.e. an expression constructed from *this by removing the specified 105 | * row and column. 106 | * 107 | * Example: \include MatrixBase_minor.cpp 108 | * Output: \verbinclude MatrixBase_minor.out 109 | * 110 | * \sa class Minor 111 | */ 112 | template 113 | inline Minor 114 | MatrixBase::minor(Index row, Index col) 115 | { 116 | return Minor(derived(), row, col); 117 | } 118 | 119 | /** 120 | * This is the const version of minor(). */ 121 | template 122 | inline const Minor 123 | MatrixBase::minor(Index row, Index col) const 124 | { 125 | return Minor(derived(), row, col); 126 | } 127 | 128 | #endif // EIGEN_MINOR_H 129 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/QR.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // Copyright (C) 2011 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN2_QR_H 27 | #define EIGEN2_QR_H 28 | 29 | template 30 | class QR : public HouseholderQR 31 | { 32 | public: 33 | 34 | typedef HouseholderQR Base; 35 | typedef Block MatrixRBlockType; 36 | 37 | QR() : Base() {} 38 | 39 | template 40 | explicit QR(const T& t) : Base(t) {} 41 | 42 | template 43 | bool solve(const MatrixBase& b, ResultType *result) const 44 | { 45 | *result = static_cast(this)->solve(b); 46 | return true; 47 | } 48 | 49 | MatrixType matrixQ(void) const { 50 | MatrixType ret = MatrixType::Identity(this->rows(), this->cols()); 51 | ret = this->householderQ() * ret; 52 | return ret; 53 | } 54 | 55 | bool isFullRank() const { 56 | return true; 57 | } 58 | 59 | const TriangularView 60 | matrixR(void) const 61 | { 62 | int cols = this->cols(); 63 | return MatrixRBlockType(this->matrixQR(), 0, 0, cols, cols).template triangularView(); 64 | } 65 | }; 66 | 67 | /** \return the QR decomposition of \c *this. 68 | * 69 | * \sa class QR 70 | */ 71 | template 72 | const QR::PlainObject> 73 | MatrixBase::qr() const 74 | { 75 | return QR(eval()); 76 | } 77 | 78 | 79 | #endif // EIGEN2_QR_H 80 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/TriangularSolver.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_TRIANGULAR_SOLVER2_H 26 | #define EIGEN_TRIANGULAR_SOLVER2_H 27 | 28 | const unsigned int UnitDiagBit = UnitDiag; 29 | const unsigned int SelfAdjointBit = SelfAdjoint; 30 | const unsigned int UpperTriangularBit = Upper; 31 | const unsigned int LowerTriangularBit = Lower; 32 | 33 | const unsigned int UpperTriangular = Upper; 34 | const unsigned int LowerTriangular = Lower; 35 | const unsigned int UnitUpperTriangular = UnitUpper; 36 | const unsigned int UnitLowerTriangular = UnitLower; 37 | 38 | template 39 | template 40 | typename ExpressionType::PlainObject 41 | Flagged::solveTriangular(const MatrixBase& other) const 42 | { 43 | return m_matrix.template triangularView().solve(other.derived()); 44 | } 45 | 46 | template 47 | template 48 | void Flagged::solveTriangularInPlace(const MatrixBase& other) const 49 | { 50 | m_matrix.template triangularView().solveInPlace(other.derived()); 51 | } 52 | 53 | #endif // EIGEN_TRIANGULAR_SOLVER2_H 54 | -------------------------------------------------------------------------------- /Eigen/src/Eigen2Support/VectorBlock.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN2_VECTORBLOCK_H 27 | #define EIGEN2_VECTORBLOCK_H 28 | 29 | /** \deprecated use DenseMase::head(Index) */ 30 | template 31 | inline VectorBlock 32 | MatrixBase::start(Index size) 33 | { 34 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 35 | return VectorBlock(derived(), 0, size); 36 | } 37 | 38 | /** \deprecated use DenseMase::head(Index) */ 39 | template 40 | inline const VectorBlock 41 | MatrixBase::start(Index size) const 42 | { 43 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 44 | return VectorBlock(derived(), 0, size); 45 | } 46 | 47 | /** \deprecated use DenseMase::tail(Index) */ 48 | template 49 | inline VectorBlock 50 | MatrixBase::end(Index size) 51 | { 52 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 53 | return VectorBlock(derived(), this->size() - size, size); 54 | } 55 | 56 | /** \deprecated use DenseMase::tail(Index) */ 57 | template 58 | inline const VectorBlock 59 | MatrixBase::end(Index size) const 60 | { 61 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 62 | return VectorBlock(derived(), this->size() - size, size); 63 | } 64 | 65 | /** \deprecated use DenseMase::head() */ 66 | template 67 | template 68 | inline VectorBlock 69 | MatrixBase::start() 70 | { 71 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 72 | return VectorBlock(derived(), 0); 73 | } 74 | 75 | /** \deprecated use DenseMase::head() */ 76 | template 77 | template 78 | inline const VectorBlock 79 | MatrixBase::start() const 80 | { 81 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 82 | return VectorBlock(derived(), 0); 83 | } 84 | 85 | /** \deprecated use DenseMase::tail() */ 86 | template 87 | template 88 | inline VectorBlock 89 | MatrixBase::end() 90 | { 91 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 92 | return VectorBlock(derived(), size() - Size); 93 | } 94 | 95 | /** \deprecated use DenseMase::tail() */ 96 | template 97 | template 98 | inline const VectorBlock 99 | MatrixBase::end() const 100 | { 101 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 102 | return VectorBlock(derived(), size() - Size); 103 | } 104 | 105 | #endif // EIGEN2_VECTORBLOCK_H 106 | -------------------------------------------------------------------------------- /Eigen/src/Eigenvalues/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_EIGENVALUES_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_EIGENVALUES_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Eigenvalues COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Eigenvalues/EigenvaluesCommon.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Jitse Niesen 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_EIGENVALUES_COMMON_H 26 | #define EIGEN_EIGENVALUES_COMMON_H 27 | 28 | 29 | 30 | #endif // EIGEN_EIGENVALUES_COMMON_H 31 | 32 | -------------------------------------------------------------------------------- /Eigen/src/Geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /Eigen/src/Geometry/EulerAngles.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_EULERANGLES_H 26 | #define EIGEN_EULERANGLES_H 27 | 28 | /** \geometry_module \ingroup Geometry_Module 29 | * 30 | * 31 | * \returns the Euler-angles of the rotation matrix \c *this using the convention defined by the triplet (\a a0,\a a1,\a a2) 32 | * 33 | * Each of the three parameters \a a0,\a a1,\a a2 represents the respective rotation axis as an integer in {0,1,2}. 34 | * For instance, in: 35 | * \code Vector3f ea = mat.eulerAngles(2, 0, 2); \endcode 36 | * "2" represents the z axis and "0" the x axis, etc. The returned angles are such that 37 | * we have the following equality: 38 | * \code 39 | * mat == AngleAxisf(ea[0], Vector3f::UnitZ()) 40 | * * AngleAxisf(ea[1], Vector3f::UnitX()) 41 | * * AngleAxisf(ea[2], Vector3f::UnitZ()); \endcode 42 | * This corresponds to the right-multiply conventions (with right hand side frames). 43 | */ 44 | template 45 | inline Matrix::Scalar,3,1> 46 | MatrixBase::eulerAngles(Index a0, Index a1, Index a2) const 47 | { 48 | /* Implemented from Graphics Gems IV */ 49 | EIGEN_STATIC_ASSERT_MATRIX_SPECIFIC_SIZE(Derived,3,3) 50 | 51 | Matrix res; 52 | typedef Matrix Vector2; 53 | const Scalar epsilon = NumTraits::dummy_precision(); 54 | 55 | const Index odd = ((a0+1)%3 == a1) ? 0 : 1; 56 | const Index i = a0; 57 | const Index j = (a0 + 1 + odd)%3; 58 | const Index k = (a0 + 2 - odd)%3; 59 | 60 | if (a0==a2) 61 | { 62 | Scalar s = Vector2(coeff(j,i) , coeff(k,i)).norm(); 63 | res[1] = internal::atan2(s, coeff(i,i)); 64 | if (s > epsilon) 65 | { 66 | res[0] = internal::atan2(coeff(j,i), coeff(k,i)); 67 | res[2] = internal::atan2(coeff(i,j),-coeff(i,k)); 68 | } 69 | else 70 | { 71 | res[0] = Scalar(0); 72 | res[2] = (coeff(i,i)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j)); 73 | } 74 | } 75 | else 76 | { 77 | Scalar c = Vector2(coeff(i,i) , coeff(i,j)).norm(); 78 | res[1] = internal::atan2(-coeff(i,k), c); 79 | if (c > epsilon) 80 | { 81 | res[0] = internal::atan2(coeff(j,k), coeff(k,k)); 82 | res[2] = internal::atan2(coeff(i,j), coeff(i,i)); 83 | } 84 | else 85 | { 86 | res[0] = Scalar(0); 87 | res[2] = (coeff(i,k)>0?1:-1)*internal::atan2(-coeff(k,j), coeff(j,j)); 88 | } 89 | } 90 | if (!odd) 91 | res = -res; 92 | return res; 93 | } 94 | 95 | 96 | #endif // EIGEN_EULERANGLES_H 97 | -------------------------------------------------------------------------------- /Eigen/src/Geometry/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Geometry_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Geometry_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Geometry/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Geometry/arch/Geometry_SSE.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Rohit Garg 5 | // Copyright (C) 2009-2010 Gael Guennebaud 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_GEOMETRY_SSE_H 27 | #define EIGEN_GEOMETRY_SSE_H 28 | 29 | namespace internal { 30 | 31 | template 32 | struct quat_product 33 | { 34 | inline static Quaternion run(const QuaternionBase& _a, const QuaternionBase& _b) 35 | { 36 | const __m128 mask = _mm_castsi128_ps(_mm_setr_epi32(0,0,0,0x80000000)); 37 | Quaternion res; 38 | __m128 a = _a.coeffs().template packet(0); 39 | __m128 b = _b.coeffs().template packet(0); 40 | __m128 flip1 = _mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a,1,2,0,2), 41 | vec4f_swizzle1(b,2,0,1,2)),mask); 42 | __m128 flip2 = _mm_xor_ps(_mm_mul_ps(vec4f_swizzle1(a,3,3,3,1), 43 | vec4f_swizzle1(b,0,1,2,1)),mask); 44 | pstore(&res.x(), 45 | _mm_add_ps(_mm_sub_ps(_mm_mul_ps(a,vec4f_swizzle1(b,3,3,3,3)), 46 | _mm_mul_ps(vec4f_swizzle1(a,2,0,1,0), 47 | vec4f_swizzle1(b,1,2,0,0))), 48 | _mm_add_ps(flip1,flip2))); 49 | return res; 50 | } 51 | }; 52 | 53 | template 54 | struct cross3_impl 55 | { 56 | inline static typename plain_matrix_type::type 57 | run(const VectorLhs& lhs, const VectorRhs& rhs) 58 | { 59 | __m128 a = lhs.template packet(0); 60 | __m128 b = rhs.template packet(0); 61 | __m128 mul1=_mm_mul_ps(vec4f_swizzle1(a,1,2,0,3),vec4f_swizzle1(b,2,0,1,3)); 62 | __m128 mul2=_mm_mul_ps(vec4f_swizzle1(a,2,0,1,3),vec4f_swizzle1(b,1,2,0,3)); 63 | typename plain_matrix_type::type res; 64 | pstore(&res.x(),_mm_sub_ps(mul1,mul2)); 65 | return res; 66 | } 67 | }; 68 | 69 | 70 | 71 | 72 | template 73 | struct quat_product 74 | { 75 | inline static Quaternion run(const QuaternionBase& _a, const QuaternionBase& _b) 76 | { 77 | const Packet2d mask = _mm_castsi128_pd(_mm_set_epi32(0x0,0x0,0x80000000,0x0)); 78 | 79 | Quaternion res; 80 | 81 | const double* a = _a.coeffs().data(); 82 | Packet2d b_xy = _b.coeffs().template packet(0); 83 | Packet2d b_zw = _b.coeffs().template packet(2); 84 | Packet2d a_xx = pset1(a[0]); 85 | Packet2d a_yy = pset1(a[1]); 86 | Packet2d a_zz = pset1(a[2]); 87 | Packet2d a_ww = pset1(a[3]); 88 | 89 | // two temporaries: 90 | Packet2d t1, t2; 91 | 92 | /* 93 | * t1 = ww*xy + yy*zw 94 | * t2 = zz*xy - xx*zw 95 | * res.xy = t1 +/- swap(t2) 96 | */ 97 | t1 = padd(pmul(a_ww, b_xy), pmul(a_yy, b_zw)); 98 | t2 = psub(pmul(a_zz, b_xy), pmul(a_xx, b_zw)); 99 | #ifdef EIGEN_VECTORIZE_SSE3 100 | EIGEN_UNUSED_VARIABLE(mask) 101 | pstore(&res.x(), _mm_addsub_pd(t1, preverse(t2))); 102 | #else 103 | pstore(&res.x(), padd(t1, pxor(mask,preverse(t2)))); 104 | #endif 105 | 106 | /* 107 | * t1 = ww*zw - yy*xy 108 | * t2 = zz*zw + xx*xy 109 | * res.zw = t1 -/+ swap(t2) = swap( swap(t1) +/- t2) 110 | */ 111 | t1 = psub(pmul(a_ww, b_zw), pmul(a_yy, b_xy)); 112 | t2 = padd(pmul(a_zz, b_zw), pmul(a_xx, b_xy)); 113 | #ifdef EIGEN_VECTORIZE_SSE3 114 | EIGEN_UNUSED_VARIABLE(mask) 115 | pstore(&res.z(), preverse(_mm_addsub_pd(preverse(t1), t2))); 116 | #else 117 | pstore(&res.z(), psub(t1, pxor(mask,preverse(t2)))); 118 | #endif 119 | 120 | return res; 121 | } 122 | }; 123 | 124 | } // end namespace internal 125 | 126 | #endif // EIGEN_GEOMETRY_SSE_H 127 | -------------------------------------------------------------------------------- /Eigen/src/Householder/BlockHouseholder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Vincent Lejeune 5 | // Copyright (C) 2010 Gael Guennebaud 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_BLOCK_HOUSEHOLDER_H 27 | #define EIGEN_BLOCK_HOUSEHOLDER_H 28 | 29 | // This file contains some helper function to deal with block householder reflectors 30 | 31 | namespace internal { 32 | 33 | /** \internal */ 34 | template 35 | void make_block_householder_triangular_factor(TriangularFactorType& triFactor, const VectorsType& vectors, const CoeffsType& hCoeffs) 36 | { 37 | typedef typename TriangularFactorType::Index Index; 38 | typedef typename VectorsType::Scalar Scalar; 39 | const Index nbVecs = vectors.cols(); 40 | eigen_assert(triFactor.rows() == nbVecs && triFactor.cols() == nbVecs && vectors.rows()>=nbVecs); 41 | 42 | for(Index i = 0; i < nbVecs; i++) 43 | { 44 | Index rs = vectors.rows() - i; 45 | Scalar Vii = vectors(i,i); 46 | vectors.const_cast_derived().coeffRef(i,i) = Scalar(1); 47 | triFactor.col(i).head(i).noalias() = -hCoeffs(i) * vectors.block(i, 0, rs, i).adjoint() 48 | * vectors.col(i).tail(rs); 49 | vectors.const_cast_derived().coeffRef(i, i) = Vii; 50 | // FIXME add .noalias() once the triangular product can work inplace 51 | triFactor.col(i).head(i) = triFactor.block(0,0,i,i).template triangularView() 52 | * triFactor.col(i).head(i); 53 | triFactor(i,i) = hCoeffs(i); 54 | } 55 | } 56 | 57 | /** \internal */ 58 | template 59 | void apply_block_householder_on_the_left(MatrixType& mat, const VectorsType& vectors, const CoeffsType& hCoeffs) 60 | { 61 | typedef typename MatrixType::Index Index; 62 | enum { TFactorSize = MatrixType::ColsAtCompileTime }; 63 | Index nbVecs = vectors.cols(); 64 | Matrix T(nbVecs,nbVecs); 65 | make_block_householder_triangular_factor(T, vectors, hCoeffs); 66 | 67 | const TriangularView& V(vectors); 68 | 69 | // A -= V T V^* A 70 | Matrix tmp = V.adjoint() * mat; 72 | // FIXME add .noalias() once the triangular product can work inplace 73 | tmp = T.template triangularView().adjoint() * tmp; 74 | mat.noalias() -= V * tmp; 75 | } 76 | 77 | } // end namespace internal 78 | 79 | #endif // EIGEN_BLOCK_HOUSEHOLDER_H 80 | -------------------------------------------------------------------------------- /Eigen/src/Householder/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Householder_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Householder_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Householder COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Householder/Householder.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Benoit Jacob 5 | // Copyright (C) 2009 Gael Guennebaud 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_HOUSEHOLDER_H 27 | #define EIGEN_HOUSEHOLDER_H 28 | 29 | namespace internal { 30 | template struct decrement_size 31 | { 32 | enum { 33 | ret = n==Dynamic ? n : n-1 34 | }; 35 | }; 36 | } 37 | 38 | template 39 | void MatrixBase::makeHouseholderInPlace(Scalar& tau, RealScalar& beta) 40 | { 41 | VectorBlock::ret> essentialPart(derived(), 1, size()-1); 42 | makeHouseholder(essentialPart, tau, beta); 43 | } 44 | 45 | /** Computes the elementary reflector H such that: 46 | * \f$ H *this = [ beta 0 ... 0]^T \f$ 47 | * where the transformation H is: 48 | * \f$ H = I - tau v v^*\f$ 49 | * and the vector v is: 50 | * \f$ v^T = [1 essential^T] \f$ 51 | * 52 | * On output: 53 | * \param essential the essential part of the vector \c v 54 | * \param tau the scaling factor of the householder transformation 55 | * \param beta the result of H * \c *this 56 | * 57 | * \sa MatrixBase::makeHouseholderInPlace(), MatrixBase::applyHouseholderOnTheLeft(), 58 | * MatrixBase::applyHouseholderOnTheRight() 59 | */ 60 | template 61 | template 62 | void MatrixBase::makeHouseholder( 63 | EssentialPart& essential, 64 | Scalar& tau, 65 | RealScalar& beta) const 66 | { 67 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(EssentialPart) 68 | VectorBlock tail(derived(), 1, size()-1); 69 | 70 | RealScalar tailSqNorm = size()==1 ? RealScalar(0) : tail.squaredNorm(); 71 | Scalar c0 = coeff(0); 72 | 73 | if(tailSqNorm == RealScalar(0) && internal::imag(c0)==RealScalar(0)) 74 | { 75 | tau = RealScalar(0); 76 | beta = internal::real(c0); 77 | essential.setZero(); 78 | } 79 | else 80 | { 81 | beta = internal::sqrt(internal::abs2(c0) + tailSqNorm); 82 | if (internal::real(c0)>=RealScalar(0)) 83 | beta = -beta; 84 | essential = tail / (c0 - beta); 85 | tau = internal::conj((beta - c0) / beta); 86 | } 87 | } 88 | 89 | template 90 | template 91 | void MatrixBase::applyHouseholderOnTheLeft( 92 | const EssentialPart& essential, 93 | const Scalar& tau, 94 | Scalar* workspace) 95 | { 96 | if(rows() == 1) 97 | { 98 | *this *= Scalar(1)-tau; 99 | } 100 | else 101 | { 102 | Map::type> tmp(workspace,cols()); 103 | Block bottom(derived(), 1, 0, rows()-1, cols()); 104 | tmp.noalias() = essential.adjoint() * bottom; 105 | tmp += this->row(0); 106 | this->row(0) -= tau * tmp; 107 | bottom.noalias() -= tau * essential * tmp; 108 | } 109 | } 110 | 111 | template 112 | template 113 | void MatrixBase::applyHouseholderOnTheRight( 114 | const EssentialPart& essential, 115 | const Scalar& tau, 116 | Scalar* workspace) 117 | { 118 | if(cols() == 1) 119 | { 120 | *this *= Scalar(1)-tau; 121 | } 122 | else 123 | { 124 | Map::type> tmp(workspace,rows()); 125 | Block right(derived(), 0, 1, rows(), cols()-1); 126 | tmp.noalias() = right * essential.conjugate(); 127 | tmp += this->col(0); 128 | this->col(0) -= tau * tmp; 129 | right.noalias() -= tau * tmp * essential.transpose(); 130 | } 131 | } 132 | 133 | #endif // EIGEN_HOUSEHOLDER_H 134 | -------------------------------------------------------------------------------- /Eigen/src/Jacobi/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Jacobi_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Jacobi_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Jacobi COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/LU/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU COMPONENT Devel 6 | ) 7 | 8 | ADD_SUBDIRECTORY(arch) 9 | -------------------------------------------------------------------------------- /Eigen/src/LU/Determinant.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_DETERMINANT_H 26 | #define EIGEN_DETERMINANT_H 27 | 28 | namespace internal { 29 | 30 | template 31 | inline const typename Derived::Scalar bruteforce_det3_helper 32 | (const MatrixBase& matrix, int a, int b, int c) 33 | { 34 | return matrix.coeff(0,a) 35 | * (matrix.coeff(1,b) * matrix.coeff(2,c) - matrix.coeff(1,c) * matrix.coeff(2,b)); 36 | } 37 | 38 | template 39 | const typename Derived::Scalar bruteforce_det4_helper 40 | (const MatrixBase& matrix, int j, int k, int m, int n) 41 | { 42 | return (matrix.coeff(j,0) * matrix.coeff(k,1) - matrix.coeff(k,0) * matrix.coeff(j,1)) 43 | * (matrix.coeff(m,2) * matrix.coeff(n,3) - matrix.coeff(n,2) * matrix.coeff(m,3)); 44 | } 45 | 46 | template struct determinant_impl 49 | { 50 | static inline typename traits::Scalar run(const Derived& m) 51 | { 52 | if(Derived::ColsAtCompileTime==Dynamic && m.rows()==0) 53 | return typename traits::Scalar(1); 54 | return m.partialPivLu().determinant(); 55 | } 56 | }; 57 | 58 | template struct determinant_impl 59 | { 60 | static inline typename traits::Scalar run(const Derived& m) 61 | { 62 | return m.coeff(0,0); 63 | } 64 | }; 65 | 66 | template struct determinant_impl 67 | { 68 | static inline typename traits::Scalar run(const Derived& m) 69 | { 70 | return m.coeff(0,0) * m.coeff(1,1) - m.coeff(1,0) * m.coeff(0,1); 71 | } 72 | }; 73 | 74 | template struct determinant_impl 75 | { 76 | static inline typename traits::Scalar run(const Derived& m) 77 | { 78 | return bruteforce_det3_helper(m,0,1,2) 79 | - bruteforce_det3_helper(m,1,0,2) 80 | + bruteforce_det3_helper(m,2,0,1); 81 | } 82 | }; 83 | 84 | template struct determinant_impl 85 | { 86 | static typename traits::Scalar run(const Derived& m) 87 | { 88 | // trick by Martin Costabel to compute 4x4 det with only 30 muls 89 | return bruteforce_det4_helper(m,0,1,2,3) 90 | - bruteforce_det4_helper(m,0,2,1,3) 91 | + bruteforce_det4_helper(m,0,3,1,2) 92 | + bruteforce_det4_helper(m,1,2,0,3) 93 | - bruteforce_det4_helper(m,1,3,0,2) 94 | + bruteforce_det4_helper(m,2,3,0,1); 95 | } 96 | }; 97 | 98 | } // end namespace internal 99 | 100 | /** \lu_module 101 | * 102 | * \returns the determinant of this matrix 103 | */ 104 | template 105 | inline typename internal::traits::Scalar MatrixBase::determinant() const 106 | { 107 | assert(rows() == cols()); 108 | typedef typename internal::nested::type Nested; 109 | return internal::determinant_impl::type>::run(derived()); 110 | } 111 | 112 | #endif // EIGEN_DETERMINANT_H 113 | -------------------------------------------------------------------------------- /Eigen/src/LU/arch/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_LU_arch_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_LU_arch_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/LU/arch COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/QR/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_QR_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_QR_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/QR COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/SVD/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_SVD_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_SVD_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/SVD COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_Sparse_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_Sparse_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Sparse COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/CoreIterators.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2010 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_COREITERATORS_H 26 | #define EIGEN_COREITERATORS_H 27 | 28 | /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core 29 | */ 30 | 31 | /** \class InnerIterator 32 | * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression 33 | * 34 | * todo 35 | */ 36 | 37 | // generic version for dense matrix and expressions 38 | template class DenseBase::InnerIterator 39 | { 40 | protected: 41 | typedef typename Derived::Scalar Scalar; 42 | typedef typename Derived::Index Index; 43 | 44 | enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; 45 | public: 46 | EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) 47 | : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) 48 | {} 49 | 50 | EIGEN_STRONG_INLINE Scalar value() const 51 | { 52 | return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) 53 | : m_expression.coeff(m_inner, m_outer); 54 | } 55 | 56 | EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } 57 | 58 | EIGEN_STRONG_INLINE Index index() const { return m_inner; } 59 | inline Index row() const { return IsRowMajor ? m_outer : index(); } 60 | inline Index col() const { return IsRowMajor ? index() : m_outer; } 61 | 62 | EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } 63 | 64 | protected: 65 | const Derived& m_expression; 66 | Index m_inner; 67 | const Index m_outer; 68 | const Index m_end; 69 | }; 70 | 71 | #endif // EIGEN_COREITERATORS_H 72 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseAssign.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vancegroup/EigenArduino/1700db7c82b8e7a861474b6d58473dc2b8c3f65c/Eigen/src/Sparse/SparseAssign.h -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseDot.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSE_DOT_H 26 | #define EIGEN_SPARSE_DOT_H 27 | 28 | template 29 | template 30 | typename internal::traits::Scalar 31 | SparseMatrixBase::dot(const MatrixBase& other) const 32 | { 33 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 34 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 35 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 36 | EIGEN_STATIC_ASSERT((internal::is_same::value), 37 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 38 | 39 | eigen_assert(size() == other.size()); 40 | eigen_assert(other.size()>0 && "you are using a non initialized vector"); 41 | 42 | typename Derived::InnerIterator i(derived(),0); 43 | Scalar res = 0; 44 | while (i) 45 | { 46 | res += internal::conj(i.value()) * other.coeff(i.index()); 47 | ++i; 48 | } 49 | return res; 50 | } 51 | 52 | template 53 | template 54 | typename internal::traits::Scalar 55 | SparseMatrixBase::dot(const SparseMatrixBase& other) const 56 | { 57 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) 58 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) 59 | EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) 60 | EIGEN_STATIC_ASSERT((internal::is_same::value), 61 | YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 62 | 63 | eigen_assert(size() == other.size()); 64 | 65 | typename Derived::InnerIterator i(derived(),0); 66 | typename OtherDerived::InnerIterator j(other.derived(),0); 67 | Scalar res = 0; 68 | while (i && j) 69 | { 70 | if (i.index()==j.index()) 71 | { 72 | res += internal::conj(i.value()) * j.value(); 73 | ++i; ++j; 74 | } 75 | else if (i.index() 84 | inline typename NumTraits::Scalar>::Real 85 | SparseMatrixBase::squaredNorm() const 86 | { 87 | return internal::real((*this).cwiseAbs2().sum()); 88 | } 89 | 90 | template 91 | inline typename NumTraits::Scalar>::Real 92 | SparseMatrixBase::norm() const 93 | { 94 | return internal::sqrt(squaredNorm()); 95 | } 96 | 97 | #endif // EIGEN_SPARSE_DOT_H 98 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseFuzzy.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSE_FUZZY_H 26 | #define EIGEN_SPARSE_FUZZY_H 27 | 28 | // template 29 | // template 30 | // bool SparseMatrixBase::isApprox( 31 | // const OtherDerived& other, 32 | // typename NumTraits::Real prec 33 | // ) const 34 | // { 35 | // const typename internal::nested::type nested(derived()); 36 | // const typename internal::nested::type otherNested(other.derived()); 37 | // return (nested - otherNested).cwise().abs2().sum() 38 | // <= prec * prec * (std::min)(nested.cwise().abs2().sum(), otherNested.cwise().abs2().sum()); 39 | // } 40 | 41 | #endif // EIGEN_SPARSE_FUZZY_H 42 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseRedux.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSEREDUX_H 26 | #define EIGEN_SPARSEREDUX_H 27 | 28 | template 29 | typename internal::traits::Scalar 30 | SparseMatrixBase::sum() const 31 | { 32 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 33 | Scalar res = 0; 34 | for (Index j=0; j 41 | typename internal::traits >::Scalar 42 | SparseMatrix<_Scalar,_Options,_Index>::sum() const 43 | { 44 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 45 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 46 | } 47 | 48 | template 49 | typename internal::traits >::Scalar 50 | SparseVector<_Scalar,_Options,_Index>::sum() const 51 | { 52 | eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); 53 | return Matrix::Map(&m_data.value(0), m_data.size()).sum(); 54 | } 55 | 56 | #endif // EIGEN_SPARSEREDUX_H 57 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseTranspose.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSETRANSPOSE_H 26 | #define EIGEN_SPARSETRANSPOSE_H 27 | 28 | template class TransposeImpl 29 | : public SparseMatrixBase > 30 | { 31 | typedef typename internal::remove_all::type _MatrixTypeNested; 32 | public: 33 | 34 | EIGEN_SPARSE_PUBLIC_INTERFACE(Transpose) 35 | 36 | class InnerIterator; 37 | class ReverseInnerIterator; 38 | 39 | inline Index nonZeros() const { return derived().nestedExpression().nonZeros(); } 40 | }; 41 | 42 | template class TransposeImpl::InnerIterator 43 | : public _MatrixTypeNested::InnerIterator 44 | { 45 | typedef typename _MatrixTypeNested::InnerIterator Base; 46 | public: 47 | 48 | EIGEN_STRONG_INLINE InnerIterator(const TransposeImpl& trans, Index outer) 49 | : Base(trans.derived().nestedExpression(), outer) 50 | {} 51 | inline Index row() const { return Base::col(); } 52 | inline Index col() const { return Base::row(); } 53 | }; 54 | 55 | template class TransposeImpl::ReverseInnerIterator 56 | : public _MatrixTypeNested::ReverseInnerIterator 57 | { 58 | typedef typename _MatrixTypeNested::ReverseInnerIterator Base; 59 | public: 60 | 61 | EIGEN_STRONG_INLINE ReverseInnerIterator(const TransposeImpl& xpr, Index outer) 62 | : Base(xpr.derived().nestedExpression(), outer) 63 | {} 64 | inline Index row() const { return Base::col(); } 65 | inline Index col() const { return Base::row(); } 66 | }; 67 | 68 | #endif // EIGEN_SPARSETRANSPOSE_H 69 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseTriangularView.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_SPARSE_TRIANGULARVIEW_H 26 | #define EIGEN_SPARSE_TRIANGULARVIEW_H 27 | 28 | namespace internal { 29 | 30 | template 31 | struct traits > 32 | : public traits 33 | {}; 34 | 35 | } // namespace internal 36 | 37 | template class SparseTriangularView 38 | : public SparseMatrixBase > 39 | { 40 | enum { SkipFirst = (Mode==Lower && !(MatrixType::Flags&RowMajorBit)) 41 | || (Mode==Upper && (MatrixType::Flags&RowMajorBit)) }; 42 | public: 43 | 44 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseTriangularView) 45 | 46 | class InnerIterator; 47 | 48 | inline Index rows() const { return m_matrix.rows(); } 49 | inline Index cols() const { return m_matrix.cols(); } 50 | 51 | typedef typename internal::conditional::ret, 52 | MatrixType, const MatrixType&>::type MatrixTypeNested; 53 | 54 | inline SparseTriangularView(const MatrixType& matrix) : m_matrix(matrix) {} 55 | 56 | /** \internal */ 57 | inline const MatrixType& nestedExpression() const { return m_matrix; } 58 | 59 | template 60 | typename internal::plain_matrix_type_column_major::type 61 | solve(const MatrixBase& other) const; 62 | 63 | template void solveInPlace(MatrixBase& other) const; 64 | template void solveInPlace(SparseMatrixBase& other) const; 65 | 66 | protected: 67 | MatrixTypeNested m_matrix; 68 | }; 69 | 70 | template 71 | class SparseTriangularView::InnerIterator : public MatrixType::InnerIterator 72 | { 73 | typedef typename MatrixType::InnerIterator Base; 74 | public: 75 | 76 | EIGEN_STRONG_INLINE InnerIterator(const SparseTriangularView& view, Index outer) 77 | : Base(view.nestedExpression(), outer) 78 | { 79 | if(SkipFirst) 80 | while((*this) && this->index()index() <= this->outer()); 89 | } 90 | }; 91 | 92 | template 93 | template 94 | inline const SparseTriangularView 95 | SparseMatrixBase::triangularView() const 96 | { 97 | return derived(); 98 | } 99 | 100 | #endif // EIGEN_SPARSE_TRIANGULARVIEW_H 101 | -------------------------------------------------------------------------------- /Eigen/src/Sparse/SparseView.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2010 Gael Guennebaud 5 | // Copyright (C) 2010 Daniel Lowengrub 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_SPARSEVIEW_H 27 | #define EIGEN_SPARSEVIEW_H 28 | 29 | namespace internal { 30 | 31 | template 32 | struct traits > : traits 33 | { 34 | typedef int Index; 35 | typedef Sparse StorageKind; 36 | enum { 37 | Flags = int(traits::Flags) & (RowMajorBit) 38 | }; 39 | }; 40 | 41 | } // end namespace internal 42 | 43 | template 44 | class SparseView : public SparseMatrixBase > 45 | { 46 | typedef typename MatrixType::Nested MatrixTypeNested; 47 | typedef typename internal::remove_all::type _MatrixTypeNested; 48 | public: 49 | EIGEN_SPARSE_PUBLIC_INTERFACE(SparseView) 50 | 51 | SparseView(const MatrixType& mat, const Scalar& m_reference = Scalar(0), 52 | typename NumTraits::Real m_epsilon = NumTraits::dummy_precision()) : 53 | m_matrix(mat), m_reference(m_reference), m_epsilon(m_epsilon) {} 54 | 55 | class InnerIterator; 56 | 57 | inline Index rows() const { return m_matrix.rows(); } 58 | inline Index cols() const { return m_matrix.cols(); } 59 | 60 | inline Index innerSize() const { return m_matrix.innerSize(); } 61 | inline Index outerSize() const { return m_matrix.outerSize(); } 62 | 63 | protected: 64 | const MatrixTypeNested m_matrix; 65 | Scalar m_reference; 66 | typename NumTraits::Real m_epsilon; 67 | }; 68 | 69 | template 70 | class SparseView::InnerIterator : public _MatrixTypeNested::InnerIterator 71 | { 72 | public: 73 | typedef typename _MatrixTypeNested::InnerIterator IterBase; 74 | InnerIterator(const SparseView& view, Index outer) : 75 | IterBase(view.m_matrix, outer), m_view(view) 76 | { 77 | incrementToNonZero(); 78 | } 79 | 80 | EIGEN_STRONG_INLINE InnerIterator& operator++() 81 | { 82 | IterBase::operator++(); 83 | incrementToNonZero(); 84 | return *this; 85 | } 86 | 87 | using IterBase::value; 88 | 89 | protected: 90 | const SparseView& m_view; 91 | 92 | private: 93 | void incrementToNonZero() 94 | { 95 | while(internal::isMuchSmallerThan(value(), m_view.m_reference, m_view.m_epsilon) && (bool(*this))) 96 | { 97 | IterBase::operator++(); 98 | } 99 | } 100 | }; 101 | 102 | template 103 | const SparseView MatrixBase::sparseView(const Scalar& m_reference, 104 | typename NumTraits::Real m_epsilon) const 105 | { 106 | return SparseView(derived(), m_reference, m_epsilon); 107 | } 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /Eigen/src/StlSupport/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_StlSupport_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_StlSupport_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/StlSupport COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/StlSupport/StdList.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Hauke Heibel 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_STDLIST_H 26 | #define EIGEN_STDLIST_H 27 | 28 | #include "Eigen/src/StlSupport/details.h" 29 | 30 | // Define the explicit instantiation (e.g. necessary for the Intel compiler) 31 | #if defined(__INTEL_COMPILER) || defined(__GNUC__) 32 | #define EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(...) template class std::list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> >; 33 | #else 34 | #define EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(...) 35 | #endif 36 | 37 | /** 38 | * This section contains a convenience MACRO which allows an easy specialization of 39 | * std::list such that for data types with alignment issues the correct allocator 40 | * is used automatically. 41 | */ 42 | #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) \ 43 | EIGEN_EXPLICIT_STL_LIST_INSTANTIATION(__VA_ARGS__) \ 44 | namespace std \ 45 | { \ 46 | template \ 47 | class list<__VA_ARGS__, _Ay> \ 48 | : public list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > \ 49 | { \ 50 | typedef list<__VA_ARGS__, EIGEN_ALIGNED_ALLOCATOR<__VA_ARGS__> > list_base; \ 51 | public: \ 52 | typedef __VA_ARGS__ value_type; \ 53 | typedef typename list_base::allocator_type allocator_type; \ 54 | typedef typename list_base::size_type size_type; \ 55 | typedef typename list_base::iterator iterator; \ 56 | explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \ 57 | template \ 58 | list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) : list_base(first, last, a) {} \ 59 | list(const list& c) : list_base(c) {} \ 60 | explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \ 61 | list(iterator start, iterator end) : list_base(start, end) {} \ 62 | list& operator=(const list& x) { \ 63 | list_base::operator=(x); \ 64 | return *this; \ 65 | } \ 66 | }; \ 67 | } 68 | 69 | // check whether we really need the std::vector specialization 70 | #if !(defined(_GLIBCXX_VECTOR) && (!EIGEN_GNUC_AT_LEAST(4,1))) /* Note that before gcc-4.1 we already have: std::list::resize(size_type,const T&). */ 71 | 72 | namespace std 73 | { 74 | 75 | #define EIGEN_STD_LIST_SPECIALIZATION_BODY \ 76 | public: \ 77 | typedef T value_type; \ 78 | typedef typename list_base::allocator_type allocator_type; \ 79 | typedef typename list_base::size_type size_type; \ 80 | typedef typename list_base::iterator iterator; \ 81 | typedef typename list_base::const_iterator const_iterator; \ 82 | explicit list(const allocator_type& a = allocator_type()) : list_base(a) {} \ 83 | template \ 84 | list(InputIterator first, InputIterator last, const allocator_type& a = allocator_type()) \ 85 | : list_base(first, last, a) {} \ 86 | list(const list& c) : list_base(c) {} \ 87 | explicit list(size_type num, const value_type& val = value_type()) : list_base(num, val) {} \ 88 | list(iterator start, iterator end) : list_base(start, end) {} \ 89 | list& operator=(const list& x) { \ 90 | list_base::operator=(x); \ 91 | return *this; \ 92 | } 93 | 94 | template 95 | class list > 96 | : public list > 98 | { 99 | typedef list > list_base; 101 | EIGEN_STD_LIST_SPECIALIZATION_BODY 102 | 103 | void resize(size_type new_size) 104 | { resize(new_size, T()); } 105 | 106 | void resize(size_type new_size, const value_type& x) 107 | { 108 | if (list_base::size() < new_size) 109 | list_base::insert(list_base::end(), new_size - list_base::size(), x); 110 | else 111 | while (new_size < list_base::size()) list_base::pop_back(); 112 | } 113 | 114 | #if defined(_LIST_) 115 | // workaround MSVC std::list implementation 116 | void push_back(const value_type& x) 117 | { list_base::push_back(x); } 118 | using list_base::insert; 119 | iterator insert(const_iterator position, const value_type& x) 120 | { return list_base::insert(position,x); } 121 | void insert(const_iterator position, size_type new_size, const value_type& x) 122 | { list_base::insert(position, new_size, x); } 123 | #endif 124 | }; 125 | } 126 | 127 | #endif // check whether specialization is actually required 128 | 129 | #endif // EIGEN_STDLIST_H 130 | -------------------------------------------------------------------------------- /Eigen/src/StlSupport/details.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Gael Guennebaud 5 | // Copyright (C) 2009 Hauke Heibel 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | #ifndef EIGEN_STL_DETAILS_H 27 | #define EIGEN_STL_DETAILS_H 28 | 29 | #ifndef EIGEN_ALIGNED_ALLOCATOR 30 | #define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator 31 | #endif 32 | 33 | namespace Eigen { 34 | 35 | // This one is needed to prevent reimplementing the whole std::vector. 36 | template 37 | class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR 38 | { 39 | public: 40 | typedef size_t size_type; 41 | typedef ptrdiff_t difference_type; 42 | typedef T* pointer; 43 | typedef const T* const_pointer; 44 | typedef T& reference; 45 | typedef const T& const_reference; 46 | typedef T value_type; 47 | 48 | template 49 | struct rebind 50 | { 51 | typedef aligned_allocator_indirection other; 52 | }; 53 | 54 | aligned_allocator_indirection() {} 55 | aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR() {} 56 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 57 | template 58 | aligned_allocator_indirection(const aligned_allocator_indirection& ) {} 59 | template 60 | aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR& ) {} 61 | ~aligned_allocator_indirection() {} 62 | }; 63 | 64 | #ifdef _MSC_VER 65 | 66 | // sometimes, MSVC detects, at compile time, that the argument x 67 | // in std::vector::resize(size_t s,T x) won't be aligned and generate an error 68 | // even if this function is never called. Whence this little wrapper. 69 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \ 70 | typename Eigen::internal::conditional< \ 71 | Eigen::internal::is_arithmetic::value, \ 72 | T, \ 73 | Eigen::internal::workaround_msvc_stl_support \ 74 | >::type 75 | 76 | namespace internal { 77 | template struct workaround_msvc_stl_support : public T 78 | { 79 | inline workaround_msvc_stl_support() : T() {} 80 | inline workaround_msvc_stl_support(const T& other) : T(other) {} 81 | inline operator T& () { return *static_cast(this); } 82 | inline operator const T& () const { return *static_cast(this); } 83 | template 84 | inline T& operator=(const OtherT& other) 85 | { T::operator=(other); return *this; } 86 | inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other) 87 | { T::operator=(other); return *this; } 88 | }; 89 | } 90 | 91 | #else 92 | 93 | #define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T 94 | 95 | #endif 96 | 97 | } 98 | 99 | #endif // EIGEN_STL_DETAILS_H 100 | -------------------------------------------------------------------------------- /Eigen/src/misc/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_misc_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_misc_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/misc COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/misc/Image.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_MISC_IMAGE_H 26 | #define EIGEN_MISC_IMAGE_H 27 | 28 | namespace internal { 29 | 30 | /** \class image_retval_base 31 | * 32 | */ 33 | template 34 | struct traits > 35 | { 36 | typedef typename DecompositionType::MatrixType MatrixType; 37 | typedef Matrix< 38 | typename MatrixType::Scalar, 39 | MatrixType::RowsAtCompileTime, // the image is a subspace of the destination space, whose 40 | // dimension is the number of rows of the original matrix 41 | Dynamic, // we don't know at compile time the dimension of the image (the rank) 42 | MatrixType::Options, 43 | MatrixType::MaxRowsAtCompileTime, // the image matrix will consist of columns from the original matrix, 44 | MatrixType::MaxColsAtCompileTime // so it has the same number of rows and at most as many columns. 45 | > ReturnType; 46 | }; 47 | 48 | template struct image_retval_base 49 | : public ReturnByValue > 50 | { 51 | typedef _DecompositionType DecompositionType; 52 | typedef typename DecompositionType::MatrixType MatrixType; 53 | typedef ReturnByValue Base; 54 | typedef typename Base::Index Index; 55 | 56 | image_retval_base(const DecompositionType& dec, const MatrixType& originalMatrix) 57 | : m_dec(dec), m_rank(dec.rank()), 58 | m_cols(m_rank == 0 ? 1 : m_rank), 59 | m_originalMatrix(originalMatrix) 60 | {} 61 | 62 | inline Index rows() const { return m_dec.rows(); } 63 | inline Index cols() const { return m_cols; } 64 | inline Index rank() const { return m_rank; } 65 | inline const DecompositionType& dec() const { return m_dec; } 66 | inline const MatrixType& originalMatrix() const { return m_originalMatrix; } 67 | 68 | template inline void evalTo(Dest& dst) const 69 | { 70 | static_cast*>(this)->evalTo(dst); 71 | } 72 | 73 | protected: 74 | const DecompositionType& m_dec; 75 | Index m_rank, m_cols; 76 | const MatrixType& m_originalMatrix; 77 | }; 78 | 79 | } // end namespace internal 80 | 81 | #define EIGEN_MAKE_IMAGE_HELPERS(DecompositionType) \ 82 | typedef typename DecompositionType::MatrixType MatrixType; \ 83 | typedef typename MatrixType::Scalar Scalar; \ 84 | typedef typename MatrixType::RealScalar RealScalar; \ 85 | typedef typename MatrixType::Index Index; \ 86 | typedef Eigen::internal::image_retval_base Base; \ 87 | using Base::dec; \ 88 | using Base::originalMatrix; \ 89 | using Base::rank; \ 90 | using Base::rows; \ 91 | using Base::cols; \ 92 | image_retval(const DecompositionType& dec, const MatrixType& originalMatrix) \ 93 | : Base(dec, originalMatrix) {} 94 | 95 | #endif // EIGEN_MISC_IMAGE_H 96 | -------------------------------------------------------------------------------- /Eigen/src/misc/Kernel.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_MISC_KERNEL_H 26 | #define EIGEN_MISC_KERNEL_H 27 | 28 | namespace internal { 29 | 30 | /** \class kernel_retval_base 31 | * 32 | */ 33 | template 34 | struct traits > 35 | { 36 | typedef typename DecompositionType::MatrixType MatrixType; 37 | typedef Matrix< 38 | typename MatrixType::Scalar, 39 | MatrixType::ColsAtCompileTime, // the number of rows in the "kernel matrix" 40 | // is the number of cols of the original matrix 41 | // so that the product "matrix * kernel = zero" makes sense 42 | Dynamic, // we don't know at compile-time the dimension of the kernel 43 | MatrixType::Options, 44 | MatrixType::MaxColsAtCompileTime, // see explanation for 2nd template parameter 45 | MatrixType::MaxColsAtCompileTime // the kernel is a subspace of the domain space, 46 | // whose dimension is the number of columns of the original matrix 47 | > ReturnType; 48 | }; 49 | 50 | template struct kernel_retval_base 51 | : public ReturnByValue > 52 | { 53 | typedef _DecompositionType DecompositionType; 54 | typedef ReturnByValue Base; 55 | typedef typename Base::Index Index; 56 | 57 | kernel_retval_base(const DecompositionType& dec) 58 | : m_dec(dec), 59 | m_rank(dec.rank()), 60 | m_cols(m_rank==dec.cols() ? 1 : dec.cols() - m_rank) 61 | {} 62 | 63 | inline Index rows() const { return m_dec.cols(); } 64 | inline Index cols() const { return m_cols; } 65 | inline Index rank() const { return m_rank; } 66 | inline const DecompositionType& dec() const { return m_dec; } 67 | 68 | template inline void evalTo(Dest& dst) const 69 | { 70 | static_cast*>(this)->evalTo(dst); 71 | } 72 | 73 | protected: 74 | const DecompositionType& m_dec; 75 | Index m_rank, m_cols; 76 | }; 77 | 78 | } // end namespace internal 79 | 80 | #define EIGEN_MAKE_KERNEL_HELPERS(DecompositionType) \ 81 | typedef typename DecompositionType::MatrixType MatrixType; \ 82 | typedef typename MatrixType::Scalar Scalar; \ 83 | typedef typename MatrixType::RealScalar RealScalar; \ 84 | typedef typename MatrixType::Index Index; \ 85 | typedef Eigen::internal::kernel_retval_base Base; \ 86 | using Base::dec; \ 87 | using Base::rank; \ 88 | using Base::rows; \ 89 | using Base::cols; \ 90 | kernel_retval(const DecompositionType& dec) : Base(dec) {} 91 | 92 | #endif // EIGEN_MISC_KERNEL_H 93 | -------------------------------------------------------------------------------- /Eigen/src/misc/Solve.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2009 Benoit Jacob 5 | // 6 | // Eigen is free software; you can redistribute it and/or 7 | // modify it under the terms of the GNU Lesser General Public 8 | // License as published by the Free Software Foundation; either 9 | // version 3 of the License, or (at your option) any later version. 10 | // 11 | // Alternatively, you can redistribute it and/or 12 | // modify it under the terms of the GNU General Public License as 13 | // published by the Free Software Foundation; either version 2 of 14 | // the License, or (at your option) any later version. 15 | // 16 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 17 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 19 | // GNU General Public License for more details. 20 | // 21 | // You should have received a copy of the GNU Lesser General Public 22 | // License and a copy of the GNU General Public License along with 23 | // Eigen. If not, see . 24 | 25 | #ifndef EIGEN_MISC_SOLVE_H 26 | #define EIGEN_MISC_SOLVE_H 27 | 28 | namespace internal { 29 | 30 | /** \class solve_retval_base 31 | * 32 | */ 33 | template 34 | struct traits > 35 | { 36 | typedef typename DecompositionType::MatrixType MatrixType; 37 | typedef Matrix ReturnType; 43 | }; 44 | 45 | template struct solve_retval_base 46 | : public ReturnByValue > 47 | { 48 | typedef typename remove_all::type RhsNestedCleaned; 49 | typedef _DecompositionType DecompositionType; 50 | typedef ReturnByValue Base; 51 | typedef typename Base::Index Index; 52 | 53 | solve_retval_base(const DecompositionType& dec, const Rhs& rhs) 54 | : m_dec(dec), m_rhs(rhs) 55 | {} 56 | 57 | inline Index rows() const { return m_dec.cols(); } 58 | inline Index cols() const { return m_rhs.cols(); } 59 | inline const DecompositionType& dec() const { return m_dec; } 60 | inline const RhsNestedCleaned& rhs() const { return m_rhs; } 61 | 62 | template inline void evalTo(Dest& dst) const 63 | { 64 | static_cast*>(this)->evalTo(dst); 65 | } 66 | 67 | protected: 68 | const DecompositionType& m_dec; 69 | const typename Rhs::Nested m_rhs; 70 | }; 71 | 72 | } // end namespace internal 73 | 74 | #define EIGEN_MAKE_SOLVE_HELPERS(DecompositionType,Rhs) \ 75 | typedef typename DecompositionType::MatrixType MatrixType; \ 76 | typedef typename MatrixType::Scalar Scalar; \ 77 | typedef typename MatrixType::RealScalar RealScalar; \ 78 | typedef typename MatrixType::Index Index; \ 79 | typedef Eigen::internal::solve_retval_base Base; \ 80 | using Base::dec; \ 81 | using Base::rhs; \ 82 | using Base::rows; \ 83 | using Base::cols; \ 84 | solve_retval(const DecompositionType& dec, const Rhs& rhs) \ 85 | : Base(dec, rhs) {} 86 | 87 | #endif // EIGEN_MISC_SOLVE_H 88 | -------------------------------------------------------------------------------- /Eigen/src/plugins/ArrayCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | /** \returns an expression of the coefficient wise product of \c *this and \a other 2 | * 3 | * \sa MatrixBase::cwiseProduct 4 | */ 5 | template 6 | EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived) 7 | operator*(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 8 | { 9 | return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived()); 10 | } 11 | 12 | /** \returns an expression of the coefficient wise quotient of \c *this and \a other 13 | * 14 | * \sa MatrixBase::cwiseQuotient 15 | */ 16 | template 17 | EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> 18 | operator/(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 19 | { 20 | return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); 21 | } 22 | 23 | /** \returns an expression of the coefficient-wise min of \c *this and \a other 24 | * 25 | * Example: \include Cwise_min.cpp 26 | * Output: \verbinclude Cwise_min.out 27 | * 28 | * \sa max() 29 | */ 30 | EIGEN_MAKE_CWISE_BINARY_OP(min,internal::scalar_min_op) 31 | 32 | /** \returns an expression of the coefficient-wise max of \c *this and \a other 33 | * 34 | * Example: \include Cwise_max.cpp 35 | * Output: \verbinclude Cwise_max.out 36 | * 37 | * \sa min() 38 | */ 39 | EIGEN_MAKE_CWISE_BINARY_OP(max,internal::scalar_max_op) 40 | 41 | /** \returns an expression of the coefficient-wise \< operator of *this and \a other 42 | * 43 | * Example: \include Cwise_less.cpp 44 | * Output: \verbinclude Cwise_less.out 45 | * 46 | * \sa all(), any(), operator>(), operator<=() 47 | */ 48 | EIGEN_MAKE_CWISE_BINARY_OP(operator<,std::less) 49 | 50 | /** \returns an expression of the coefficient-wise \<= operator of *this and \a other 51 | * 52 | * Example: \include Cwise_less_equal.cpp 53 | * Output: \verbinclude Cwise_less_equal.out 54 | * 55 | * \sa all(), any(), operator>=(), operator<() 56 | */ 57 | EIGEN_MAKE_CWISE_BINARY_OP(operator<=,std::less_equal) 58 | 59 | /** \returns an expression of the coefficient-wise \> operator of *this and \a other 60 | * 61 | * Example: \include Cwise_greater.cpp 62 | * Output: \verbinclude Cwise_greater.out 63 | * 64 | * \sa all(), any(), operator>=(), operator<() 65 | */ 66 | EIGEN_MAKE_CWISE_BINARY_OP(operator>,std::greater) 67 | 68 | /** \returns an expression of the coefficient-wise \>= operator of *this and \a other 69 | * 70 | * Example: \include Cwise_greater_equal.cpp 71 | * Output: \verbinclude Cwise_greater_equal.out 72 | * 73 | * \sa all(), any(), operator>(), operator<=() 74 | */ 75 | EIGEN_MAKE_CWISE_BINARY_OP(operator>=,std::greater_equal) 76 | 77 | /** \returns an expression of the coefficient-wise == operator of *this and \a other 78 | * 79 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 80 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 81 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 82 | * isMuchSmallerThan(). 83 | * 84 | * Example: \include Cwise_equal_equal.cpp 85 | * Output: \verbinclude Cwise_equal_equal.out 86 | * 87 | * \sa all(), any(), isApprox(), isMuchSmallerThan() 88 | */ 89 | EIGEN_MAKE_CWISE_BINARY_OP(operator==,std::equal_to) 90 | 91 | /** \returns an expression of the coefficient-wise != operator of *this and \a other 92 | * 93 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 94 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 95 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 96 | * isMuchSmallerThan(). 97 | * 98 | * Example: \include Cwise_not_equal.cpp 99 | * Output: \verbinclude Cwise_not_equal.out 100 | * 101 | * \sa all(), any(), isApprox(), isMuchSmallerThan() 102 | */ 103 | EIGEN_MAKE_CWISE_BINARY_OP(operator!=,std::not_equal_to) 104 | 105 | // scalar addition 106 | 107 | /** \returns an expression of \c *this with each coeff incremented by the constant \a scalar 108 | * 109 | * Example: \include Cwise_plus.cpp 110 | * Output: \verbinclude Cwise_plus.out 111 | * 112 | * \sa operator+=(), operator-() 113 | */ 114 | inline const CwiseUnaryOp, const Derived> 115 | operator+(const Scalar& scalar) const 116 | { 117 | return CwiseUnaryOp, const Derived>(derived(), internal::scalar_add_op(scalar)); 118 | } 119 | 120 | friend inline const CwiseUnaryOp, const Derived> 121 | operator+(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) 122 | { 123 | return other + scalar; 124 | } 125 | 126 | /** \returns an expression of \c *this with each coeff decremented by the constant \a scalar 127 | * 128 | * Example: \include Cwise_minus.cpp 129 | * Output: \verbinclude Cwise_minus.out 130 | * 131 | * \sa operator+(), operator-=() 132 | */ 133 | inline const CwiseUnaryOp, const Derived> 134 | operator-(const Scalar& scalar) const 135 | { 136 | return *this + (-scalar); 137 | } 138 | 139 | friend inline const CwiseUnaryOp, const CwiseUnaryOp, const Derived> > 140 | operator-(const Scalar& scalar,const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) 141 | { 142 | return (-other) + scalar; 143 | } 144 | -------------------------------------------------------------------------------- /Eigen/src/plugins/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | FILE(GLOB Eigen_plugins_SRCS "*.h") 2 | 3 | INSTALL(FILES 4 | ${Eigen_plugins_SRCS} 5 | DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/plugins COMPONENT Devel 6 | ) 7 | -------------------------------------------------------------------------------- /Eigen/src/plugins/CommonCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | // This file is a base class plugin containing common coefficient wise functions. 27 | 28 | /** \returns an expression of the difference of \c *this and \a other 29 | * 30 | * \note If you want to substract a given scalar from all coefficients, see Cwise::operator-(). 31 | * 32 | * \sa class CwiseBinaryOp, operator-=() 33 | */ 34 | EIGEN_MAKE_CWISE_BINARY_OP(operator-,internal::scalar_difference_op) 35 | 36 | /** \returns an expression of the sum of \c *this and \a other 37 | * 38 | * \note If you want to add a given scalar to all coefficients, see Cwise::operator+(). 39 | * 40 | * \sa class CwiseBinaryOp, operator+=() 41 | */ 42 | EIGEN_MAKE_CWISE_BINARY_OP(operator+,internal::scalar_sum_op) 43 | 44 | /** \returns an expression of a custom coefficient-wise operator \a func of *this and \a other 45 | * 46 | * The template parameter \a CustomBinaryOp is the type of the functor 47 | * of the custom operator (see class CwiseBinaryOp for an example) 48 | * 49 | * Here is an example illustrating the use of custom functors: 50 | * \include class_CwiseBinaryOp.cpp 51 | * Output: \verbinclude class_CwiseBinaryOp.out 52 | * 53 | * \sa class CwiseBinaryOp, operator+(), operator-(), cwiseProduct() 54 | */ 55 | template 56 | EIGEN_STRONG_INLINE const CwiseBinaryOp 57 | binaryExpr(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other, const CustomBinaryOp& func = CustomBinaryOp()) const 58 | { 59 | return CwiseBinaryOp(derived(), other.derived(), func); 60 | } 61 | 62 | -------------------------------------------------------------------------------- /Eigen/src/plugins/MatrixCwiseBinaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 27 | 28 | /** \returns an expression of the Schur product (coefficient wise product) of *this and \a other 29 | * 30 | * Example: \include MatrixBase_cwiseProduct.cpp 31 | * Output: \verbinclude MatrixBase_cwiseProduct.out 32 | * 33 | * \sa class CwiseBinaryOp, cwiseAbs2 34 | */ 35 | template 36 | EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived) 37 | cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 38 | { 39 | return EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived,OtherDerived)(derived(), other.derived()); 40 | } 41 | 42 | /** \returns an expression of the coefficient-wise == operator of *this and \a other 43 | * 44 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 45 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 46 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 47 | * isMuchSmallerThan(). 48 | * 49 | * Example: \include MatrixBase_cwiseEqual.cpp 50 | * Output: \verbinclude MatrixBase_cwiseEqual.out 51 | * 52 | * \sa cwiseNotEqual(), isApprox(), isMuchSmallerThan() 53 | */ 54 | template 55 | inline const CwiseBinaryOp, const Derived, const OtherDerived> 56 | cwiseEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 57 | { 58 | return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); 59 | } 60 | 61 | /** \returns an expression of the coefficient-wise != operator of *this and \a other 62 | * 63 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 64 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 65 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 66 | * isMuchSmallerThan(). 67 | * 68 | * Example: \include MatrixBase_cwiseNotEqual.cpp 69 | * Output: \verbinclude MatrixBase_cwiseNotEqual.out 70 | * 71 | * \sa cwiseEqual(), isApprox(), isMuchSmallerThan() 72 | */ 73 | template 74 | inline const CwiseBinaryOp, const Derived, const OtherDerived> 75 | cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 76 | { 77 | return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); 78 | } 79 | 80 | /** \returns an expression of the coefficient-wise min of *this and \a other 81 | * 82 | * Example: \include MatrixBase_cwiseMin.cpp 83 | * Output: \verbinclude MatrixBase_cwiseMin.out 84 | * 85 | * \sa class CwiseBinaryOp, max() 86 | */ 87 | template 88 | EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> 89 | cwiseMin(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 90 | { 91 | return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); 92 | } 93 | 94 | /** \returns an expression of the coefficient-wise max of *this and \a other 95 | * 96 | * Example: \include MatrixBase_cwiseMax.cpp 97 | * Output: \verbinclude MatrixBase_cwiseMax.out 98 | * 99 | * \sa class CwiseBinaryOp, min() 100 | */ 101 | template 102 | EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> 103 | cwiseMax(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 104 | { 105 | return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); 106 | } 107 | 108 | /** \returns an expression of the coefficient-wise quotient of *this and \a other 109 | * 110 | * Example: \include MatrixBase_cwiseQuotient.cpp 111 | * Output: \verbinclude MatrixBase_cwiseQuotient.out 112 | * 113 | * \sa class CwiseBinaryOp, cwiseProduct(), cwiseInverse() 114 | */ 115 | template 116 | EIGEN_STRONG_INLINE const CwiseBinaryOp, const Derived, const OtherDerived> 117 | cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const 118 | { 119 | return CwiseBinaryOp, const Derived, const OtherDerived>(derived(), other.derived()); 120 | } 121 | -------------------------------------------------------------------------------- /Eigen/src/plugins/MatrixCwiseUnaryOps.h: -------------------------------------------------------------------------------- 1 | // This file is part of Eigen, a lightweight C++ template library 2 | // for linear algebra. 3 | // 4 | // Copyright (C) 2008-2009 Gael Guennebaud 5 | // Copyright (C) 2006-2008 Benoit Jacob 6 | // 7 | // Eigen is free software; you can redistribute it and/or 8 | // modify it under the terms of the GNU Lesser General Public 9 | // License as published by the Free Software Foundation; either 10 | // version 3 of the License, or (at your option) any later version. 11 | // 12 | // Alternatively, you can redistribute it and/or 13 | // modify it under the terms of the GNU General Public License as 14 | // published by the Free Software Foundation; either version 2 of 15 | // the License, or (at your option) any later version. 16 | // 17 | // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY 18 | // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19 | // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the 20 | // GNU General Public License for more details. 21 | // 22 | // You should have received a copy of the GNU Lesser General Public 23 | // License and a copy of the GNU General Public License along with 24 | // Eigen. If not, see . 25 | 26 | // This file is a base class plugin containing matrix specifics coefficient wise functions. 27 | 28 | /** \returns an expression of the coefficient-wise absolute value of \c *this 29 | * 30 | * Example: \include MatrixBase_cwiseAbs.cpp 31 | * Output: \verbinclude MatrixBase_cwiseAbs.out 32 | * 33 | * \sa cwiseAbs2() 34 | */ 35 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 36 | cwiseAbs() const { return derived(); } 37 | 38 | /** \returns an expression of the coefficient-wise squared absolute value of \c *this 39 | * 40 | * Example: \include MatrixBase_cwiseAbs2.cpp 41 | * Output: \verbinclude MatrixBase_cwiseAbs2.out 42 | * 43 | * \sa cwiseAbs() 44 | */ 45 | EIGEN_STRONG_INLINE const CwiseUnaryOp, const Derived> 46 | cwiseAbs2() const { return derived(); } 47 | 48 | /** \returns an expression of the coefficient-wise square root of *this. 49 | * 50 | * Example: \include MatrixBase_cwiseSqrt.cpp 51 | * Output: \verbinclude MatrixBase_cwiseSqrt.out 52 | * 53 | * \sa cwisePow(), cwiseSquare() 54 | */ 55 | inline const CwiseUnaryOp, const Derived> 56 | cwiseSqrt() const { return derived(); } 57 | 58 | /** \returns an expression of the coefficient-wise inverse of *this. 59 | * 60 | * Example: \include MatrixBase_cwiseInverse.cpp 61 | * Output: \verbinclude MatrixBase_cwiseInverse.out 62 | * 63 | * \sa cwiseProduct() 64 | */ 65 | inline const CwiseUnaryOp, const Derived> 66 | cwiseInverse() const { return derived(); } 67 | 68 | /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s 69 | * 70 | * \warning this performs an exact comparison, which is generally a bad idea with floating-point types. 71 | * In order to check for equality between two vectors or matrices with floating-point coefficients, it is 72 | * generally a far better idea to use a fuzzy comparison as provided by isApprox() and 73 | * isMuchSmallerThan(). 74 | * 75 | * \sa cwiseEqual(const MatrixBase &) const 76 | */ 77 | inline const CwiseUnaryOp >, const Derived> 78 | cwiseEqual(const Scalar& s) const 79 | { 80 | return CwiseUnaryOp >,const Derived> 81 | (derived(), std::bind1st(std::equal_to(), s)); 82 | } 83 | -------------------------------------------------------------------------------- /Eigen30.h: -------------------------------------------------------------------------------- 1 | #include "EigenAVR.h" 2 | -------------------------------------------------------------------------------- /EigenAVR.h: -------------------------------------------------------------------------------- 1 | 2 | // Force disabling alignment 3 | //#define EIGEN_DONT_ALIGN 4 | 5 | // Force skipping the IO module by pretending we already included it. 6 | //#define EIGEN_IO_H 7 | 8 | // Add an error define it expects 9 | //#define ENOMEM 12 10 | 11 | // Disable debug asserts. 12 | #define EIGEN_NO_DEBUG 1 13 | 14 | // No existing ABI, so don't bother aligning 15 | //#define EIGEN_MALLOC_ALREADY_ALIGNED 1 16 | 17 | // Hint to number of registers 18 | #define EIGEN_ARCH_DEFAULT_NUMBER_OF_REGISTERS 16 19 | 20 | #ifdef A0 21 | # define NEED_A0_RESTORED A0 22 | # undef A0 23 | #endif 24 | #ifdef A1 25 | # define NEED_A1_RESTORED A1 26 | # undef A1 27 | #endif 28 | #ifdef B0 29 | # define NEED_B0_RESTORED B0 30 | # undef B0 31 | #endif 32 | #ifdef B1 33 | # define NEED_B1_RESTORED B1 34 | # undef B1 35 | #endif 36 | 37 | namespace std { 38 | struct nothrow_t; 39 | } 40 | 41 | // Include Eigen's Core 42 | #include 43 | 44 | #ifdef NEED_A0_RESTORED 45 | # define A0 NEED_A0_RESTORED 46 | # undef NEED_A0_RESTORED 47 | #endif 48 | #ifdef NEED_A1_RESTORED 49 | # define A1 NEED_A1_RESTORED 50 | # undef NEED_A1_RESTORED 51 | #endif 52 | #ifdef NEED_B0_RESTORED 53 | # define B0 NEED_B0_RESTORED 54 | # undef NEED_B0_RESTORED 55 | #endif 56 | #ifdef NEED_B1_RESTORED 57 | # define B1 NEED_B1_RESTORED 58 | # undef NEED_B1_RESTORED 59 | #endif 60 | -------------------------------------------------------------------------------- /generate_restore_macros.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | VARS="A0 A1 B0 B1" 3 | 4 | for defname in $VARS; do 5 | cat <