gtsam
3rdparty
Eigen
doc
examples
Tutorial_simple_example_dynamic_size.cpp
Go to the documentation of this file.
1
#include <Eigen/Core>
2
#include <iostream>
3
4
using namespace
Eigen
;
5
6
int
main
()
7
{
8
for
(
int
size
=1;
size
<=4; ++
size
)
9
{
10
MatrixXi
m
(
size
,
size
+1);
// a (size)x(size+1)-matrix of int's
11
for
(
int
j
=0;
j
<
m
.cols(); ++
j
)
// loop over columns
12
for
(
int
i
=0;
i
<
m
.rows(); ++
i
)
// loop over rows
13
m
(
i
,
j
) =
i
+
j
*
size
;
// to access matrix coefficients,
14
// use operator()(int,int)
15
std::cout <<
m
<<
"\n\n"
;
16
}
17
18
VectorXf
v
(4);
// a vector of 4 float's
19
// to access vector coefficients, use either operator () or operator []
20
v
[0] = 1;
v
[1] = 2;
v
(2) = 3;
v
(3) = 4;
21
std::cout <<
"\nv:\n"
<<
v
<< std::endl;
22
}
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
main
int main()
Definition:
Tutorial_simple_example_dynamic_size.cpp:6
size
Scalar Scalar int size
Definition:
benchVecAdd.cpp:17
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
m
Matrix3f m
Definition:
AngleAxis_mimic_euler.cpp:1
v
Array< int, Dynamic, 1 > v
Definition:
Array_initializer_list_vector_cxx11.cpp:1
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:36