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.

36 lines
640 B

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