Eigen 3.4.90
Main Page
Related Pages
Modules
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Typedefs
_
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
Enumerator
a
b
c
d
e
f
h
i
k
m
n
o
p
q
r
s
t
u
v
Related Functions
o
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
a
b
c
d
e
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
x
y
Typedefs
a
b
c
d
e
f
i
l
m
n
r
s
t
u
Macros
_
a
b
c
d
e
f
g
h
l
m
p
s
u
v
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
doc
examples
Tutorial_simple_example_dynamic_size.cpp
Go to the documentation of this file.
1
#include <
Eigen/Core
>
2
#include <iostream>
3
4
int
main
()
5
{
6
for
(
int
size
=1;
size
<=4; ++
size
)
7
{
8
Eigen::MatrixXi
m
(
size
,
size
+1);
// a (size)x(size+1)-matrix of int's
9
for
(
int
j
=0;
j
<
m
.cols(); ++
j
)
// loop over columns
10
for
(
int
i
=0;
i
<
m
.rows(); ++
i
)
// loop over rows
11
m
(
i
,
j
) =
i
+
j
*
size
;
// to access matrix coefficients,
12
// use operator()(int,int)
13
std::cout <<
m
<<
"\n\n"
;
14
}
15
16
Eigen::VectorXf
v
(4);
// a vector of 4 float's
17
// to access vector coefficients, use either operator () or operator []
18
v
[0] = 1;
v
[1] = 2;
v
(2) = 3;
v
(3) = 4;
19
std::cout <<
"\nv:\n"
<<
v
<< std::endl;
20
}
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
Core
size
const int size
Definition:
Tutorial_AdvancedInitialization_ThreeWays.cpp:1
main
int main()
Definition:
Tutorial_simple_example_dynamic_size.cpp:4
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition:
Matrix.h:182
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
Code