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 }
Eigen
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
c
Scalar Scalar * c
Definition: benchVecAdd.cpp:17
SCALAR
#define SCALAR
Definition: benchmarkSlice.cpp:15
Mat
Matrix< Scalar, Dynamic, Dynamic > Mat
Definition: gemm_common.h:15
m
Matrix3f m
Definition: AngleAxis_mimic_euler.cpp:1
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
main
int main(int argc, char *argv[])
Definition: benchmarkSlice.cpp:18
std
Definition: BFloat16.h:88
Eigen::Matrix
The matrix class, also used for vectors and row-vectors.
Definition: 3rdparty/Eigen/Eigen/src/Core/Matrix.h:178
REPEAT
#define REPEAT
Definition: benchmarkSlice.cpp:11
test_virtual_functions.nc
nc
Definition: test_virtual_functions.py:207


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