benchmarkSlice.cpp
Go to the documentation of this file.
1 // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
2 
3 #include <iostream>
4 
5 #include <Eigen/Core>
6 
7 using namespace std;
8 using namespace Eigen;
9 
10 #ifndef REPEAT
11 #define REPEAT 10000
12 #endif
13 
14 #ifndef SCALAR
15 #define SCALAR float
16 #endif
17 
18 int main(int argc, char *argv[])
19 {
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 }
Matrix3f m
#define SCALAR
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
Definition: BFloat16.h:88
#define REPEAT
Matrix< Scalar, Dynamic, Dynamic > Mat
Definition: gemm_common.h:15
int main(int argc, char *argv[])
The matrix class, also used for vectors and row-vectors.
Derived & setRandom(Index size)
Definition: Random.h:151


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:33:57