IDEs

From Eigen
Jump to: navigation, search

Some workarounds and hacks might be useful for IDEs in order to use Eigen in an optimal way. This page is meant to collect them, to help newcomers.

Eclipse CDT

Paths

Apart from "Organize includes" (see the section below), everything works out of the box. For example, if Eigen is installed in /usr/include/eigen3 and this path is added to the Project Properties > C/C++ General > Paths & Symbols > Includes > GNU C++, you only need to add includes of the form
#include <Eigen/Dense>
as used in Eigen's documentation.

Organizing includes

This handy feature of Eclipse (Ctrl+Shift+O) does not work out of the box for Eigen. Eclipse tries to include by default the .h files of the library but those are not sufficient to build the project correctly. As done by default by Eclipse for the stdlib, substitution rules need to be used in order for Eclipse to automatically handle includes correctly.

Go to Preferences > C/C++ > Coding Style > Organize Includes > Header Substitution. There you can add a new rule, and import the following xml file:

eigen-header-substitution.xml:

<?xml version="1.0" encoding="UTF-8"?>
<header_substitution_map cpp_only="false" name="Eigen Header Substitution">
<unconditional_substitution_map>
<mapping key="&lt;Eigen/src/Cholesky/LDLT.h&gt;" value="&lt;Eigen/Cholesky&gt;"/>
<mapping key="&lt;Eigen/src/Cholesky/LLT.h&gt;" value="&lt;Eigen/Cholesky&gt;"/>
<mapping key="&lt;Eigen/src/Cholesky/LLT_MKL.h&gt;" value="&lt;Eigen/Cholesky&gt;"/>
<mapping key="&lt;Eigen/src/CholmodSupport/CholmodSupport.h&gt;" value="&lt;Eigen/CholmodSupport&gt;"/>
<mapping key="&lt;Eigen/src/Core/Array.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/ArrayBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/ArrayWrapper.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Assign.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Assign_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/BandMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Block.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/BooleanRedux.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/CommaInitializer.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/CoreIterators.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/CwiseBinaryOp.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/CwiseNullaryOp.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/CwiseUnaryOp.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/CwiseUnaryView.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/DenseBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/DenseCoeffsBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/DenseStorage.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Diagonal.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/DiagonalMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/DiagonalProduct.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Dot.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/EigenBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Flagged.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/ForceAlignedAccess.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Functors.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Fuzzy.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/GeneralProduct.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/GenericPacketMath.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/GlobalFunctions.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/IO.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Map.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/MapBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/MathFunctions.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Matrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/MatrixBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/NestByValue.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/NoAlias.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/NumTraits.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/PermutationMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/PlainObjectBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/ProductBase.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Random.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Redux.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Ref.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Replicate.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/ReturnByValue.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Reverse.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Select.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/SelfAdjointView.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/SelfCwiseBinaryOp.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/SolveTriangular.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/StableNorm.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Stride.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Swap.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Transpose.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Transpositions.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/TriangularMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/VectorBlock.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/VectorwiseOp.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/Visitor.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/AltiVec/Complex.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/AltiVec/PacketMath.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/Default/Settings.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/NEON/Complex.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/NEON/PacketMath.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/SSE/Complex.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/SSE/MathFunctions.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/arch/SSE/PacketMath.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/CoeffBasedProduct.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralBlockPanelKernel.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralMatrixMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralMatrixMatrix_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralMatrixMatrixTriangular.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralMatrixMatrixTriangular_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralMatrixVector.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/GeneralMatrixVector_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/Parallelizer.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/SelfadjointMatrixMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/SelfadjointMatrixMatrix_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/SelfadjointMatrixVector.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/SelfadjointMatrixVector_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/SelfadjointProduct.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/SelfadjointRank2Update.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularMatrixMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularMatrixMatrix_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularMatrixVector.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularMatrixVector_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularSolverMatrix.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularSolverMatrix_MKL.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/products/TriangularSolverVector.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/BlasUtil.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/Constants.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/DisableStupidWarnings.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/ForwardDeclarations.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/Macros.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/Memory.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/Meta.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/MKL_support.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/NonMPL2.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/ReenableStupidWarnings.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/StaticAssert.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Core/util/XprHelper.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Block.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Cwise.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/CwiseOperators.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Lazy.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/LeastSquares.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/LU.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Macros.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/MathFunctions.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Memory.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Meta.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Minor.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/QR.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/SVD.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/TriangularSolver.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/VectorBlock.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/AlignedBox.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/All.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/AngleAxis.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/Hyperplane.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/ParametrizedLine.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/Quaternion.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/Rotation2D.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/RotationBase.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/Scaling.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/Transform.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigen2Support/Geometry/Translation.h&gt;" value="&lt;Eigen/Eigen2Support&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/ComplexEigenSolver.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/ComplexSchur.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/ComplexSchur_MKL.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/EigenSolver.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/GeneralizedEigenSolver.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/HessenbergDecomposition.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/MatrixBaseEigenvalues.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/RealQZ.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/RealSchur.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/RealSchur_MKL.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/SelfAdjointEigenSolver.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/SelfAdjointEigenSolver_MKL.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Eigenvalues/Tridiagonalization.h&gt;" value="&lt;Eigen/Eigenvalues&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/AlignedBox.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/AngleAxis.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/EulerAngles.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Homogeneous.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Hyperplane.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/OrthoMethods.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/ParametrizedLine.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Quaternion.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Rotation2D.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/RotationBase.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Scaling.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Transform.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Translation.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/Umeyama.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Geometry/arch/Geometry_SSE.h&gt;" value="&lt;Eigen/Geometry&gt;"/>
<mapping key="&lt;Eigen/src/Householder/BlockHouseholder.h&gt;" value="&lt;Eigen/Householder&gt;"/>
<mapping key="&lt;Eigen/src/Householder/Householder.h&gt;" value="&lt;Eigen/Householder&gt;"/>
<mapping key="&lt;Eigen/src/Householder/HouseholderSequence.h&gt;" value="&lt;Eigen/Householder&gt;"/>
<mapping key="&lt;Eigen/src/IterativeLinearSolvers/BasicPreconditioners.h&gt;" value="&lt;Eigen/IterativeLinearSolvers&gt;"/>
<mapping key="&lt;Eigen/src/IterativeLinearSolvers/BiCGSTAB.h&gt;" value="&lt;Eigen/IterativeLinearSolvers&gt;"/>
<mapping key="&lt;Eigen/src/IterativeLinearSolvers/ConjugateGradient.h&gt;" value="&lt;Eigen/IterativeLinearSolvers&gt;"/>
<mapping key="&lt;Eigen/src/IterativeLinearSolvers/IncompleteLUT.h&gt;" value="&lt;Eigen/IterativeLinearSolvers&gt;"/>
<mapping key="&lt;Eigen/src/IterativeLinearSolvers/IterativeSolverBase.h&gt;" value="&lt;Eigen/IterativeLinearSolvers&gt;"/>
<mapping key="&lt;Eigen/src/Jacobi/Jacobi.h&gt;" value="&lt;Eigen/Jacobi&gt;"/>
<mapping key="&lt;Eigen/src/LU/Determinant.h&gt;" value="&lt;Eigen/LU&gt;"/>
<mapping key="&lt;Eigen/src/LU/FullPivLU.h&gt;" value="&lt;Eigen/LU&gt;"/>
<mapping key="&lt;Eigen/src/LU/Inverse.h&gt;" value="&lt;Eigen/LU&gt;"/>
<mapping key="&lt;Eigen/src/LU/PartialPivLU.h&gt;" value="&lt;Eigen/LU&gt;"/>
<mapping key="&lt;Eigen/src/LU/PartialPivLU_MKL.h&gt;" value="&lt;Eigen/LU&gt;"/>
<mapping key="&lt;Eigen/src/LU/arch/Inverse_SSE.h&gt;" value="&lt;Eigen/LU&gt;"/>
<mapping key="&lt;Eigen/src/MetisSupport/MetisSupport.h&gt;" value="&lt;Eigen/MetisSupport&gt;"/>
<mapping key="&lt;Eigen/src/misc/blas.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/misc/Image.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/misc/Kernel.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/misc/Solve.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/misc/SparseSolve.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/OrderingMethods/Amd.h&gt;" value="&lt;Eigen/OrderingMethods&gt;"/>
<mapping key="&lt;Eigen/src/OrderingMethods/Eigen_Colamd.h&gt;" value="&lt;Eigen/OrderingMethods&gt;"/>
<mapping key="&lt;Eigen/src/OrderingMethods/Ordering.h&gt;" value="&lt;Eigen/OrderingMethods&gt;"/>
<mapping key="&lt;Eigen/src/PardisoSupport/PardisoSupport.h&gt;" value="&lt;Eigen/PardisoSupport&gt;"/>
<mapping key="&lt;Eigen/src/PaStiXSupport/PaStiXSupport.h&gt;" value="&lt;Eigen/PaStiXSupport&gt;"/>
<mapping key="&lt;Eigen/src/plugins/ArrayCwiseBinaryOps.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/plugins/ArrayCwiseUnaryOps.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/plugins/BlockMethods.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/plugins/CommonCwiseBinaryOps.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/plugins/CommonCwiseUnaryOps.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/plugins/MatrixCwiseBinaryOps.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/plugins/MatrixCwiseUnaryOps.h&gt;" value="&lt;Eigen/Core&gt;"/>
<mapping key="&lt;Eigen/src/QR/ColPivHouseholderQR.h&gt;" value="&lt;Eigen/QR&gt;"/>
<mapping key="&lt;Eigen/src/QR/ColPivHouseholderQR_MKL.h&gt;" value="&lt;Eigen/QR&gt;"/>
<mapping key="&lt;Eigen/src/QR/FullPivHouseholderQR.h&gt;" value="&lt;Eigen/QR&gt;"/>
<mapping key="&lt;Eigen/src/QR/HouseholderQR.h&gt;" value="&lt;Eigen/QR&gt;"/>
<mapping key="&lt;Eigen/src/QR/HouseholderQR_MKL.h&gt;" value="&lt;Eigen/QR&gt;"/>
<mapping key="&lt;Eigen/src/SparseCholesky/SimplicialCholesky.h&gt;" value="&lt;Eigen/SparseCholesky&gt;"/>
<mapping key="&lt;Eigen/src/SparseCholesky/SimplicialCholesky_impl.h&gt;" value="&lt;Eigen/SparseCholesky&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/AmbiVector.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/CompressedStorage.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/ConservativeSparseSparseProduct.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/MappedSparseMatrix.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseBlock.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseColEtree.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseCwiseBinaryOp.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseCwiseUnaryOp.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseDenseProduct.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseDiagonalProduct.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseDot.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseFuzzy.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseMatrix.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseMatrixBase.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparsePermutation.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseProduct.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseRedux.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseSelfAdjointView.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseSparseProductWithPruning.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseTranspose.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseTriangularView.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseUtil.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseVector.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/SparseView.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseCore/TriangularSolver.h&gt;" value="&lt;Eigen/SparseCore&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_column_bmod.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_column_dfs.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_copy_to_ucol.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_gemm_kernel.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_heap_relax_snode.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_kernel_bmod.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_Memory.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_panel_bmod.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_panel_dfs.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_pivotL.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_pruneL.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_relax_snode.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_Structs.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_SupernodalMatrix.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLU_Utils.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseLU/SparseLUImpl.h&gt;" value="&lt;Eigen/SparseLU&gt;"/>
<mapping key="&lt;Eigen/src/SparseQR/SparseQR.h&gt;" value="&lt;Eigen/SparseQR&gt;"/>
<mapping key="&lt;Eigen/src/SPQRSupport/SuiteSparseQRSupport.h&gt;" value="&lt;Eigen/SPQRSupport&gt;"/>
<mapping key="&lt;Eigen/src/StlSupport/details.h&gt;" value="&lt;Eigen/StdDeque&gt;"/>
<mapping key="&lt;Eigen/src/StlSupport/StdDeque.h&gt;" value="&lt;Eigen/StdDeque&gt;"/>
<mapping key="&lt;Eigen/src/StlSupport/StdList.h&gt;" value="&lt;Eigen/StdList&gt;"/>
<mapping key="&lt;Eigen/src/StlSupport/StdVector.h&gt;" value="&lt;Eigen/StdVector&gt;"/>
<mapping key="&lt;Eigen/src/SuperLUSupport/SuperLUSupport.h&gt;" value="&lt;Eigen/SuperLUSupport&gt;"/>
<mapping key="&lt;Eigen/src/SVD/JacobiSVD.h&gt;" value="&lt;Eigen/SVD&gt;"/>
<mapping key="&lt;Eigen/src/SVD/JacobiSVD_MKL.h&gt;" value="&lt;Eigen/SVD&gt;"/>
<mapping key="&lt;Eigen/src/SVD/UpperBidiagonalization.h&gt;" value="&lt;Eigen/SVD&gt;"/>
<mapping key="&lt;Eigen/src/UmfPackSupport/UmfPackSupport.h&gt;" value="&lt;Eigen/UmfPackSupport&gt;"/>
</unconditional_substitution_map>
<optional_substitution_map/>
</header_substitution_map>

This file is useful in the case where the path of Eigen (for example /usr/include/eigen3) is defined as above. If not, the file needs to be adapted accordingly.

In case the Eigen architecture changes and the previous file is not up to date, you can use the following Python3 script (and adapt it with your own Eigen's path if different) to generate a new one:

generate-eigen-header-substitution.py:

import os
from os.path import join
 
Eigen_path = "/usr/include/eigen3"
src_path = join(Eigen_path,"Eigen/src")
 
xml_file = open("generated_substitution_list.xml",'w')
xml_file.write('<?xml version="1.0" encoding="UTF-8"?>\n')
xml_file.write('<header_substitution_map cpp_only="false" name="Eigen Header Substitution">\n')
xml_file.write('<unconditional_substitution_map>\n')
 
for header_dir in sorted(os.listdir(src_path),key=lambda c: c.lower()):
    if (header_dir=="plugins" or header_dir=="misc"):
        header_name = 'Core'
    else:
        header_name = header_dir
    for root, dirs, files in os.walk(join(src_path, header_dir)):
        dirs.sort(key=lambda c: c.lower())
        files.sort(key=lambda c: c.lower())
        for header in files:
            if header.endswith(".h"):
                if (header_dir == "StlSupport"):
                    if (header == "details.h"):
                        header_name = 'StdDeque'
                    else:
                        header_name = header.replace('.h','')
                xml_file.write('<mapping key="&lt;Eigen/src')
                xml_file.write(root.replace(src_path,''))
                xml_file.write('/')
                xml_file.write(header)
                xml_file.write('&gt;" value="&lt;Eigen/')
                xml_file.write(header_name)
                xml_file.write('&gt;"/>\n')
 
xml_file.write('</unconditional_substitution_map>\n')
xml_file.write('<optional_substitution_map/>\n')
xml_file.write('</header_substitution_map>')
 
xml_file.close()


Visual Studio

Here are some step-for-step procedures for using Eigen with Microsoft Visual Studio. This page is written using the 2010 Express version by somebody who is not familiar with Visual Studio, so feel free to correct and improve!

Compiling a simple Eigen program

  1. First you need to download Eigen. Using the TortoiseHg Workbench, select Clone Repository in the File menu, and use the URL https://bitbucket.org/eigen/eigen/ as source. Alternatively, download and unpack the zip file. I will denote by EIGENDIR the folder in which you store the Eigen library; this folder contains other folders like bench, blas, cmake and Eigen.
  2. In Visual Studio, make a new project (File | New | Project) using the Empty Project template.
  3. Add a C++ file to the project (Project | Add New Item, choose the C++ File template).
  4. Write your program in the file. For instance, copy and paste the first program at the Getting Started guide. To prevent the console window from closing immediately after the program finishes, add something like "std::cin.get();" at the end.
  5. Open the project properties page (Project | Properties), in the C/C++ folder open the General page, and after Additional Include Directories put EIGENDIR (the folder in which you store the Eigen library).
  6. Compile the program (Debug | Build Solution, or press F7).
  7. Run the program (Debug | Start debugging, or press F5).

Configuring your project for optimal performance

  1. Open the project properties page (Project | Properties), in the C/C++ folder open the Code Generation page. Under Enable Enhanced Instruction Set, switch to Streaming SIMD Extensions 2 (/arch:SSE2)
  2. Open the project properties page (Project | Properties), in the C/C++ folder open the Language page. Under Open MP Support, switch to Yes (/openmp).
  3. In case you are on a 64 bit machine, open the configuration manager (Project | Properties | Configuration Manager...). From here, select <New...> under Active solution platform:. Next, choose x64 and confirm the dialog with OK. Once you are back in the main window, switch from Win32 to x64 in order to create 64 bit builds of your program.

Compiling the tests with CMake

  1. Start CMake (cmake-gui).
  2. Fill in where to find the source (the EIGENDIR folder) and where to build the binaries (e.g., EIGENDIR/build).
  3. Press Configure and Generate.
  4. Start Visual Studio and open the Eigen solution in the build directory. This takes several minutes.
  5. All tests are displayed as projects in the solution and can thus be built and run individually.