blob: 41815c69acf34f46218fee657f9646ebbc858489 [file] [log] [blame]
Benoit Jacob486fdb22008-05-29 03:12:30 +00001Matrix2d m; m << 1,2,3,4;
2Matrix2d n;
3n = (m*m).lazy(); // if we did "n = m*m;" then m*m would first be evaluated into
4 // a temporary, because the Product expression has the EvalBeforeAssigningBit.
5 // This temporary would then be copied into n. Introducing this temporary is
6 // useless here and wastes time. Doing "n = (m*m).lazy();" evaluates m*m directly
7 // into n, which is faster. But, beware! This is only correct because m and n
8 // are two distinct matrices. Doing "m = (m*m).lazy();" would not produce the
9 // expected result.
10cout << n << endl;