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. \eigenAutoToc \section CompatibilitySupport Eigen2 compatibility support Up to version 3.2 %Eigen provides Eigen2 support modes. These are removed now, because they were barely used anymore and became hard to maintain after internal re-designs. You can still use them by first porting your code to Eigen 3.2. \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 |
Eigen 2 | Eigen 3 |
---|---|
\code std::vector |
\code std::vector |