benchmarkXcwise.cpp
Go to the documentation of this file.
1 // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
2 
3 #include <iostream>
4 #include <Eigen/Core>
5 
6 using namespace std;
7 using namespace Eigen;
8 
9 #ifndef VECTYPE
10 #define VECTYPE VectorXLd
11 #endif
12 
13 #ifndef VECSIZE
14 #define VECSIZE 1000000
15 #endif
16 
17 #ifndef REPEAT
18 #define REPEAT 1000
19 #endif
20 
21 int main(int argc, char *argv[])
22 {
23  VECTYPE I = VECTYPE::Ones(VECSIZE);
24  VECTYPE m(VECSIZE,1);
25  for(int i = 0; i < VECSIZE; i++)
26  {
27  m[i] = 0.1 * i/VECSIZE;
28  }
29  for(int a = 0; a < REPEAT; a++)
30  {
31  m = VECTYPE::Ones(VECSIZE) + 0.00005 * (m.cwise().square() + m/4);
32  }
33  cout << m[0] << endl;
34  return 0;
35 }
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
REPEAT
#define REPEAT
Definition: benchmarkXcwise.cpp:18
I
#define I
Definition: main.h:112
main
int main(int argc, char *argv[])
Definition: benchmarkXcwise.cpp:21
VECTYPE
#define VECTYPE
Definition: benchmarkXcwise.cpp:10
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
VECSIZE
#define VECSIZE
Definition: benchmarkXcwise.cpp:14
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
std
Definition: BFloat16.h:88
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:11