aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-02-12 17:43:29 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2011-02-12 17:43:29 +0000
commit9ac68e40a0fa84419e95674c07bb773d054558c8 (patch)
tree6f1bb94758f94b369f05ee3759a318824bac420b /doc/snippets
parent7015aa00a97a0161fd8f73fd2ffdfb7a36749f98 (diff)
Write topic page for storage orders.
Diffstat (limited to 'doc/snippets')
-rw-r--r--doc/snippets/TopicStorageOrders_example.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/snippets/TopicStorageOrders_example.cpp b/doc/snippets/TopicStorageOrders_example.cpp
new file mode 100644
index 000000000..0623ef0c2
--- /dev/null
+++ b/doc/snippets/TopicStorageOrders_example.cpp
@@ -0,0 +1,18 @@
+Matrix<int, 3, 4, ColMajor> Acolmajor;
+Acolmajor << 8, 2, 2, 9,
+ 9, 1, 4, 4,
+ 3, 5, 4, 5;
+cout << "The matrix A:" << endl;
+cout << Acolmajor << endl << endl;
+
+cout << "In memory (column-major):" << endl;
+for (int i = 0; i < Acolmajor.size(); i++)
+ cout << *(Acolmajor.data() + i) << " ";
+cout << endl << endl;
+
+Matrix<int, 3, 4, RowMajor> Arowmajor = Acolmajor;
+cout << "In memory (row-major):" << endl;
+for (int i = 0; i < Arowmajor.size(); i++)
+ cout << *(Arowmajor.data() + i) << " ";
+cout << endl;
+