]> www.ginac.de Git - cln.git/blob - tests/timecatalan.cc
Initial revision
[cln.git] / tests / timecatalan.cc
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
11 int main (int argc, char * argv[])
12 {
13         int repetitions = 1;
14         if ((argc >= 3) && !strcmp(argv[1],"-r")) {
15                 repetitions = atoi(argv[2]);
16                 argc -= 2; argv += 2;
17         }
18         if (argc < 2)
19                 exit(1);
20         uintL len = atoi(argv[1]);
21         extern cl_LF compute_catalanconst_ramanujan (uintC len);
22         extern cl_LF compute_catalanconst_ramanujan_fast (uintC len);
23         extern cl_LF compute_catalanconst_expintegral1 (uintC len);
24         extern cl_LF compute_catalanconst_expintegral2 (uintC len);
25         extern cl_LF compute_catalanconst_cvz1 (uintC len);
26         extern cl_LF compute_catalanconst_cvz2 (uintC len);
27         cl_LF p;
28         ln(cl_I_to_LF(1000,len+10)); // fill cache
29         { CL_TIMING;
30           for (int rep = repetitions; rep > 0; rep--)
31             { p = compute_catalanconst_ramanujan(len); }
32         }
33         cout << p << endl;
34         { CL_TIMING;
35           for (int rep = repetitions; rep > 0; rep--)
36             { p = compute_catalanconst_ramanujan_fast(len); }
37         }
38         cout << p << endl;
39 #if 0
40         { CL_TIMING;
41           for (int rep = repetitions; rep > 0; rep--)
42             { p = compute_catalanconst_expintegral1(len); }
43         }
44         cout << p << endl;
45         { CL_TIMING;
46           for (int rep = repetitions; rep > 0; rep--)
47             { p = compute_catalanconst_expintegral2(len); }
48         }
49         cout << p << endl;
50 #endif
51         { CL_TIMING;
52           for (int rep = repetitions; rep > 0; rep--)
53             { p = compute_catalanconst_cvz1(len); }
54         }
55         cout << p << endl;
56         { CL_TIMING;
57           for (int rep = repetitions; rep > 0; rep--)
58             { p = compute_catalanconst_cvz2(len); }
59         }
60         cout << p << endl;
61 }