aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/tutorial.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-09-29 08:28:36 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-09-29 08:28:36 +0000
commitee63e15e2cad25d8acd0ac6ba6dc9d7a84f74f6c (patch)
tree8a7ee0fbbf3a2033a0b1a9073f9d35f862e13f28 /doc/tutorial.cpp
parent51e29ae4bd9d725c3a68fe94766c73ba8c717688 (diff)
make matrix multiplication do immediate evaluation; add lazyMul() for the old behaviour
some reorganization, especially in MatrixStorage start playing with loop unrolling, always_inline, and __restrict__
Diffstat (limited to 'doc/tutorial.cpp')
-rw-r--r--doc/tutorial.cpp18
1 files changed, 0 insertions, 18 deletions
diff --git a/doc/tutorial.cpp b/doc/tutorial.cpp
index 1da3deb1d..03495dbcb 100644
--- a/doc/tutorial.cpp
+++ b/doc/tutorial.cpp
@@ -29,23 +29,5 @@ int main(int, char **)
cout << "Row 0 of m2, written as a column vector, is:" << endl << m2.row(0) << endl;
cout << "Column 1 of m2 is:" << endl << m2.col(1) << endl;
cout << "The matrix m2 with row 0 and column 1 removed is:" << endl << m2.minor(0,1) << endl;
-
- cout << endl << "Now let us study a tricky issue." << endl;
- cout << "Recall that the matrix product m*m is:" << endl << m*m << endl;
- cout << "We want to store that into m, i.e. do \"m = m * m;\"" << endl;
- cout << "Here we must be very careful. For if we do \"m = m * m;\"," << endl
- << "the matrix m becomes" << endl;
- EiMatrix<double,2,2> m_save = m;
- m = m * m; // the bogus operation
- cout << m << "," << endl;
- cout << "which is not what was wanted!" << endl
- << "Explanation: because of the way expression templates work, the matrix m gets" << endl
- << "overwritten _while_ the matrix product m * m is being computed." << endl
- << "This is the counterpart of eliminating temporary objects!" << endl
- << "Anyway, if you want to store m * m into m, you can do this:" << endl
- << " m = (m * m).eval();" << endl;
- m = m_save;
- m = (m * m).eval();
- cout << "And m is now:" << endl << m << endl << "as was expected." << endl;
return 0;
}