aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/MatrixBase_eval.cpp
blob: d7042456286434eaa67df90c033072249dfb6711 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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;