mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
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
This commit is contained in:
13
doc/snippets/Eval_MatrixType.cpp
Normal file
13
doc/snippets/Eval_MatrixType.cpp
Normal file
@@ -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;
|
||||
Reference in New Issue
Block a user