3 #include <cl_integer.h>
4 #include <cl_modinteger.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 = cl_find_modint_ring(p);
21 cl_MI a = R->canonhom("1111111111111111111111111111111111111111111111111");
22 cl_MI b = R->canonhom("777777777777777777777777777777777777777777777777");
23 cl_stdout << "product modulo p" << endl;
25 for (int rep = repetitions; rep > 0; rep--)
26 { cl_MI c = R->mul(a,b); }
28 cl_stdout << "square modulo p" << endl;
30 for (int rep = repetitions; rep > 0; rep--)
31 { cl_MI c = R->square(a); }
33 cl_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 cl_stdout << "product modulo p" << endl;
44 for (int rep = repetitions; rep > 0; rep--)
45 { cl_MI c = R->mul(a,b); }
47 cl_stdout << "square modulo p" << endl;
49 for (int rep = repetitions; rep > 0; rep--)
50 { cl_MI c = R->square(a); }
52 cl_stdout << "quotient modulo p" << endl;
54 for (int rep = repetitions; rep > 0; rep--)
55 { cl_MI c = R->div(a,b); }