aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/MatrixBase_eval.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-01-04 21:23:37 -0500
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2010-01-04 21:23:37 -0500
commit78ba523d3038b854c5beca7a94cbe9b7e955a9f3 (patch)
treee40211215e0e6b7a8228d0128e9b911ec26cb4ad /doc/snippets/MatrixBase_eval.cpp
parentfd19e0a9ea5794b85488e4fe19d51435e6029457 (diff)
Make snippet run successfully again:
the snippet for 'eval' was taking m=m.transpose() as an example of code that needs an explicit call to eval(), but that doesn't work anymore now that we have the clever assert detecting aliasing issues.
Diffstat (limited to 'doc/snippets/MatrixBase_eval.cpp')
-rw-r--r--doc/snippets/MatrixBase_eval.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/snippets/MatrixBase_eval.cpp b/doc/snippets/MatrixBase_eval.cpp
index d70424562..1df3aa01d 100644
--- a/doc/snippets/MatrixBase_eval.cpp
+++ b/doc/snippets/MatrixBase_eval.cpp
@@ -2,11 +2,11 @@ Matrix2f M = Matrix2f::Random();
Matrix2f m;
m = M;
cout << "Here is the matrix m:" << endl << m << endl;
-cout << "Now we want to replace m by its own transpose." << endl;
-cout << "If we do m = m.transpose(), then m becomes:" << endl;
-m = m.transpose() * 1;
+cout << "Now we want to copy a column into a row." << endl;
+cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl;
+m.col(1) = m.row(0);
cout << m << endl << "which is wrong!" << endl;
-cout << "Now let us instead do m = m.transpose().eval(). Then m becomes" << endl;
+cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl;
m = M;
-m = m.transpose().eval();
+m.col(1) = m.row(0).eval();
cout << m << endl << "which is right." << endl;