source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/doc/snippets/MatrixBase_eval.cpp

Last change on this file was 136, checked in by ldecherf, 8 years ago

Doc

File size: 467 bytes
Line 
1Matrix2f M = Matrix2f::Random();
2Matrix2f m;
3m = M;
4cout << "Here is the matrix m:" << endl << m << endl;
5cout << "Now we want to copy a column into a row." << endl;
6cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl;
7m.col(1) = m.row(0);
8cout << m << endl << "which is wrong!" << endl;
9cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl;
10m = M;
11m.col(1) = m.row(0).eval();
12cout << m << endl << "which is right." << endl;
Note: See TracBrowser for help on using the repository browser.