gtsam
3rdparty
Eigen
bench
benchmark.cpp
Go to the documentation of this file.
1
// g++ -O3 -DNDEBUG -DMATSIZE=<x> benchmark.cpp -o benchmark && time ./benchmark
2
3
#include <iostream>
4
5
#include <Eigen/Core>
6
7
#ifndef MATSIZE
8
#define MATSIZE 3
9
#endif
10
11
using namespace
std
;
12
using namespace
Eigen
;
13
14
#ifndef REPEAT
15
#define REPEAT 40000000
16
#endif
17
18
#ifndef SCALAR
19
#define SCALAR double
20
#endif
21
22
int
main
(
int
argc,
char
*argv[])
23
{
24
Matrix<SCALAR,MATSIZE,MATSIZE>
I
=
Matrix<SCALAR,MATSIZE,MATSIZE>::Ones
();
25
Matrix<SCALAR,MATSIZE,MATSIZE>
m
;
26
for
(
int
i
= 0;
i
<
MATSIZE
;
i
++)
27
for
(
int
j
= 0;
j
<
MATSIZE
;
j
++)
28
{
29
m
(
i
,
j
) = (
i
+
MATSIZE
*
j
);
30
}
31
asm
(
"#begin"
);
32
for
(
int
a
= 0;
a
<
REPEAT
;
a
++)
33
{
34
m
=
Matrix<SCALAR,MATSIZE,MATSIZE>::Ones
() + 0.00005 * (
m
+ (
m
*
m
));
35
}
36
asm
(
"#end"
);
37
cout <<
m
<< endl;
38
return
0;
39
}
Eigen
Namespace containing all symbols from the Eigen library.
Definition:
jet.h:637
REPEAT
#define REPEAT
Definition:
benchmark.cpp:15
main
int main(int argc, char *argv[])
Definition:
benchmark.cpp:22
MATSIZE
#define MATSIZE
Definition:
benchmark.cpp:8
j
std::ptrdiff_t j
Definition:
tut_arithmetic_redux_minmax.cpp:2
I
#define I
Definition:
main.h:112
m
Matrix3f m
Definition:
AngleAxis_mimic_euler.cpp:1
a
ArrayXXi a
Definition:
Array_initializer_list_23_cxx11.cpp:1
std
Definition:
BFloat16.h:88
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition:
3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
i
int i
Definition:
BiCGSTAB_step_by_step.cpp:9
gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:32:00