class_Block.cpp
Go to the documentation of this file.
1 #include <Eigen/Core>
2 #include <iostream>
3 using namespace Eigen;
4 using namespace std;
5 
6 template<typename Derived>
9 {
10  return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);
11 }
12 
13 template<typename Derived>
16 {
17  return Eigen::Block<const Derived>(m.derived(), 0, 0, rows, cols);
18 }
19 
20 int main(int, char**)
21 {
22  Matrix4d m = Matrix4d::Identity();
23  cout << topLeftCorner(4*m, 2, 3) << endl; // calls the const version
24  topLeftCorner(m, 2, 3) *= 5; // calls the non-const version
25  cout << "Now the matrix m is:" << endl << m << endl;
26  return 0;
27 }
Matrix3f m
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Definition: Half.h:150
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:103
int main(int, char **)
Definition: class_Block.cpp:20
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Eigen::Block< Derived > topLeftCorner(MatrixBase< Derived > &m, int rows, int cols)
Definition: class_Block.cpp:8


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:41:47