From 83d6a529c3a917763b35aafe8cd5b3b7478fcee6 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sat, 11 Feb 2017 15:31:28 +0100 Subject: Use Eigen::fix to pass compile-time sizes. --- doc/examples/class_FixedReshape.cpp | 22 ---------------------- doc/examples/class_FixedReshaped.cpp | 22 ++++++++++++++++++++++ doc/examples/class_Reshape.cpp | 23 ----------------------- doc/examples/class_Reshaped.cpp | 23 +++++++++++++++++++++++ doc/snippets/MatrixBase_reshaped_fixed.cpp | 2 +- doc/snippets/MatrixBase_reshaped_int_int.cpp | 2 +- 6 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 doc/examples/class_FixedReshape.cpp create mode 100644 doc/examples/class_FixedReshaped.cpp delete mode 100644 doc/examples/class_Reshape.cpp create mode 100644 doc/examples/class_Reshaped.cpp (limited to 'doc') diff --git a/doc/examples/class_FixedReshape.cpp b/doc/examples/class_FixedReshape.cpp deleted file mode 100644 index 40156a123..000000000 --- a/doc/examples/class_FixedReshape.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -using namespace Eigen; -using namespace std; - -template -Eigen::Reshape -reshape_helper(MatrixBase& m) -{ - return Eigen::Reshape(m.derived()); -} - -int main(int, char**) -{ - MatrixXd m(2, 4); - m << 1, 2, 3, 4, - 5, 6, 7, 8; - MatrixXd n = reshape_helper(m); - cout << "matrix m is:" << endl << m << endl; - cout << "matrix n is:" << endl << n << endl; - return 0; -} diff --git a/doc/examples/class_FixedReshaped.cpp b/doc/examples/class_FixedReshaped.cpp new file mode 100644 index 000000000..b6d4085de --- /dev/null +++ b/doc/examples/class_FixedReshaped.cpp @@ -0,0 +1,22 @@ +#include +#include +using namespace Eigen; +using namespace std; + +template +Eigen::Reshaped +reshape_helper(MatrixBase& m) +{ + return Eigen::Reshaped(m.derived()); +} + +int main(int, char**) +{ + MatrixXd m(2, 4); + m << 1, 2, 3, 4, + 5, 6, 7, 8; + MatrixXd n = reshape_helper(m); + cout << "matrix m is:" << endl << m << endl; + cout << "matrix n is:" << endl << n << endl; + return 0; +} diff --git a/doc/examples/class_Reshape.cpp b/doc/examples/class_Reshape.cpp deleted file mode 100644 index b9abdc2d5..000000000 --- a/doc/examples/class_Reshape.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include -using namespace std; -using namespace Eigen; - -template -const Reshape -reshape_helper(const MatrixBase& m, int rows, int cols) -{ - return Reshape(m.derived(), rows, cols); -} - -int main(int, char**) -{ - MatrixXd m(3, 4); - m << 1, 4, 7, 10, - 2, 5, 8, 11, - 3, 6, 9, 12; - cout << m << endl; - auto n = reshape_helper(m, 2, 6); - cout << "Matrix m is:" << endl << m << endl; - cout << "Matrix n is:" << endl << n << endl; -} diff --git a/doc/examples/class_Reshaped.cpp b/doc/examples/class_Reshaped.cpp new file mode 100644 index 000000000..18fb45454 --- /dev/null +++ b/doc/examples/class_Reshaped.cpp @@ -0,0 +1,23 @@ +#include +#include +using namespace std; +using namespace Eigen; + +template +const Reshaped +reshape_helper(const MatrixBase& m, int rows, int cols) +{ + return Reshaped(m.derived(), rows, cols); +} + +int main(int, char**) +{ + MatrixXd m(3, 4); + m << 1, 4, 7, 10, + 2, 5, 8, 11, + 3, 6, 9, 12; + cout << m << endl; + Ref n = reshape_helper(m, 2, 6); + cout << "Matrix m is:" << endl << m << endl; + cout << "Matrix n is:" << endl << n << endl; +} diff --git a/doc/snippets/MatrixBase_reshaped_fixed.cpp b/doc/snippets/MatrixBase_reshaped_fixed.cpp index 611205929..a268ee5ae 100644 --- a/doc/snippets/MatrixBase_reshaped_fixed.cpp +++ b/doc/snippets/MatrixBase_reshaped_fixed.cpp @@ -1,3 +1,3 @@ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; -cout << "Here is m.reshape(fix<2>,fix<8>):" << endl << m.reshape(fix<2>,fix<8>) << endl; +cout << "Here is m.reshape(fix<2>,fix<8>):" << endl << m.reshaped(fix<2>,fix<8>) << endl; diff --git a/doc/snippets/MatrixBase_reshaped_int_int.cpp b/doc/snippets/MatrixBase_reshaped_int_int.cpp index 1169cdb2d..4486d8347 100644 --- a/doc/snippets/MatrixBase_reshaped_int_int.cpp +++ b/doc/snippets/MatrixBase_reshaped_int_int.cpp @@ -1,3 +1,3 @@ Matrix4i m = Matrix4i::Random(); cout << "Here is the matrix m:" << endl << m << endl; -cout << "Here is m.reshape(2, 8):" << endl << m.reshape(2, 8) << endl; +cout << "Here is m.reshape(2, 8):" << endl << m.reshaped(2, 8) << endl; -- cgit v1.2.3