blob: 1df3aa01dec18ed8042828b80aaf3b5d681cec57 [file] [log] [blame]
Gael Guennebaudc10f0692008-07-21 00:34:46 +00001Matrix2f M = Matrix2f::Random();
Benoit Jacobe7bdbe2e2007-12-27 21:43:10 +00002Matrix2f m;
3m = M;
4cout << "Here is the matrix m:" << endl << m << endl;
Benoit Jacob78ba5232010-01-04 21:23:37 -05005cout << "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);
Benoit Jacobe7bdbe2e2007-12-27 21:43:10 +00008cout << m << endl << "which is wrong!" << endl;
Benoit Jacob78ba5232010-01-04 21:23:37 -05009cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl;
Benoit Jacobe7bdbe2e2007-12-27 21:43:10 +000010m = M;
Benoit Jacob78ba5232010-01-04 21:23:37 -050011m.col(1) = m.row(0).eval();
Benoit Jacobe7bdbe2e2007-12-27 21:43:10 +000012cout << m << endl << "which is right." << endl;