diff options
-rw-r--r-- | Eigen/Eigen2Support | 16 | ||||
-rw-r--r-- | Eigen/src/Core/util/Macros.h | 16 | ||||
-rw-r--r-- | bench/BenchSparseUtil.h | 2 | ||||
-rw-r--r-- | bench/BenchUtil.h | 2 | ||||
-rw-r--r-- | bench/bench_sum.cpp | 2 | ||||
-rw-r--r-- | bench/benchmark.cpp | 2 | ||||
-rw-r--r-- | bench/benchmarkSlice.cpp | 2 | ||||
-rw-r--r-- | bench/benchmarkX.cpp | 2 | ||||
-rw-r--r-- | bench/benchmarkXcwise.cpp | 2 | ||||
-rw-r--r-- | bench/vdw_new.cpp | 2 | ||||
-rw-r--r-- | disabled/class_Eval.cpp | 2 | ||||
-rw-r--r-- | disabled/ompbenchmark.cpp | 2 | ||||
-rw-r--r-- | doc/A05_PortingFrom2To3.dox | 114 | ||||
-rw-r--r-- | doc/example.cpp | 26 | ||||
-rw-r--r-- | doc/examples/Tutorial_simple_example_dynamic_size.cpp | 3 | ||||
-rw-r--r-- | doc/examples/Tutorial_simple_example_fixed_size.cpp | 3 | ||||
-rw-r--r-- | doc/examples/class_Block.cpp | 2 | ||||
-rw-r--r-- | doc/examples/class_CwiseBinaryOp.cpp | 2 | ||||
-rw-r--r-- | doc/examples/class_CwiseUnaryOp.cpp | 2 | ||||
-rw-r--r-- | doc/examples/class_FixedBlock.cpp | 2 | ||||
-rw-r--r-- | doc/examples/class_FixedVectorBlock.cpp | 2 | ||||
-rw-r--r-- | doc/examples/class_VectorBlock.cpp | 2 |
22 files changed, 100 insertions, 110 deletions
diff --git a/Eigen/Eigen2Support b/Eigen/Eigen2Support index 075985af1..b876cc4c3 100644 --- a/Eigen/Eigen2Support +++ b/Eigen/Eigen2Support @@ -58,4 +58,20 @@ namespace Eigen { // Eigen2 used to include iostream #include<iostream> +#define USING_PART_OF_NAMESPACE_EIGEN \ +EIGEN_USING_MATRIX_TYPEDEFS \ +using Eigen::Matrix; \ +using Eigen::MatrixBase; \ +using Eigen::ei_random; \ +using Eigen::ei_real; \ +using Eigen::ei_imag; \ +using Eigen::ei_conj; \ +using Eigen::ei_abs; \ +using Eigen::ei_abs2; \ +using Eigen::ei_sqrt; \ +using Eigen::ei_exp; \ +using Eigen::ei_log; \ +using Eigen::ei_sin; \ +using Eigen::ei_cos; + #endif // EIGEN2SUPPORT_H diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 73e733cb3..787182444 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -105,22 +105,6 @@ #define EIGEN_DEBUG_VAR(x) std::cerr << #x << " = " << x << std::endl; -#define USING_PART_OF_NAMESPACE_EIGEN \ -EIGEN_USING_MATRIX_TYPEDEFS \ -using Eigen::Matrix; \ -using Eigen::MatrixBase; \ -using Eigen::ei_random; \ -using Eigen::ei_real; \ -using Eigen::ei_imag; \ -using Eigen::ei_conj; \ -using Eigen::ei_abs; \ -using Eigen::ei_abs2; \ -using Eigen::ei_sqrt; \ -using Eigen::ei_exp; \ -using Eigen::ei_log; \ -using Eigen::ei_sin; \ -using Eigen::ei_cos; - #ifdef NDEBUG # ifndef EIGEN_NO_DEBUG # define EIGEN_NO_DEBUG diff --git a/bench/BenchSparseUtil.h b/bench/BenchSparseUtil.h index a5ab10711..82c3b8701 100644 --- a/bench/BenchSparseUtil.h +++ b/bench/BenchSparseUtil.h @@ -6,7 +6,7 @@ using namespace std; using namespace Eigen; -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #ifndef SIZE #define SIZE 1024 diff --git a/bench/BenchUtil.h b/bench/BenchUtil.h index a7535771e..9798fa385 100644 --- a/bench/BenchUtil.h +++ b/bench/BenchUtil.h @@ -6,7 +6,7 @@ #include "BenchTimer.h" using namespace std; -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition.hpp> diff --git a/bench/bench_sum.cpp b/bench/bench_sum.cpp index 82bae80c3..0e16a8eea 100644 --- a/bench/bench_sum.cpp +++ b/bench/bench_sum.cpp @@ -1,5 +1,5 @@ #include <Eigen/Core> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; int main() diff --git a/bench/benchmark.cpp b/bench/benchmark.cpp index 90e04dd3b..971de4961 100644 --- a/bench/benchmark.cpp +++ b/bench/benchmark.cpp @@ -6,7 +6,7 @@ #endif using namespace std; -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #ifndef REPEAT #define REPEAT 40000000 diff --git a/bench/benchmarkSlice.cpp b/bench/benchmarkSlice.cpp index 5595d0ae6..8c3d4dd10 100644 --- a/bench/benchmarkSlice.cpp +++ b/bench/benchmarkSlice.cpp @@ -3,7 +3,7 @@ #include <Eigen/Array> using namespace std; -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #ifndef REPEAT #define REPEAT 10000 diff --git a/bench/benchmarkX.cpp b/bench/benchmarkX.cpp index 18152e9e3..89452b435 100644 --- a/bench/benchmarkX.cpp +++ b/bench/benchmarkX.cpp @@ -2,7 +2,7 @@ #include <Eigen/Core> using namespace std; -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #ifndef MATTYPE #define MATTYPE MatrixXLd diff --git a/bench/benchmarkXcwise.cpp b/bench/benchmarkXcwise.cpp index bc9b8e716..6a487b409 100644 --- a/bench/benchmarkXcwise.cpp +++ b/bench/benchmarkXcwise.cpp @@ -3,7 +3,7 @@ #include <Eigen/Core> using namespace std; -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #ifndef VECTYPE #define VECTYPE VectorXLd diff --git a/bench/vdw_new.cpp b/bench/vdw_new.cpp index a1bd422ae..b7f74a68f 100644 --- a/bench/vdw_new.cpp +++ b/bench/vdw_new.cpp @@ -1,6 +1,6 @@ #include <Eigen/Array> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; #ifndef SCALAR #define SCALAR float diff --git a/disabled/class_Eval.cpp b/disabled/class_Eval.cpp index ee6ee89d1..ceb76897c 100644 --- a/disabled/class_Eval.cpp +++ b/disabled/class_Eval.cpp @@ -1,5 +1,5 @@ #include <Eigen/Core> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template<typename Derived> diff --git a/disabled/ompbenchmark.cpp b/disabled/ompbenchmark.cpp index 704375b0d..2e996f2e3 100644 --- a/disabled/ompbenchmark.cpp +++ b/disabled/ompbenchmark.cpp @@ -9,7 +9,7 @@ // #include "BenchTimer.h" // // using namespace std; -// USING_PART_OF_NAMESPACE_EIGEN +// using namespace Eigen; // // enum {LazyEval, EarlyEval, OmpEval}; // 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 <table> -<tr><td>Eigen 2</td><td>Eigen 3</td><td>Comments</td></tr> +<tr><td>Eigen 2</td><td>Eigen 3</td></tr> <tr><td>\code -vec.start(length) -vec.start<length>() -vec.end(length) -vec.end<length>() +vector.start(length) +vector.start<length>() +vector.end(length) +vector.end<length>() \endcode</td><td>\code -vec.head(length) -vec.head<length>() -vec.tail(length) -vec.tail<length>() -\endcode</td><td>Trivial "search and replace".</td></tr> -<tr><td colspan="3"></td></tr> -<tr><td>\code mat.cwise().XXX()\endcode</td><td>\code mat.array().XXX()\endcode</td><td>See \ref CoefficientWiseOperations. </td></tr> -<tr><td colspan="3"></td></tr> -<tr><td>\code c = (a * b).lazy();\endcode</td><td>\code c.noalias() = a * b;\endcode</td><td>See \ref LazyVsNoalias. </td></tr> -<tr><td colspan="3"></td></tr> -<tr><td>\code A.triangularSolveInPlace<XXX>(X);\endcode</td><td>\code A.triangularView<XXX>().solveInPlace(X);\endcode</td><td></td></tr> +vector.head(length) +vector.head<length>() +vector.tail(length) +vector.tail<length>() +\endcode</td></tr> +</table> + + +\section Corners Matrix Corners + +<table> +<tr><td>Eigen 2</td><td>Eigen 3</td></tr> +<tr><td>\code +matrix.corner(TopLeft,r,c) +matrix.corner(TopRight,r,c) +matrix.corner(BottomLeft,r,c) +matrix.corner(BottomRight,r,c) +matrix.corner<r,c>(TopLeft) +matrix.corner<r,c>(TopRight) +matrix.corner<r,c>(BottomLeft) +matrix.corner<r,c>(BottomRight) +\endcode</td><td>\code +matrix.topLeftCorner(r,c) +matrix.topRightCorner(r,c) +matrix.bottomLeftCorner(r,c) +matrix.bottomRightCorner(r,c) +matrix.topLeftCorner<r,c>() +matrix.topRightCorner<r,c>() +matrix.bottomLeftCorner<r,c>() +matrix.bottomRightCorner<r,c>() +\endcode</td> +</tr> +</table> + +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 + +<table> +<tr><td>Eigen 2</td><td>Eigen 3</td></tr> +<tr><td>\code A.triangularSolveInPlace<XXX>(X);\endcode</td><td>\code A.triangularView<XXX>().solveInPlace(X);\endcode</td></tr> <tr><td colspan="3"></td></tr> <tr><td>\code UpperTriangular @@ -53,9 +91,17 @@ UnitLower StrictlyUpper StrictlyLower \endcode</td> -<td>Trivial "search and replace".</td></tr> +</tr> </table> +\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 - -<table> -<tr><td>Eigen 2</td><td>Eigen 3</td></tr> -<tr><td>\code -matrix.corner(TopLeft,r,c) -matrix.corner(TopRight,r,c) -matrix.corner(BottomLeft,r,c) -matrix.corner(BottomRight,r,c) -matrix.corner<r,c>(TopLeft) -matrix.corner<r,c>(TopRight) -matrix.corner<r,c>(BottomLeft) -matrix.corner<r,c>(BottomRight) -\endcode</td><td>\code -matrix.topLeftCorner(r,c) -matrix.topRightCorner(r,c) -matrix.bottomLeftCorner(r,c) -matrix.bottomRightCorner(r,c) -matrix.topLeftCorner<r,c>() -matrix.topRightCorner<r,c>() -matrix.bottomLeftCorner<r,c>() -matrix.bottomRightCorner<r,c>() -\endcode</td> -</tr> -</table> - -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 <Eigen/Core> - -USING_PART_OF_NAMESPACE_EIGEN - -using namespace std; - -template<typename Scalar, typename Derived> -void foo(const MatrixBase<Scalar, Derived>& m) -{ - cout << "Here's m:" << endl << m << endl; -} - -template<typename Scalar, typename Derived> -Eigen::ScalarMultiple<Derived> -twice(const MatrixBase<Scalar, Derived>& 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 <Eigen/Core> #include <iostream> -// 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 <Eigen/Core> #include <iostream> -// 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 <Eigen/Core> #include <iostream> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template<typename Derived> 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 <Eigen/Core> #include <iostream> -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 <Eigen/Core> #include <iostream> -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 <Eigen/Core> #include <iostream> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template<typename Derived> 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 <Eigen/Core> #include <iostream> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template<typename Derived> 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 <Eigen/Core> #include <iostream> -USING_PART_OF_NAMESPACE_EIGEN +using namespace Eigen; using namespace std; template<typename Derived> |