aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/snippets
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-15 13:55:47 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-01-15 13:55:47 +0000
commitc67e717404258d3625a74c67f50be34939af6d95 (patch)
tree2eab0b2e520acb2ccbd88fa8242a2c9c9ea8b980 /doc/snippets
parent9c9a42cc49f9c7f0e0d87c827734262cc5f5fbc3 (diff)
alpha 3.1. in this commit:
- finally get the Eval stuff right. get back to having Eval as a subclass of Matrix with limited functionality, and then, add a typedef MatrixType to get the actual matrix type. - add swap(), findBiggestCoeff() - bugfix by Ramon in Transpose - new demo: doc/echelon.cpp
Diffstat (limited to 'doc/snippets')
-rw-r--r--doc/snippets/Eval_MatrixType.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/snippets/Eval_MatrixType.cpp b/doc/snippets/Eval_MatrixType.cpp
new file mode 100644
index 000000000..0af4c64e4
--- /dev/null
+++ b/doc/snippets/Eval_MatrixType.cpp
@@ -0,0 +1,13 @@
+typedef Matrix3i MyMatrixType;
+MyMatrixType m = MyMatrixType::random(3, 3);
+cout << "Here's the matrix m:" << endl << m << endl;
+typedef Eigen::Eval<Eigen::Row<MyMatrixType> >::MatrixType MyRowType;
+// now MyRowType is just the same typedef as RowVector3i
+MyRowType r = m.row(0);
+cout << "Here's r:" << endl << r << endl;
+typedef Eigen::Eval<Eigen::Block<MyMatrixType> >::MatrixType MyBlockType;
+MyBlockType c = m.corner(Eigen::TopRight, 2, 2);
+// now MyBlockType is a a matrix type where the number of rows and columns
+// are dynamic, but know at compile-time to be <= 2. Therefore no dynamic memory
+// allocation occurs.
+cout << "Here's c:" << endl << c << endl;