1 #include <cln/number.h>
3 #include <cln/integer.h>
4 #include <cln/modinteger.h>
7 #include <cln/timing.h>
10 int main (int argc, char * argv[])
13 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
14 repetitions = atoi(argv[2]);
19 cl_I p = "1269281897404513557783934075031171555202695168107";
20 cl_modint_ring R = find_modint_ring(p);
22 cl_MI a = R->canonhom("1111111111111111111111111111111111111111111111111");
23 cl_MI b = R->canonhom("777777777777777777777777777777777777777777777777");
24 cout << "product modulo p" << endl;
26 for (int rep = repetitions; rep > 0; rep--)
27 { cl_MI c = R->mul(a,b); }
29 cout << "square modulo p" << endl;
31 for (int rep = repetitions; rep > 0; rep--)
32 { cl_MI c = R->square(a); }
34 cout << "quotient modulo p" << endl;
36 for (int rep = repetitions; rep > 0; rep--)
37 { cl_MI c = R->div(a,b); }
41 cl_MI a = R->canonhom("1234567890123456789012345678901234567890123456789");
42 cl_MI b = R->canonhom("909090909090909090909090909090909090909090909090");
43 cout << "product modulo p" << endl;
45 for (int rep = repetitions; rep > 0; rep--)
46 { cl_MI c = R->mul(a,b); }
48 cout << "square modulo p" << endl;
50 for (int rep = repetitions; rep > 0; rep--)
51 { cl_MI c = R->square(a); }
53 cout << "quotient modulo p" << endl;
55 for (int rep = repetitions; rep > 0; rep--)
56 { cl_MI c = R->div(a,b); }