You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
875 B

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