aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/Tutorial_ReshapeMat2Mat.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2016-02-06 22:49:18 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2016-02-06 22:49:18 +0100
commit010afe1619c9200b885f74d3c3937e000ec76b1d (patch)
treec8e8fbbc9137501aac17bb7b7acf78db8754331b /doc/snippets/Tutorial_ReshapeMat2Mat.cpp
parent8e599bc098cef7030004489dca2b9dab920f2cc8 (diff)
Add exemples for reshaping/slicing with Map.
Diffstat (limited to 'doc/snippets/Tutorial_ReshapeMat2Mat.cpp')
-rw-r--r--doc/snippets/Tutorial_ReshapeMat2Mat.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/doc/snippets/Tutorial_ReshapeMat2Mat.cpp b/doc/snippets/Tutorial_ReshapeMat2Mat.cpp
new file mode 100644
index 000000000..f84d6e76d
--- /dev/null
+++ b/doc/snippets/Tutorial_ReshapeMat2Mat.cpp
@@ -0,0 +1,6 @@
+MatrixXf M1(2,6); // Column-major storage
+M1 << 1, 2, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12;
+
+Map<MatrixXf> M2(M1.data(), 6,2);
+cout << "M2:" << endl << M2 << endl; \ No newline at end of file