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.

54 lines
1.2 KiB

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 "float/lfloat/cl_LF.h"
  9. namespace cln
  10. {
  11. // FIXME: don't use internal functions.
  12. extern cl_LF zeta (int s, uintC len);
  13. extern cl_LF compute_zeta_exp (int s, uintC len);
  14. extern cl_LF compute_zeta_cvz1 (int s, uintC len);
  15. extern cl_LF compute_zeta_cvz2 (int s, uintC len);
  16. extern cl_LF zeta3 (uintC len);
  17. }
  18. using namespace cln;
  19. #include <iostream>
  20. using namespace std;
  21. int main (int argc, char * argv[])
  22. {
  23. int repetitions = 1;
  24. if ((argc >= 3) && !strcmp(argv[1],"-r")) {
  25. repetitions = atoi(argv[2]);
  26. argc -= 2; argv += 2;
  27. }
  28. if (argc < 2)
  29. exit(1);
  30. uintL len = atoi(argv[1]);
  31. cl_LF p;
  32. ln(cl_I_to_LF(1000,len+10)); // fill cache
  33. { CL_TIMING;
  34. for (int rep = repetitions; rep > 0; rep--)
  35. { p = compute_zeta_exp(3,len); }
  36. }
  37. cout << p << endl;
  38. { CL_TIMING;
  39. for (int rep = repetitions; rep > 0; rep--)
  40. { p = compute_zeta_cvz1(3,len); }
  41. }
  42. cout << p << endl;
  43. { CL_TIMING;
  44. for (int rep = repetitions; rep > 0; rep--)
  45. { p = compute_zeta_cvz2(3,len); }
  46. }
  47. cout << p << endl;
  48. { CL_TIMING;
  49. for (int rep = repetitions; rep > 0; rep--)
  50. { p = zeta3(len); }
  51. }
  52. cout << p << endl;
  53. }