aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-11-09 11:35:27 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-11-09 11:35:27 +0100
commitd7c644213cbf548f67aeb7ed6f872aef96c1dbd2 (patch)
tree576a7e2400362015c89b7433571198fecc8ed579 /doc/snippets/Tutorial_reshaped_vs_resize_2.cpp
parenta368848473967548572b69a841b70f9f123b9559 (diff)
Add and update manual pages for slicing, indexing, and reshaping.
Diffstat (limited to 'doc/snippets/Tutorial_reshaped_vs_resize_2.cpp')
-rw-r--r--doc/snippets/Tutorial_reshaped_vs_resize_2.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp b/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp
new file mode 100644
index 000000000..50dc45488
--- /dev/null
+++ b/doc/snippets/Tutorial_reshaped_vs_resize_2.cpp
@@ -0,0 +1,6 @@
+Matrix<int,Dynamic,Dynamic,RowMajor> m = Matrix4i::Random();
+cout << "Here is the matrix m:" << endl << m << endl;
+cout << "Here is m.reshaped(2, 8):" << endl << m.reshaped(2, 8) << endl;
+cout << "Here is m.reshaped<AutoOrder>(2, 8):" << endl << m.reshaped<AutoOrder>(2, 8) << endl;
+m.resize(2,8);
+cout << "Here is the matrix m after m.resize(2,8):" << endl << m << endl;