aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2009-02-06 09:01:50 +0000
committerGravatar Gael Guennebaud <g.gael@free.fr>2009-02-06 09:01:50 +0000
commit6fbca948031ff48ac8bba35afcabad967965befa (patch)
tree6160a5c4f64996d6c713e5ee3f8cebd26ca3ca7b /doc
parentdc9707990553566d7ac5d42fa79839812470f842 (diff)
apply Ricard patch for Reverse with minor modifications
Diffstat (limited to 'doc')
-rw-r--r--doc/snippets/MatrixBase_reverse.cpp8
-rw-r--r--doc/snippets/PartialRedux_reverse.cpp10
2 files changed, 18 insertions, 0 deletions
diff --git a/doc/snippets/MatrixBase_reverse.cpp b/doc/snippets/MatrixBase_reverse.cpp
new file mode 100644
index 000000000..f545a2837
--- /dev/null
+++ b/doc/snippets/MatrixBase_reverse.cpp
@@ -0,0 +1,8 @@
+MatrixXi m = MatrixXi::Random(3,4);
+cout << "Here is the matrix m:" << endl << m << endl;
+cout << "Here is the reverse of m:" << endl << m.reverse() << endl;
+cout << "Here is the coefficient (1,0) in the reverse of m:" << endl
+ << m.reverse()(1,0) << endl;
+cout << "Let us overwrite this coefficient with the value 4." << endl;
+m.reverse()(1,0) = 4;
+cout << "Now the matrix m is:" << endl << m << endl;
diff --git a/doc/snippets/PartialRedux_reverse.cpp b/doc/snippets/PartialRedux_reverse.cpp
new file mode 100644
index 000000000..2f6a35080
--- /dev/null
+++ b/doc/snippets/PartialRedux_reverse.cpp
@@ -0,0 +1,10 @@
+MatrixXi m = MatrixXi::Random(3,4);
+cout << "Here is the matrix m:" << endl << m << endl;
+cout << "Here is the rowwise reverse of m:" << endl << m.rowwise().reverse() << endl;
+cout << "Here is the colwise reverse of m:" << endl << m.colwise().reverse() << endl;
+
+cout << "Here is the coefficient (1,0) in the rowise reverse of m:" << endl
+<< m.rowwise().reverse()(1,0) << endl;
+cout << "Let us overwrite this coefficient with the value 4." << endl;
+//m.colwise().reverse()(1,0) = 4;
+cout << "Now the matrix m is:" << endl << m << endl;