mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-21 07:19:46 +08:00
fc9480cbb3
improve doc, and workaround aliasing detection in MatrixBase_eval snippet (not very nice but I don't know how to do it in a better way)
13 lines
469 B
C++
13 lines
469 B
C++
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 << m << endl << "which is wrong!" << endl;
|
|
cout << "Now let us instead do m = m.transpose().eval(). Then m becomes" << endl;
|
|
m = M;
|
|
m = m.transpose().eval();
|
|
cout << m << endl << "which is right." << endl;
|