1 #include <cln/number.h>
3 #include <cln/integer.h>
4 #include <cln/modinteger.h>
7 #include <cln/timing.h>
12 int main (int argc, char * argv[])
15 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
16 repetitions = atoi(argv[2]);
21 cl_I p = "1269281897404513557783934075031171555202695168107";
22 cl_modint_ring R = find_modint_ring(p);
24 cl_MI a = R->canonhom("1111111111111111111111111111111111111111111111111");
25 cl_MI b = R->canonhom("777777777777777777777777777777777777777777777777");
26 cout << "product modulo p" << endl;
28 for (int rep = repetitions; rep > 0; rep--)
29 { cl_MI c = R->mul(a,b); }
31 cout << "square modulo p" << endl;
33 for (int rep = repetitions; rep > 0; rep--)
34 { cl_MI c = R->square(a); }
36 cout << "quotient modulo p" << endl;
38 for (int rep = repetitions; rep > 0; rep--)
39 { cl_MI c = R->div(a,b); }
43 cl_MI a = R->canonhom("1234567890123456789012345678901234567890123456789");
44 cl_MI b = R->canonhom("909090909090909090909090909090909090909090909090");
45 cout << "product modulo p" << endl;
47 for (int rep = repetitions; rep > 0; rep--)
48 { cl_MI c = R->mul(a,b); }
50 cout << "square modulo p" << endl;
52 for (int rep = repetitions; rep > 0; rep--)
53 { cl_MI c = R->square(a); }
55 cout << "quotient modulo p" << endl;
57 for (int rep = repetitions; rep > 0; rep--)
58 { cl_MI c = R->div(a,b); }