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.

48 lines
1.1 KiB

25 years ago
25 years ago
25 years ago
25 years ago
25 years ago
  1. #include <cln/number.h>
  2. #include <cln/io.h>
  3. #include <cln/float.h>
  4. #include <cln/real.h>
  5. #include <cstdlib>
  6. #include <cstring>
  7. #include <cln/timing.h>
  8. #include "cl_LF.h"
  9. using namespace cln;
  10. int main (int argc, char * argv[])
  11. {
  12. int repetitions = 1;
  13. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  14. repetitions = atoi(argv[2]);
  15. argc -= 2; argv += 2;
  16. }
  17. if (argc < 2)
  18. exit(1);
  19. uintL len = atoi(argv[1]);
  20. extern cl_LF zeta (int s, uintC len);
  21. extern cl_LF compute_zeta_exp (int s, uintC len);
  22. extern cl_LF compute_zeta_cvz1 (int s, uintC len);
  23. extern cl_LF compute_zeta_cvz2 (int s, uintC len);
  24. extern cl_LF zeta3 (uintC len);
  25. cl_LF p;
  26. ln(cl_I_to_LF(1000,len+10)); // fill cache
  27. { CL_TIMING;
  28. for (int rep = repetitions; rep > 0; rep--)
  29. { p = compute_zeta_exp(3,len); }
  30. }
  31. cout << p << endl;
  32. { CL_TIMING;
  33. for (int rep = repetitions; rep > 0; rep--)
  34. { p = compute_zeta_cvz1(3,len); }
  35. }
  36. cout << p << endl;
  37. { CL_TIMING;
  38. for (int rep = repetitions; rep > 0; rep--)
  39. { p = compute_zeta_cvz2(3,len); }
  40. }
  41. cout << p << endl;
  42. { CL_TIMING;
  43. for (int rep = repetitions; rep > 0; rep--)
  44. { p = zeta3(len); }
  45. }
  46. cout << p << endl;
  47. }