]> www.ginac.de Git - cln.git/blob - tests/timezeta3.cc
Make GCC compiler flags default to -O
[cln.git] / tests / timezeta3.cc
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
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 zeta (int s, uintC len);
22         extern cl_LF compute_zeta_exp (int s, uintC len);
23         extern cl_LF compute_zeta_cvz1 (int s, uintC len);
24         extern cl_LF compute_zeta_cvz2 (int s, uintC len);
25         extern cl_LF zeta3 (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_zeta_exp(3,len); }
31         }
32         cout << p << endl;
33         { CL_TIMING;
34           for (int rep = repetitions; rep > 0; rep--)
35             { p = compute_zeta_cvz1(3,len); }
36         }
37         cout << p << endl;
38         { CL_TIMING;
39           for (int rep = repetitions; rep > 0; rep--)
40             { p = compute_zeta_cvz2(3,len); }
41         }
42         cout << p << endl;
43         { CL_TIMING;
44           for (int rep = repetitions; rep > 0; rep--)
45             { p = zeta3(len); }
46         }
47         cout << p << endl;
48 }