From abbe260905e96b9323cb5cf4ab9189a3292bf585 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 22 Apr 2010 18:27:13 -0400 Subject: remove USING_PART_OF_NAMESPACE_EIGEN, leaving it in Eigen2Support. improve porting-Eigen2-to-3 docs --- doc/A05_PortingFrom2To3.dox | 114 ++++++++++++--------- doc/example.cpp | 26 ----- .../Tutorial_simple_example_dynamic_size.cpp | 3 +- .../Tutorial_simple_example_fixed_size.cpp | 3 +- doc/examples/class_Block.cpp | 2 +- doc/examples/class_CwiseBinaryOp.cpp | 2 +- doc/examples/class_CwiseUnaryOp.cpp | 2 +- doc/examples/class_FixedBlock.cpp | 2 +- doc/examples/class_FixedVectorBlock.cpp | 2 +- doc/examples/class_VectorBlock.cpp | 2 +- 10 files changed, 74 insertions(+), 84 deletions(-) delete mode 100644 doc/example.cpp (limited to 'doc') diff --git a/doc/A05_PortingFrom2To3.dox b/doc/A05_PortingFrom2To3.dox index 554ca7f2c..d1acb055f 100644 --- a/doc/A05_PortingFrom2To3.dox +++ b/doc/A05_PortingFrom2To3.dox @@ -7,36 +7,74 @@ and to help porting an application from Eigen2 to Eigen3. \b Table \b of \b contents - \ref CompatibilitySupport - - \ref ChangeList + - \ref VectorBlocks + - \ref TriangularViews + - \ref TriangularSolveInPlace + - \ref Using - \ref CoefficientWiseOperations - \ref Corners - \ref LazyVsNoalias \section CompatibilitySupport Eigen2 compatibility support -In order to ease the switch from Eigen2 to Eigen3, Eigen3 features a compatibility mode which can be enabled by defining the EIGEN2_SUPPORT preprocessor token \b before including any Eigen's header (typically it should be set in your project options). +In order to ease the switch from Eigen2 to Eigen3, Eigen3 features a compatibility mode which can be enabled by defining the EIGEN2_SUPPORT preprocessor token \b before including any Eigen header (typically it should be set in your project options). -\section ChangeList List of changes in the API +\section VectorBlocks Vector blocks - + - - - - - - +vector.head(length) +vector.head() +vector.tail(length) +vector.tail() +\endcode +
Eigen 2Eigen 3Comments
Eigen 2Eigen 3
\code -vec.start(length) -vec.start() -vec.end(length) -vec.end() +vector.start(length) +vector.start() +vector.end(length) +vector.end() \endcode\code -vec.head(length) -vec.head() -vec.tail(length) -vec.tail() -\endcodeTrivial "search and replace".
\code mat.cwise().XXX()\endcode\code mat.array().XXX()\endcodeSee \ref CoefficientWiseOperations.
\code c = (a * b).lazy();\endcode\code c.noalias() = a * b;\endcodeSee \ref LazyVsNoalias.
\code A.triangularSolveInPlace(X);\endcode\code A.triangularView().solveInPlace(X);\endcode
+ + +\section Corners Matrix Corners + + + + + +
Eigen 2Eigen 3
\code +matrix.corner(TopLeft,r,c) +matrix.corner(TopRight,r,c) +matrix.corner(BottomLeft,r,c) +matrix.corner(BottomRight,r,c) +matrix.corner(TopLeft) +matrix.corner(TopRight) +matrix.corner(BottomLeft) +matrix.corner(BottomRight) +\endcode\code +matrix.topLeftCorner(r,c) +matrix.topRightCorner(r,c) +matrix.bottomLeftCorner(r,c) +matrix.bottomRightCorner(r,c) +matrix.topLeftCorner() +matrix.topRightCorner() +matrix.bottomLeftCorner() +matrix.bottomRightCorner() +\endcode
+ +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 @@ -53,9 +91,17 @@ UnitLower StrictlyUpper StrictlyLower \endcodeTrivial "search and replace".
+\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) @@ -82,34 +128,6 @@ With Eigen2 you would have written: c = (a.cwise().abs().cwise().pow(3)).cwise() * (b.cwise().abs().cwise().sin()); \endcode -\section Corners Corners - - - - - -
Eigen 2Eigen 3
\code -matrix.corner(TopLeft,r,c) -matrix.corner(TopRight,r,c) -matrix.corner(BottomLeft,r,c) -matrix.corner(BottomRight,r,c) -matrix.corner(TopLeft) -matrix.corner(TopRight) -matrix.corner(BottomLeft) -matrix.corner(BottomRight) -\endcode\code -matrix.topLeftCorner(r,c) -matrix.topRightCorner(r,c) -matrix.bottomLeftCorner(r,c) -matrix.bottomRightCorner(r,c) -matrix.topLeftCorner() -matrix.topRightCorner() -matrix.bottomLeftCorner() -matrix.bottomRightCorner() -\endcode
- -Notice that Eigen3 also provides these new convenience methods: topRows(), bottomRows(), leftCols(), rightCols(). See in class DenseBase. - \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. diff --git a/doc/example.cpp b/doc/example.cpp deleted file mode 100644 index 23893488a..000000000 --- a/doc/example.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -USING_PART_OF_NAMESPACE_EIGEN - -using namespace std; - -template -void foo(const MatrixBase& m) -{ - cout << "Here's m:" << endl << m << endl; -} - -template -Eigen::ScalarMultiple -twice(const MatrixBase& m) -{ - return 2 * m; -} - -int main(int, char**) -{ - Matrix2d m = Matrix2d::random(); - foo(m); - foo(twice(m)); - return 0; -} diff --git a/doc/examples/Tutorial_simple_example_dynamic_size.cpp b/doc/examples/Tutorial_simple_example_dynamic_size.cpp index 9a0e2c3d8..d780e7326 100644 --- a/doc/examples/Tutorial_simple_example_dynamic_size.cpp +++ b/doc/examples/Tutorial_simple_example_dynamic_size.cpp @@ -1,8 +1,7 @@ #include #include -// import most common Eigen types -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; int main(int, char *[]) { diff --git a/doc/examples/Tutorial_simple_example_fixed_size.cpp b/doc/examples/Tutorial_simple_example_fixed_size.cpp index 586be863d..a5c856732 100644 --- a/doc/examples/Tutorial_simple_example_fixed_size.cpp +++ b/doc/examples/Tutorial_simple_example_fixed_size.cpp @@ -1,8 +1,7 @@ #include #include -// import most common Eigen types -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; int main(int, char *[]) { diff --git a/doc/examples/class_Block.cpp b/doc/examples/class_Block.cpp index a8e0c85a1..c6144cef5 100644 --- a/doc/examples/class_Block.cpp +++ b/doc/examples/class_Block.cpp @@ -1,6 +1,6 @@ #include #include -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template diff --git a/doc/examples/class_CwiseBinaryOp.cpp b/doc/examples/class_CwiseBinaryOp.cpp index d26e65f23..682af46de 100644 --- a/doc/examples/class_CwiseBinaryOp.cpp +++ b/doc/examples/class_CwiseBinaryOp.cpp @@ -1,6 +1,6 @@ #include #include -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; // define a custom template binary functor diff --git a/doc/examples/class_CwiseUnaryOp.cpp b/doc/examples/class_CwiseUnaryOp.cpp index 9e22bf095..a5fcc153d 100644 --- a/doc/examples/class_CwiseUnaryOp.cpp +++ b/doc/examples/class_CwiseUnaryOp.cpp @@ -1,6 +1,6 @@ #include #include -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; // define a custom template unary functor diff --git a/doc/examples/class_FixedBlock.cpp b/doc/examples/class_FixedBlock.cpp index 3961119e1..5e0e53da3 100644 --- a/doc/examples/class_FixedBlock.cpp +++ b/doc/examples/class_FixedBlock.cpp @@ -1,6 +1,6 @@ #include #include -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template diff --git a/doc/examples/class_FixedVectorBlock.cpp b/doc/examples/class_FixedVectorBlock.cpp index 917d465ab..9be7d8d71 100644 --- a/doc/examples/class_FixedVectorBlock.cpp +++ b/doc/examples/class_FixedVectorBlock.cpp @@ -1,6 +1,6 @@ #include #include -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template diff --git a/doc/examples/class_VectorBlock.cpp b/doc/examples/class_VectorBlock.cpp index 2848bc1ea..2f02c8f69 100644 --- a/doc/examples/class_VectorBlock.cpp +++ b/doc/examples/class_VectorBlock.cpp @@ -1,6 +1,6 @@ #include #include -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template -- cgit v1.2.3