2008-07-21 08:34:46 +08:00
|
|
|
Matrix2f M = Matrix2f::Random();
|
2007-12-28 05:43:10 +08:00
|
|
|
Matrix2f m;
|
|
|
|
m = M;
|
|
|
|
cout << "Here is the matrix m:" << endl << m << endl;
|
2010-01-05 10:23:37 +08:00
|
|
|
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);
|
2007-12-28 05:43:10 +08:00
|
|
|
cout << m << endl << "which is wrong!" << endl;
|
2010-01-05 10:23:37 +08:00
|
|
|
cout << "Now let us instead do m.col(1) = m.row(0).eval(). Then m becomes" << endl;
|
2007-12-28 05:43:10 +08:00
|
|
|
m = M;
|
2010-01-05 10:23:37 +08:00
|
|
|
m.col(1) = m.row(0).eval();
|
2007-12-28 05:43:10 +08:00
|
|
|
cout << m << endl << "which is right." << endl;
|