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

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

Doc

File size: 640 bytes
Line 
1// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
2
3#include <iostream>
4
5#include <Eigen/Core>
6
7using namespace std;
8using namespace Eigen;
9
10#ifndef MATTYPE
11#define MATTYPE MatrixXLd
12#endif
13
14#ifndef MATSIZE
15#define MATSIZE 400
16#endif
17
18#ifndef REPEAT
19#define REPEAT 100
20#endif
21
22int main(int argc, char *argv[])
23{
24 MATTYPE I = MATTYPE::Ones(MATSIZE,MATSIZE);
25 MATTYPE m(MATSIZE,MATSIZE);
26 for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++)
27 {
28 m(i,j) = (i+j+1)/(MATSIZE*MATSIZE);
29 }
30 for(int a = 0; a < REPEAT; a++)
31 {
32 m = I + 0.0001 * (m + m*m);
33 }
34 cout << m(0,0) << endl;
35 return 0;
36}
Note: See TracBrowser for help on using the repository browser.