From eb4095d41a3aba4cb843d25088dc6900f9abf2c5 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 25 Jun 2010 15:32:01 +0200 Subject: [PATCH] extend the eigen 2 to 3 guide --- doc/A05_PortingFrom2To3.dox | 140 ++++++++++++++++++++++++++---------- 1 file changed, 101 insertions(+), 39 deletions(-) diff --git a/doc/A05_PortingFrom2To3.dox b/doc/A05_PortingFrom2To3.dox index d1acb055f..783b99576 100644 --- a/doc/A05_PortingFrom2To3.dox +++ b/doc/A05_PortingFrom2To3.dox @@ -8,10 +8,10 @@ and to help porting an application from Eigen2 to Eigen3. \b Table \b of \b contents - \ref CompatibilitySupport - \ref VectorBlocks - - \ref TriangularViews + - \ref CoefficientWiseOperations + - \ref PartAndExtract - \ref TriangularSolveInPlace - \ref Using - - \ref CoefficientWiseOperations - \ref Corners - \ref LazyVsNoalias @@ -65,43 +65,6 @@ matrix.bottomRightCorner() Notice that Eigen3 also provides these new convenience methods: topRows(), bottomRows(), leftCols(), rightCols(). See in class DenseBase. - -\section TriangularViews Triangular views - -TODO: fill this section - -\section TriangularSolveInPlace Triangular in-place solving - - - - - - - -
Eigen 2Eigen 3
\code A.triangularSolveInPlace(X);\endcode\code A.triangularView().solveInPlace(X);\endcode
\code -UpperTriangular -LowerTriangular -UnitUpperTriangular -UnitLowerTriangular -StrictlyUpperTriangular -StrictlyLowerTriangular -\endcode\code -Upper -Lower -UnitUpper -UnitLower -StrictlyUpper -StrictlyLower -\endcode
- -\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 CoefficientWiseOperations Coefficient wise operations In Eigen2, coefficient wise operations which have no proper mathematical definition (as a coefficient wise product) @@ -128,6 +91,105 @@ With Eigen2 you would have written: c = (a.cwise().abs().cwise().pow(3)).cwise() * (b.cwise().abs().cwise().sin()); \endcode +\section PartAndExtract Triangular and self-adjoint matrices + +In Eigen 2 you had to play with the part, extract, and marked functions to deal with triangular and selfadjoint matrices. In Eigen 3, all these functions have been removed in favor of the concept of \em views: + + + + + + + + + + + + + + + +
Eigen 2Eigen 3
\code +A.part(); +A.part(); \endcode\code +A.triangularView() +A.triangularView()\endcode
\code +A.extract(); +A.extract();\endcode\code +A.triangularView() +A.triangularView()\endcode
\code +A.marked(); +A.marked();\endcode\code +A.triangularView() +A.triangularView()\endcode
\code +A.part(); +A.extract();\endcode\code +A.selfadjointView() +A.selfadjointView()\endcode
\code +UpperTriangular +LowerTriangular +UnitUpperTriangular +UnitLowerTriangular +StrictlyUpperTriangular +StrictlyLowerTriangular +\endcode\code +Upper +Lower +UnitUpper +UnitLower +StrictlyUpper +StrictlyLower +\endcode
+ +\sa class TriangularView, class SelfAdjointView + +\section TriangularSolveInPlace Triangular in-place solving + + + + +
Eigen 2Eigen 3
\code A.triangularSolveInPlace(Y);\endcode\code A.triangularView().solveInPlace(Y);\endcode
+ +\section LinearSolvers Linear solvers + + + + + + + + + + + + + + + + + + +
Eigen 2Eigen 3Notes
\code A.lu();\endcode\code A.fullPivLu();\endcodeNow A.lu() returns a PartialPivLU
\code A.lu().solve(B,&X);\endcode\code X = A.lu().solve(B); + X = A.fullPivLu().solve(B);\endcodeThe returned by value is fully optimized
\code A.llt().solve(B,&X);\endcode\code X = A.llt().solve(B); + X = A.selfadjointView.llt().solve(B); + X = A.selfadjointView.llt().solve(B);\endcodeThe 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.llt().solve(B); + B = A.selfadjointView.llt().solve(B);\endcodeIn place solving
\code A.ldlt().solve(B,&X);\endcode\code X = A.ldlt().solve(B); + X = A.selfadjointView.ldlt().solve(B); + X = A.selfadjointView.ldlt().solve(B);\endcodeThe returned by value is fully optimized and \n +the selfadjointView API allows you to select the \n +triangular part to work on
+ +\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 LazyVsNoalias Lazy evaluation and noalias In Eigen all operations are performed in a lazy fashion except the matrix products which are always evaluated into a temporary by default.