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.

61 lines
1.6 KiB

25 years ago
  1. #include <cl_number.h>
  2. #include <cl_io.h>
  3. #include <cl_float.h>
  4. #include <cl_real.h>
  5. #include <cl_random.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <cl_timing.h>
  9. #include "cl_LF.h"
  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 compute_catalanconst_ramanujan (uintC len);
  21. extern cl_LF compute_catalanconst_ramanujan_fast (uintC len);
  22. extern cl_LF compute_catalanconst_expintegral1 (uintC len);
  23. extern cl_LF compute_catalanconst_expintegral2 (uintC len);
  24. extern cl_LF compute_catalanconst_cvz1 (uintC len);
  25. extern cl_LF compute_catalanconst_cvz2 (uintC len);
  26. cl_LF p;
  27. ln(cl_I_to_LF(1000,len+10)); // fill cache
  28. { CL_TIMING;
  29. for (int rep = repetitions; rep > 0; rep--)
  30. { p = compute_catalanconst_ramanujan(len); }
  31. }
  32. cout << p << endl;
  33. { CL_TIMING;
  34. for (int rep = repetitions; rep > 0; rep--)
  35. { p = compute_catalanconst_ramanujan_fast(len); }
  36. }
  37. cout << p << endl;
  38. #if 0
  39. { CL_TIMING;
  40. for (int rep = repetitions; rep > 0; rep--)
  41. { p = compute_catalanconst_expintegral1(len); }
  42. }
  43. cout << p << endl;
  44. { CL_TIMING;
  45. for (int rep = repetitions; rep > 0; rep--)
  46. { p = compute_catalanconst_expintegral2(len); }
  47. }
  48. cout << p << endl;
  49. #endif
  50. { CL_TIMING;
  51. for (int rep = repetitions; rep > 0; rep--)
  52. { p = compute_catalanconst_cvz1(len); }
  53. }
  54. cout << p << endl;
  55. { CL_TIMING;
  56. for (int rep = repetitions; rep > 0; rep--)
  57. { p = compute_catalanconst_cvz2(len); }
  58. }
  59. cout << p << endl;
  60. }