aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets/TopicAliasing_mult2.cpp
diff options
context:
space:
mode:
authorGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2010-12-27 15:06:55 +0000
committerGravatar Jitse Niesen <jitse@maths.leeds.ac.uk>2010-12-27 15:06:55 +0000
commit42a050dc6881d00ed32ffe2b9d55192db8dca760 (patch)
treec2ffabd791fc1060ff62732d8b5a46fb67734154 /doc/snippets/TopicAliasing_mult2.cpp
parentdc3618a55727a0471940c42baacbe58629b348ca (diff)
Finish doc page on aliasing.
Diffstat (limited to 'doc/snippets/TopicAliasing_mult2.cpp')
-rw-r--r--doc/snippets/TopicAliasing_mult2.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/doc/snippets/TopicAliasing_mult2.cpp b/doc/snippets/TopicAliasing_mult2.cpp
new file mode 100644
index 000000000..a3ff56851
--- /dev/null
+++ b/doc/snippets/TopicAliasing_mult2.cpp
@@ -0,0 +1,10 @@
+MatrixXf matA(2,2), matB(2,2);
+matA << 2, 0, 0, 2;
+
+// Simple but not quite as efficient
+matB = matA * matA;
+cout << matB << endl << endl;
+
+// More complicated but also more efficient
+matB.noalias() = matA * matA;
+cout << matB;