source: pacpussensors/trunk/Vislab/lib3dv-1.2.0/lib3dv/eigen/bench/benchmarkSlice.cpp@ 139

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

Doc

File size: 835 bytes
Line 
1// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
2
3#include <iostream>
4
5#include <Eigen/Core>
6
7using namespace std;
8using namespace Eigen;
9
10#ifndef REPEAT
11#define REPEAT 10000
12#endif
13
14#ifndef SCALAR
15#define SCALAR float
16#endif
17
18int main(int argc, char *argv[])
19{
20 typedef Matrix<SCALAR, Eigen::Dynamic, Eigen::Dynamic> Mat;
21 Mat m(100, 100);
22 m.setRandom();
23
24 for(int a = 0; a < REPEAT; a++)
25 {
26 int r, c, nr, nc;
27 r = Eigen::internal::random<int>(0,10);
28 c = Eigen::internal::random<int>(0,10);
29 nr = Eigen::internal::random<int>(50,80);
30 nc = Eigen::internal::random<int>(50,80);
31 m.block(r,c,nr,nc) += Mat::Ones(nr,nc);
32 m.block(r,c,nr,nc) *= SCALAR(10);
33 m.block(r,c,nr,nc) -= Mat::constant(nr,nc,10);
34 m.block(r,c,nr,nc) /= SCALAR(10);
35 }
36 cout << m[0] << endl;
37 return 0;
38}
Note: See TracBrowser for help on using the repository browser.