source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/bench/benchmarkXcwise.cpp

Last change on this file was 136, checked in by ldecherf, 8 years ago

Doc

File size: 605 bytes
Line 
1// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
2
3#include <iostream>
4#include <Eigen/Core>
5
6using namespace std;
7using 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
21int 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}
Note: See TracBrowser for help on using the repository browser.