namespace Eigen { /** \page Eigen2ToEigen3 Porting from Eigen2 to Eigen3 This page lists the most important API changes between Eigen2 and Eigen3, and gives tips to help porting your application from Eigen2 to Eigen3. \b Table \b of \b contents - \ref CompatibilitySupport - \ref Using - \ref ComplexDot - \ref VectorBlocks - \ref Corners - \ref CoefficientWiseOperations - \ref PartAndExtract - \ref TriangularSolveInPlace - \ref Decompositions - \ref LinearSolvers - \ref GeometryModule - \ref Transform - \ref LazyVsNoalias - \ref AlignMacros - \ref AlignedMap - \ref eiPrefix \section CompatibilitySupport Eigen2 compatibility support In order to ease the switch from Eigen2 to Eigen3, Eigen3 features \ref Eigen2SupportModes "Eigen2 support modes". The quick way to enable this is to define the \c EIGEN2_SUPPORT preprocessor token \b before including any Eigen header (typically it should be set in your project options). A more powerful, \em staged migration path is also provided, which may be useful to migrate larger projects from Eigen2 to Eigen3. This is explained in the \ref Eigen2SupportModes "Eigen 2 support modes" page. \section Using The USING_PART_OF_NAMESPACE_EIGEN macro The USING_PART_OF_NAMESPACE_EIGEN macro has been removed. In Eigen 3, just do: \code using namespace Eigen; \endcode \section ComplexDot Dot products over complex numbers This is the single trickiest change between Eigen 2 and Eigen 3. It only affects code using \c std::complex numbers as scalar type. Eigen 2's dot product was linear in the first variable. Eigen 3's dot product is linear in the second variable. In other words, the Eigen 2 code \code x.dot(y) \endcode is equivalent to the Eigen 3 code \code y.dot(x) \endcode In yet other words, dot products are complex-conjugated in Eigen 3 compared to Eigen 2. The switch to the new convention was commanded by common usage, especially with the notation \f$ x^Ty \f$ for dot products of column-vectors. \section VectorBlocks Vector blocks
Eigen 2 | Eigen 3 |
---|---|
\code
vector.start(length)
vector.start | \code
vector.head(length)
vector.head |
Eigen 2 | Eigen 3 |
---|---|
\code
matrix.corner(TopLeft,r,c)
matrix.corner(TopRight,r,c)
matrix.corner(BottomLeft,r,c)
matrix.corner(BottomRight,r,c)
matrix.corner | \code
matrix.topLeftCorner(r,c)
matrix.topRightCorner(r,c)
matrix.bottomLeftCorner(r,c)
matrix.bottomRightCorner(r,c)
matrix.topLeftCorner |
Eigen 2 | Eigen 3 |
---|---|
\code
A.part |
\code
A.triangularView |
\code
A.extract |
\code
A.triangularView |
\code
A.marked |
\code
A.triangularView |
\code
A.part |
\code
A.selfadjointView |
\code UpperTriangular LowerTriangular UnitUpperTriangular UnitLowerTriangular StrictlyUpperTriangular StrictlyLowerTriangular \endcode | \code Upper Lower UnitUpper UnitLower StrictlyUpper StrictlyLower \endcode |
Eigen 2 | Eigen 3 |
---|---|
\code A.triangularSolveInPlace | \code A.triangularView |
Eigen 2 | Eigen 3 | Notes |
---|---|---|
LU | FullPivLU | See also the new PartialPivLU, it's much faster |
QR | HouseholderQR | See also the new ColPivHouseholderQR, it's more reliable |
SVD | JacobiSVD | We currently don't have a bidiagonalizing SVD; of course this is planned. |
EigenSolver and friends | \code #include |
Moved to separate module |
Eigen 2 | Eigen 3 | Notes |
---|---|---|
\code A.lu();\endcode | \code A.fullPivLu();\endcode | Now A.lu() returns a PartialPivLU |
\code A.lu().solve(B,&X);\endcode | \code X = A.lu().solve(B); X = A.fullPivLu().solve(B);\endcode | The returned by value is fully optimized |
\code A.llt().solve(B,&X);\endcode | \code X = A.llt().solve(B);
X = A.selfadjointView |
The returned by value is fully optimized and \n the selfadjointView API allows you to select the \n triangular part to work on (default is lower part) |
\code A.llt().solveInPlace(B);\endcode | \code B = A.llt().solve(B);
B = A.selfadjointView |
In place solving |
\code A.ldlt().solve(B,&X);\endcode | \code X = A.ldlt().solve(B);
X = A.selfadjointView |
The returned by value is fully optimized and \n the selfadjointView API allows you to select the \n triangular part to work on |
Eigen 2 | Eigen 3 | Notes |
---|---|---|
Transform3f | Affine3f or Projective3f | Of course 3f is just an example here |