gtsam
3rdparty
Eigen
doc
examples
class_FixedBlock.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>
7
Eigen::Block<Derived, 2, 2>
8
topLeft2x2Corner
(
MatrixBase<Derived>
&
m
)
9
{
10
return
Eigen::Block<Derived, 2, 2>
(
m
.derived(), 0, 0);
11
}
12
13
template
<
typename
Derived>
14
const
Eigen::Block<const Derived, 2, 2>
15
topLeft2x2Corner
(
const
MatrixBase<Derived>
&
m
)
16
{
17
return
Eigen::Block<const Derived, 2, 2>
(
m
.derived(), 0, 0);
18
}
19
20
int
main
(
int
,
char
**)
21
{
22
Matrix3d
m
= Matrix3d::Identity();
23
cout <<
topLeft2x2Corner
(4*
m
) << endl;
// calls the const version
24
topLeft2x2Corner
(
m
) *= 2;
// calls the non-const version
25
cout <<
"Now the matrix m is:"
<< endl <<
m
<< endl;
26
return
0;
27
}
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
Eigen::Block
Expression of a fixed-size or dynamic-size block.
Definition:
Block.h:103
topLeft2x2Corner
Eigen::Block< Derived, 2, 2 > topLeft2x2Corner(MatrixBase< Derived > &m)
Definition:
class_FixedBlock.cpp:8
m
Matrix3f m
Definition:
AngleAxis_mimic_euler.cpp:1
std
Definition:
BFloat16.h:88
Eigen::MatrixBase
Base class for all dense matrices, vectors, and expressions.
Definition:
MatrixBase.h:48
main
int main(int, char **)
Definition:
class_FixedBlock.cpp:20
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:01:58