mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
e7bdbe2e6a
map() moves from MatrixBase to Matrix much more documentation/examples/snippets
13 lines
465 B
C++
13 lines
465 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();
|
|
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;
|