1 #include <cln/number.h>
3 #include <cln/integer.h>
4 #include <cln/modinteger.h>
7 #include <cln/timing.h>
9 int main (int argc, char * argv[])
12 if ((argc >= 3) && !strcmp(argv[1],"-r")) {
13 repetitions = atoi(argv[2]);
18 cl_I p = "1269281897404513557783934075031171555202695168107";
19 cl_modint_ring R = find_modint_ring(p);
21 cl_MI a = R->canonhom("1111111111111111111111111111111111111111111111111");
22 cl_MI b = R->canonhom("777777777777777777777777777777777777777777777777");
23 stdout << "product modulo p" << endl;
25 for (int rep = repetitions; rep > 0; rep--)
26 { cl_MI c = R->mul(a,b); }
28 stdout << "square modulo p" << endl;
30 for (int rep = repetitions; rep > 0; rep--)
31 { cl_MI c = R->square(a); }
33 stdout << "quotient modulo p" << endl;
35 for (int rep = repetitions; rep > 0; rep--)
36 { cl_MI c = R->div(a,b); }
40 cl_MI a = R->canonhom("1234567890123456789012345678901234567890123456789");
41 cl_MI b = R->canonhom("909090909090909090909090909090909090909090909090");
42 stdout << "product modulo p" << endl;
44 for (int rep = repetitions; rep > 0; rep--)
45 { cl_MI c = R->mul(a,b); }
47 stdout << "square modulo p" << endl;
49 for (int rep = repetitions; rep > 0; rep--)
50 { cl_MI c = R->square(a); }
52 stdout << "quotient modulo p" << endl;
54 for (int rep = repetitions; rep > 0; rep--)
55 { cl_MI c = R->div(a,b); }