37 int F4::NB_THREAD=min(8, omp_get_num_procs());
46 int cyclic6F4(
bool magma)
48 cout <<
"#########################################################" << endl;
49 cout <<
"# CYCLIC 6 #" << endl;
50 cout <<
"#########################################################" << endl << endl;
62 vector<Polynomial<eltType>> polCyclic6;
65 polCyclic6.emplace_back(
"x0+x1+x2+x3+x4+x5");
66 polCyclic6.emplace_back(
"x0*x1+x1*x2+x2*x3+x3*x4+x0*x5+x4*x5");
67 polCyclic6.emplace_back(
"x0*x1*x2+x1*x2*x3+x2*x3*x4+x0*x1*x5+x0*x4*x5+x3*x4*x5");
68 polCyclic6.emplace_back(
"x0*x1*x2*x3+x1*x2*x3*x4+x0*x1*x2*x5+x0*x1*x4*x5+x0*x3*x4*x5+x2*x3*x4*x5");
69 polCyclic6.emplace_back(
"x0*x1*x2*x3*x4+x0*x1*x2*x3*x5+x0*x1*x2*x4*x5+x0*x1*x3*x4*x5+x0*x2*x3*x4*x5+x1*x2*x3*x4*x5");
70 polCyclic6.emplace_back(
"x0*x1*x2*x3*x4*x5-1");
81 cyclic6.printReducedGroebnerBasis(
"cyclic6", modulo);
87 int cyclic7F4(
bool magma)
89 cout <<
"#########################################################" << endl;
90 cout <<
"# CYCLIC 7 #" << endl;
91 cout <<
"#########################################################" << endl << endl;
103 vector<Polynomial<eltType>> polCyclic7;
106 polCyclic7.emplace_back(
"x0+x1+x2+x3+x4+x5+x6");
107 polCyclic7.emplace_back(
"x0*x1+x1*x2+x2*x3+x3*x4+x4*x5+x0*x6+x5*x6");
108 polCyclic7.emplace_back(
"x0*x1*x2+x1*x2*x3+x2*x3*x4+x3*x4*x5+x0*x1*x6+x0*x5*x6+x4*x5*x6");
109 polCyclic7.emplace_back(
"x0*x1*x2*x3+x1*x2*x3*x4+x2*x3*x4*x5+x0*x1*x2*x6+x0*x1*x5*x6+x0*x4*x5*x6+x3*x4*x5*x6");
110 polCyclic7.emplace_back(
"x0*x1*x2*x3*x4+x1*x2*x3*x4*x5+x0*x1*x2*x3*x6+x0*x1*x2*x5*x6+x0*x1*x4*x5*x6+x0*x3*x4*x5*x6+x2*x3*x4*x5*x6");
111 polCyclic7.emplace_back(
"x0*x1*x2*x3*x4*x5+x0*x1*x2*x3*x4*x6+x0*x1*x2*x3*x5*x6+x0*x1*x2*x4*x5*x6+x0*x1*x3*x4*x5*x6+x0*x2*x3*x4*x5*x6+x1*x2*x3*x4*x5*x6");
112 polCyclic7.emplace_back(
"x0*x1*x2*x3*x4*x5*x6-1");
123 cyclic7.printReducedGroebnerBasis(
"cyclic7", modulo);
129 int cyclic8F4(
bool magma)
132 cout <<
"#########################################################" << endl;
133 cout <<
"# CYCLIC 8 #" << endl;
134 cout <<
"#########################################################" << endl << endl;
146 vector<Polynomial<eltType>> polCyclic8;
149 polCyclic8.emplace_back(
"x0+x1+x2+x3+x4+x5+x6+x7");
150 polCyclic8.emplace_back(
"x0*x1+x1*x2+x2*x3+x3*x4+x4*x5+x5*x6+x0*x7+x6*x7");
151 polCyclic8.emplace_back(
"x0*x1*x2+x1*x2*x3+x2*x3*x4+x3*x4*x5+x4*x5*x6+x0*x1*x7+x0*x6*x7+x5*x6*x7");
152 polCyclic8.emplace_back(
"x0*x1*x2*x3+x1*x2*x3*x4+x2*x3*x4*x5+x3*x4*x5*x6+x0*x1*x2*x7+x0*x1*x6*x7+x0*x5*x6*x7+x4*x5*x6*x7");
153 polCyclic8.emplace_back(
"x0*x1*x2*x3*x4+x1*x2*x3*x4*x5+x2*x3*x4*x5*x6+x0*x1*x2*x3*x7+x0*x1*x2*x6*x7+x0*x1*x5*x6*x7+x0*x4*x5*x6*x7+x3*x4*x5*x6*x7");
154 polCyclic8.emplace_back(
"x0*x1*x2*x3*x4*x5+x1*x2*x3*x4*x5*x6+x0*x1*x2*x3*x4*x7+x0*x1*x2*x3*x6*x7+x0*x1*x2*x5*x6*x7+x0*x1*x4*x5*x6*x7+x0*x3*x4*x5*x6*x7+x2*x3*x4*x5*x6*x7");
155 polCyclic8.emplace_back(
"x0*x1*x2*x3*x4*x5*x6+x0*x1*x2*x3*x4*x5*x7+x0*x1*x2*x3*x4*x6*x7+x0*x1*x2*x3*x5*x6*x7+x0*x1*x2*x4*x5*x6*x7+x0*x1*x3*x4*x5*x6*x7+x0*x2*x3*x4*x5*x6*x7+x1*x2*x3*x4*x5*x6*x7");
156 polCyclic8.emplace_back(
"x0*x1*x2*x3*x4*x5*x6*x7-1");
167 cyclic8.printReducedGroebnerBasis(
"cyclic8", modulo);
173 int cyclic9F4(
bool magma)
176 cout <<
"#########################################################" << endl;
177 cout <<
"# CYCLIC 9 #" << endl;
178 cout <<
"#########################################################" << endl << endl;
190 vector<Polynomial<eltType>> polCyclic9;
193 polCyclic9.emplace_back(
"x0+x1+x2+x3+x4+x5+x6+x7+x8");
194 polCyclic9.emplace_back(
"x0*x1+x1*x2+x2*x3+x3*x4+x4*x5+x5*x6+x6*x7+x0*x8+x7*x8");
195 polCyclic9.emplace_back(
"x0*x1*x2+x1*x2*x3+x2*x3*x4+x3*x4*x5+x4*x5*x6+x5*x6*x7+x0*x1*x8+x0*x7*x8+x6*x7*x8");
196 polCyclic9.emplace_back(
"x0*x1*x2*x3+x1*x2*x3*x4+x2*x3*x4*x5+x3*x4*x5*x6+x4*x5*x6*x7+x0*x1*x2*x8+x0*x1*x7*x8+x0*x6*x7*x8+x5*x6*x7*x8");
197 polCyclic9.emplace_back(
"x0*x1*x2*x3*x4+x1*x2*x3*x4*x5+x2*x3*x4*x5*x6+x3*x4*x5*x6*x7+x0*x1*x2*x3*x8+x0*x1*x2*x7*x8+x0*x1*x6*x7*x8+x0*x5*x6*x7*x8+x4*x5*x6*x7*x8");
198 polCyclic9.emplace_back(
"x0*x1*x2*x3*x4*x5+x1*x2*x3*x4*x5*x6+x2*x3*x4*x5*x6*x7+x0*x1*x2*x3*x4*x8+x0*x1*x2*x3*x7*x8+x0*x1*x2*x6*x7*x8+x0*x1*x5*x6*x7*x8+x0*x4*x5*x6*x7*x8+x3*x4*x5*x6*x7*x8");
199 polCyclic9.emplace_back(
"x0*x1*x2*x3*x4*x5*x6+x1*x2*x3*x4*x5*x6*x7+x0*x1*x2*x3*x4*x5*x8+x0*x1*x2*x3*x4*x7*x8+x0*x1*x2*x3*x6*x7*x8+x0*x1*x2*x5*x6*x7*x8+x0*x1*x4*x5*x6*x7*x8+x0*x3*x4*x5*x6*x7*x8+x2*x3*x4*x5*x6*x7*x8");
200 polCyclic9.emplace_back(
"x0*x1*x2*x3*x4*x5*x6*x7+x0*x1*x2*x3*x4*x5*x6*x8+x0*x1*x2*x3*x4*x5*x7*x8+x0*x1*x2*x3*x4*x6*x7*x8+x0*x1*x2*x3*x5*x6*x7*x8+x0*x1*x2*x4*x5*x6*x7*x8+x0*x1*x3*x4*x5*x6*x7*x8+x0*x2*x3*x4*x5*x6*x7*x8+x1*x2*x3*x4*x5*x6*x7*x8");
201 polCyclic9.emplace_back(
"x0*x1*x2*x3*x4*x5*x6*x7*x8-1");
212 cyclic9.printReducedGroebnerBasis(
"cyclic9", modulo);
218 int katsura9F4(
bool magma)
220 cout <<
"#########################################################" << endl;
221 cout <<
"# KATSURA 9 #" << endl;
222 cout <<
"#########################################################" << endl << endl;
234 vector<Polynomial<eltType>> polKatsura9;
237 polKatsura9.emplace_back(
"x0+2*x1+2*x2+2*x3+2*x4+2*x5+2*x6+2*x7+2*x8-1");
238 polKatsura9.emplace_back(
"x0^2+2*x1^2+2*x2^2+2*x3^2+2*x4^2+2*x5^2+2*x6^2+2*x7^2+2*x8^2-x0");
239 polKatsura9.emplace_back(
"2*x0*x1+2*x1*x2+2*x2*x3+2*x3*x4+2*x4*x5+2*x5*x6+2*x6*x7+2*x7*x8-x1");
240 polKatsura9.emplace_back(
"x1^2+2*x0*x2+2*x1*x3+2*x2*x4+2*x3*x5+2*x4*x6+2*x5*x7+2*x6*x8-x2");
241 polKatsura9.emplace_back(
"2*x1*x2+2*x0*x3+2*x1*x4+2*x2*x5+2*x3*x6+2*x4*x7+2*x5*x8-x3");
242 polKatsura9.emplace_back(
"x2^2+2*x1*x3+2*x0*x4+2*x1*x5+2*x2*x6+2*x3*x7+2*x4*x8-x4");
243 polKatsura9.emplace_back(
"2*x2*x3+2*x1*x4+2*x0*x5+2*x1*x6+2*x2*x7+2*x3*x8-x5");
244 polKatsura9.emplace_back(
"x3^2+2*x2*x4+2*x1*x5+2*x0*x6+2*x1*x7+2*x2*x8-x6");
245 polKatsura9.emplace_back(
"2*x3*x4+2*x2*x5+2*x1*x6+2*x0*x7+2*x1*x8-x7");
256 katsura9.printReducedGroebnerBasis(
"katsura9", modulo);
262 int katsura10F4(
bool magma)
264 cout <<
"#########################################################" << endl;
265 cout <<
"# KATSURA 10 #" << endl;
266 cout <<
"#########################################################" << endl << endl;
278 vector<Polynomial<eltType>> polKatsura10;
281 polKatsura10.emplace_back(
"x0+2*x1+2*x2+2*x3+2*x4+2*x5+2*x6+2*x7+2*x8+2*x9-1");
282 polKatsura10.emplace_back(
"x0^2+2*x1^2+2*x2^2+2*x3^2+2*x4^2+2*x5^2+2*x6^2+2*x7^2+2*x8^2+2*x9^2-x0");
283 polKatsura10.emplace_back(
"2*x0*x1+2*x1*x2+2*x2*x3+2*x3*x4+2*x4*x5+2*x5*x6+2*x6*x7+2*x7*x8+2*x8*x9-x1");
284 polKatsura10.emplace_back(
"x1^2+2*x0*x2+2*x1*x3+2*x2*x4+2*x3*x5+2*x4*x6+2*x5*x7+2*x6*x8+2*x7*x9-x2");
285 polKatsura10.emplace_back(
"2*x1*x2+2*x0*x3+2*x1*x4+2*x2*x5+2*x3*x6+2*x4*x7+2*x5*x8+2*x6*x9-x3");
286 polKatsura10.emplace_back(
"x2^2+2*x1*x3+2*x0*x4+2*x1*x5+2*x2*x6+2*x3*x7+2*x4*x8+2*x5*x9-x4");
287 polKatsura10.emplace_back(
"2*x2*x3+2*x1*x4+2*x0*x5+2*x1*x6+2*x2*x7+2*x3*x8+2*x4*x9-x5");
288 polKatsura10.emplace_back(
"x3^2+2*x2*x4+2*x1*x5+2*x0*x6+2*x1*x7+2*x2*x8+2*x3*x9-x6");
289 polKatsura10.emplace_back(
"2*x3*x4+2*x2*x5+2*x1*x6+2*x0*x7+2*x1*x8+2*x2*x9-x7");
290 polKatsura10.emplace_back(
"x4^2+2*x3*x5+2*x2*x6+2*x1*x7+2*x0*x8+2*x1*x9-x8");
296 nbGen=katsura10.f4();
301 katsura10.printReducedGroebnerBasis(
"katsura10", modulo);
306 int katsura11F4(
bool magma)
308 cout <<
"#########################################################" << endl;
309 cout <<
"# KATSURA 11 #" << endl;
310 cout <<
"#########################################################" << endl << endl;
322 vector<Polynomial<eltType>> polKatsura11;
325 polKatsura11.emplace_back(
"x0+2*x1+2*x2+2*x3+2*x4+2*x5+2*x6+2*x7+2*x8+2*x9+2*x10-1");
326 polKatsura11.emplace_back(
"x0^2+2*x1^2+2*x2^2+2*x3^2+2*x4^2+2*x5^2+2*x6^2+2*x7^2+2*x8^2+2*x9^2+2*x10^2-x0");
327 polKatsura11.emplace_back(
"2*x0*x1+2*x1*x2+2*x2*x3+2*x3*x4+2*x4*x5+2*x5*x6+2*x6*x7+2*x7*x8+2*x8*x9+2*x9*x10-x1");
328 polKatsura11.emplace_back(
"x1^2+2*x0*x2+2*x1*x3+2*x2*x4+2*x3*x5+2*x4*x6+2*x5*x7+2*x6*x8+2*x7*x9+2*x8*x10-x2");
329 polKatsura11.emplace_back(
"2*x1*x2+2*x0*x3+2*x1*x4+2*x2*x5+2*x3*x6+2*x4*x7+2*x5*x8+2*x6*x9+2*x7*x10-x3");
330 polKatsura11.emplace_back(
"x2^2+2*x1*x3+2*x0*x4+2*x1*x5+2*x2*x6+2*x3*x7+2*x4*x8+2*x5*x9+2*x6*x10-x4");
331 polKatsura11.emplace_back(
"2*x2*x3+2*x1*x4+2*x0*x5+2*x1*x6+2*x2*x7+2*x3*x8+2*x4*x9+2*x5*x10-x5");
332 polKatsura11.emplace_back(
"x3^2+2*x2*x4+2*x1*x5+2*x0*x6+2*x1*x7+2*x2*x8+2*x3*x9+2*x4*x10-x6");
333 polKatsura11.emplace_back(
"2*x3*x4+2*x2*x5+2*x1*x6+2*x0*x7+2*x1*x8+2*x2*x9+2*x3*x10-x7");
334 polKatsura11.emplace_back(
"x4^2+2*x3*x5+2*x2*x6+2*x1*x7+2*x0*x8+2*x1*x9+2*x2*x10-x8");
335 polKatsura11.emplace_back(
"2*x4*x5+2*x3*x6+2*x2*x7+2*x1*x8+2*x0*x9+2*x1*x10-x9");
341 nbGen=katsura11.f4();
346 katsura11.printReducedGroebnerBasis(
"katsura11", modulo);
351 int katsura12F4(
bool magma)
353 cout <<
"#########################################################" << endl;
354 cout <<
"# KATSURA 12 #" << endl;
355 cout <<
"#########################################################" << endl << endl;
367 vector<Polynomial<eltType>> polKatsura12;
370 polKatsura12.emplace_back(
"x0+2*x1+2*x2+2*x3+2*x4+2*x5+2*x6+2*x7+2*x8+2*x9+2*x10+2*x11-1");
371 polKatsura12.emplace_back(
"x0^2+2*x1^2+2*x2^2+2*x3^2+2*x4^2+2*x5^2+2*x6^2+2*x7^2+2*x8^2+2*x9^2+2*x10^2+2*x11^2-x0");
372 polKatsura12.emplace_back(
"2*x0*x1+2*x1*x2+2*x2*x3+2*x3*x4+2*x4*x5+2*x5*x6+2*x6*x7+2*x7*x8+2*x8*x9+2*x9*x10+2*x10*x11-x1");
373 polKatsura12.emplace_back(
"x1^2+2*x0*x2+2*x1*x3+2*x2*x4+2*x3*x5+2*x4*x6+2*x5*x7+2*x6*x8+2*x7*x9+2*x8*x10+2*x9*x11-x2");
374 polKatsura12.emplace_back(
"2*x1*x2+2*x0*x3+2*x1*x4+2*x2*x5+2*x3*x6+2*x4*x7+2*x5*x8+2*x6*x9+2*x7*x10+2*x8*x11-x3");
375 polKatsura12.emplace_back(
"x2^2+2*x1*x3+2*x0*x4+2*x1*x5+2*x2*x6+2*x3*x7+2*x4*x8+2*x5*x9+2*x6*x10+2*x7*x11-x4");
376 polKatsura12.emplace_back(
"2*x2*x3+2*x1*x4+2*x0*x5+2*x1*x6+2*x2*x7+2*x3*x8+2*x4*x9+2*x5*x10+2*x6*x11-x5");
377 polKatsura12.emplace_back(
"x3^2+2*x2*x4+2*x1*x5+2*x0*x6+2*x1*x7+2*x2*x8+2*x3*x9+2*x4*x10+2*x5*x11-x6");
378 polKatsura12.emplace_back(
"2*x3*x4+2*x2*x5+2*x1*x6+2*x0*x7+2*x1*x8+2*x2*x9+2*x3*x10+2*x4*x11-x7");
379 polKatsura12.emplace_back(
"x4^2+2*x3*x5+2*x2*x6+2*x1*x7+2*x0*x8+2*x1*x9+2*x2*x10+2*x3*x11-x8");
380 polKatsura12.emplace_back(
"2*x4*x5+2*x3*x6+2*x2*x7+2*x1*x8+2*x0*x9+2*x1*x10+2*x2*x11-x9");
381 polKatsura12.emplace_back(
"x5^2+2*x4*x6+2*x3*x7+2*x2*x8+2*x1*x9+2*x0*x10+2*x1*x11-x10");
387 nbGen=katsura12.f4();
392 katsura12.printReducedGroebnerBasis(
"katsura12", modulo);
398 int randomIdealF4(
bool magma)
400 cout <<
"#########################################################" << endl;
401 cout <<
"# RANDOM 10 #" << endl;
402 cout <<
"#########################################################" << endl << endl;
414 vector<Polynomial<eltType>> polRandomIdeal;
417 polRandomIdeal.emplace_back(
"-60*x0^3*x1^2 - 100*x2^4*x3 + 100*x0^2*x3^2*x4 - 88*x1*x3^2*x4^2 - 115*x1*x2*x3*x5^2 - 17*x2*x3*x4*x5^2 - 55*x4^4 - 36*x1*x3^2*x5 - 59*x2*x3^2*x5 - 78*x1*x2*x4");
418 polRandomIdeal.emplace_back(
"54*x1^2*x2^3 + 61*x3^5 + 18*x1^3*x3*x4 + 69*x1*x3^3*x4 + 17*x0^2*x2*x4^2 + 49*x0*x1*x3*x4*x5 + 18*x2*x3*x5^3 - 90*x0*x1*x3^2 - 65*x0 - 44*x3");
419 polRandomIdeal.emplace_back(
"-29*x0*x2^2*x3*x4 + 48*x0*x2*x3*x4^2 + 109*x0*x3*x4^2*x5 - 85*x0*x1*x3*x5^2 - 86*x0*x3^2*x4 + 95*x1^2*x4^2 + 109*x1^2*x2*x5 + 26*x0^2*x5 + 110*x0^2 + 103*x1^2");
420 polRandomIdeal.emplace_back(
"-6*x2^3*x3^2 + 13*x0*x1*x2*x3*x4 - 45*x2^3*x3*x4 + 99*x1^2*x2^2*x5 - 57*x0^3*x4*x5 + 31*x0^2*x2*x4*x5 + 55*x0*x2^2*x5^2 + 114*x0^2*x2*x5 - 46*x2^2*x5 + 83*x2*x5^2");
421 polRandomIdeal.emplace_back(
"-101*x0*x1^4 - 9*x1^2*x2^2*x3 + x4^5 + 75*x2*x4*x5^3 - 3*x0^2*x1*x2 - 104*x0*x1*x3*x4 - 68*x0*x2*x3*x4 - 64*x1^2*x3 - 54*x5^2");
422 polRandomIdeal.emplace_back(
"-105*x0^2*x4^3 + 83*x1^2*x3^2*x5 + 48*x2*x3^3*x5 + 23*x1*x4^3*x5 - 82*x0*x1*x5^3 - 77*x2^2*x4*x5 + 84*x1*x2*x5^2 - 14*x0^2*x2 + 75*x3^2*x4 - 91*x1*x5^2");
423 polRandomIdeal.emplace_back(
"-59*x0*x1^2*x2^2 - 62*x0*x1*x2^2*x3 - 104*x0*x1*x3*x4*x5 + 65*x0*x1*x2^2 - 95*x0^2*x3^2 - 60*x1^2*x4^2 - 6*x2*x4^3 + 119*x1*x3*x5^2 + 67*x2^3 - 52*x2*x5^2");
424 polRandomIdeal.emplace_back(
"32*x2^2*x3^3 - 70*x0*x1^2*x4^2 + 88*x0^4*x5 + 39*x0*x1*x3^2*x5 + 57*x1*x2*x3*x5^2 + 117*x1*x4^2*x5^2 - 105*x0*x1*x2^2 + 69*x1*x2*x5^2 - 119*x0*x5^3 + 86*x0*x1*x3");
425 polRandomIdeal.emplace_back(
"65*x1^3*x3^2 - 114*x0^2*x1*x2*x4 - 69*x0*x3^3*x4 - 84*x1^2*x4^3 + 43*x1^3*x4*x5 - 120*x1^3*x5^2 + 58*x0*x1^2*x3 - 61*x1*x2^2*x3 - 76*x1*x2^2*x4 - 46*x2*x3^2*x5");
426 polRandomIdeal.emplace_back(
"43*x1^4*x3 + 35*x2*x3*x4*x5^2 + 85*x0*x4*x5^3 + 48*x1*x2^2*x3 - 2*x1*x2*x3^2 - 52*x1^2*x3*x4 - 30*x1^2*x3*x5 + 11*x0*x3^2*x5 + 34*x0*x2*x4 - 3*x1*x3*x4");
432 nbGen=randomIdeal.f4();
437 randomIdeal.printReducedGroebnerBasis(
"randomIdeal", modulo);
443 int main (
int argc,
char **argv)
445 cout <<
"#########################################################" << endl;
446 cout <<
"# BENCHMARK SHORT #" << endl;
447 cout <<
"#########################################################" << endl << endl;
450 chrono::steady_clock::time_point start;
451 typedef chrono::duration<int,milli> millisecs_t;
454 cout << NB_THREAD <<
" threads used " << endl << endl;
463 ofstream file(
"benchmark-short.txt");
466 file <<
"Benchmark for ideal with integer type coefficient." << endl << endl << endl;
469 start=chrono::steady_clock::now();
470 nbGen=randomIdealF4(magma);
473 file <<
"Random 10 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() <<
" ms (" << nbGen <<
" generators)" << endl << endl;
490 start=chrono::steady_clock::now();
491 nbGen=cyclic8F4(magma);
494 file <<
"Cyclic 8 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() <<
" ms (" << nbGen <<
" generators)" << endl << endl;
525 start=chrono::steady_clock::now();
526 nbGen=katsura12F4(magma);
529 file <<
"Katsura 12 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() <<
" ms (" << nbGen <<
" generators)" << endl << endl;
static void initMonomial(int nbVariable, short degree=0)
Initialise the static parameters of Monomial.
Represent an element of an extension of GF2, this class is a POD (Plain Old Data) because of the alig...
Represent an element of a prime field, this class is a POD (Plain Old Data) because of the alignement...
static void setModulo(baseType modulo)
Set the static variable MODULO.
Declaration of class F4 methods.