class_FixedBlock.cpp
Go to the documentation of this file.
1 #include <Eigen/Core>
2 #include <iostream>
3 
4 template<typename Derived>
7 {
8  return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
9 }
10 
11 template<typename Derived>
14 {
15  return Eigen::Block<const Derived, 2, 2>(m.derived(), 0, 0);
16 }
17 
18 int main(int, char**)
19 {
21  std::cout << topLeft2x2Corner(4*m) << std::endl; // calls the const version
22  topLeft2x2Corner(m) *= 2; // calls the non-const version
23  std::cout << "Now the matrix m is:" << std::endl << m << std::endl;
24  return 0;
25 }
Matrix3f m
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:107
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
static const IdentityReturnType Identity()
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
int main(int, char **)
Eigen::Block< Derived, 2, 2 > topLeft2x2Corner(Eigen::MatrixBase< Derived > &m)