F4
Library for Gröebner basis computation in finite field.
 All Classes Namespaces Files Functions Variables Friends Pages
benchmark-long.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Antoine Joux, Vanessa Vitse and Titouan Coladon
3  *
4  * This file is part of F4.
5  *
6  * F4 is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * F4 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with F4. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
28 #include <iostream>
29 #include <f4.h>
30 
31 using namespace F4;
32 using namespace std;
33 
34 // Global variable
35 int F4::VERBOSE=0;
36 #ifdef USE_OPENMP
37 int F4::NB_THREAD=min(8, omp_get_num_procs());
38 #else
39 int F4::NB_THREAD=1;
40 #endif
41 
42 // Init element-prime tools
44 int64_t modulo=4294967291LL;
45 
46 int cyclic6F4(bool magma)
47 {
48  cout << "#########################################################" << endl;
49  cout << "# CYCLIC 6 #" << endl;
50  cout << "#########################################################" << endl << endl;
51 
52  // Init element-prime tools
53  eltType::setModulo(modulo);
54 
55  // Number of generator
56  int nbGen;
57 
58  // Init monomial tools
60 
61  // Create polynomial array
62  vector<Polynomial<eltType>> polCyclic6;
63 
64  // Fill the polynomial array
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");
71 
72  // Create cyclic6 ideal;
73  Ideal<eltType> cyclic6(polCyclic6, 6, 100000);
74 
75  // Compute a reduced groebner basis;
76  nbGen=cyclic6.f4();
77 
78  // Print the reduced groebner basis into a file
79  if(magma)
80  {
81  cyclic6.printReducedGroebnerBasis("cyclic6", modulo);
82  }
83 
84  return nbGen;
85 }
86 
87 int cyclic7F4(bool magma)
88 {
89  cout << "#########################################################" << endl;
90  cout << "# CYCLIC 7 #" << endl;
91  cout << "#########################################################" << endl << endl;
92 
93  // Init element-prime tools
94  eltType::setModulo(modulo);
95 
96  // Number of generator
97  int nbGen;
98 
99  // Init monomial tools
101 
102  // Create polynomial array
103  vector<Polynomial<eltType>> polCyclic7;
104 
105  // Fill the polynomial array
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");
113 
114  // Create cyclic7 ideal;
115  Ideal<eltType> cyclic7(polCyclic7, 7 , 1000000);
116 
117  // Compute a reduced groebner basis;
118  nbGen=cyclic7.f4();
119 
120  // Print the reduced groebner basis into a file
121  if(magma)
122  {
123  cyclic7.printReducedGroebnerBasis("cyclic7", modulo);
124  }
125 
126  return nbGen;
127 }
128 
129 int cyclic8F4(bool magma)
130 {
131 
132  cout << "#########################################################" << endl;
133  cout << "# CYCLIC 8 #" << endl;
134  cout << "#########################################################" << endl << endl;
135 
136  // Init element-prime tools
137  eltType::setModulo(modulo);
138 
139  // Number of generator
140  int nbGen;
141 
142  // Init monomial tools
144 
145  // Create polynomial array
146  vector<Polynomial<eltType>> polCyclic8;
147 
148  // Fill the polynomial array
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");
157 
158  // Create cyclic8 ideal;
159  Ideal<eltType> cyclic8(polCyclic8, 8, 1000000);
160 
161  // Compute a reduced groebner basis;
162  nbGen=cyclic8.f4();
163 
164  // Print the reduced groebner basis into a file
165  if(magma)
166  {
167  cyclic8.printReducedGroebnerBasis("cyclic8", modulo);
168  }
169 
170  return nbGen;
171 }
172 
173 int cyclic9F4(bool magma)
174 {
175 
176  cout << "#########################################################" << endl;
177  cout << "# CYCLIC 9 #" << endl;
178  cout << "#########################################################" << endl << endl;
179 
180  // Init element-prime tools
181  eltType::setModulo(modulo);
182 
183  // Number of generator
184  int nbGen;
185 
186  // Init monomial tools
188 
189  // Create polynomial array
190  vector<Polynomial<eltType>> polCyclic9;
191 
192  // Fill the polynomial array
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");
202 
203  // Create cyclic9 ideal;
204  Ideal<eltType> cyclic9(polCyclic9, 9, 20000000);
205 
206  // Compute a reduced groebner basis;
207  nbGen=cyclic9.f4();
208 
209  // Print the reduced groebner basis into a file
210  if(magma)
211  {
212  cyclic9.printReducedGroebnerBasis("cyclic9", modulo);
213  }
214 
215  return nbGen;
216 }
217 
218 int katsura9F4(bool magma)
219 {
220  cout << "#########################################################" << endl;
221  cout << "# KATSURA 9 #" << endl;
222  cout << "#########################################################" << endl << endl;
223 
224  // Init element-prime tools
225  eltType::setModulo(modulo);
226 
227  // Number of generator
228  int nbGen;
229 
230  // Init monomial tools
232 
233  // Create polynomial array
234  vector<Polynomial<eltType>> polKatsura9;
235 
236  // Fill the polynomial array
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");
246 
247  // Create katsura9 ideal;
248  Ideal<eltType> katsura9(polKatsura9, 9 ,1000000);
249 
250  // Compute a reduced groebner basis;
251  nbGen=katsura9.f4();
252 
253  // Print the reduced groebner basis into a file
254  if(magma)
255  {
256  katsura9.printReducedGroebnerBasis("katsura9", modulo);
257  }
258 
259  return nbGen;
260 }
261 
262 int katsura10F4(bool magma)
263 {
264  cout << "#########################################################" << endl;
265  cout << "# KATSURA 10 #" << endl;
266  cout << "#########################################################" << endl << endl;
267 
268  // Init element-prime tools
269  eltType::setModulo(modulo);
270 
271  // Number of generator
272  int nbGen;
273 
274  // Init monomial tools
276 
277  // Create polynomial array
278  vector<Polynomial<eltType>> polKatsura10;
279 
280  // Fill the polynomial array
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");
291 
292  // Create katsura10 ideal;
293  Ideal<eltType> katsura10(polKatsura10, 10, 10000000);
294 
295  // Compute a reduced groebner basis;
296  nbGen=katsura10.f4();
297 
298  // Print the reduced groebner basis into a file
299  if(magma)
300  {
301  katsura10.printReducedGroebnerBasis("katsura10", modulo);
302  }
303  return nbGen;
304 }
305 
306 int katsura11F4(bool magma)
307 {
308  cout << "#########################################################" << endl;
309  cout << "# KATSURA 11 #" << endl;
310  cout << "#########################################################" << endl << endl;
311 
312  // Init element-prime tools
313  eltType::setModulo(modulo);
314 
315  // Number of generator
316  int nbGen;
317 
318  // Init monomial tools
320 
321  // Create polynomial array
322  vector<Polynomial<eltType>> polKatsura11;
323 
324  // Fill the polynomial array
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");
336 
337  // Create katsura11 ideal;
338  Ideal<eltType> katsura11(polKatsura11, 11, 10000000);
339 
340  // Compute a reduced groebner basis;
341  nbGen=katsura11.f4();
342 
343  // Print the reduced groebner basis into a file
344  if(magma)
345  {
346  katsura11.printReducedGroebnerBasis("katsura11", modulo);
347  }
348  return nbGen;
349 }
350 
351 int katsura12F4(bool magma)
352 {
353  cout << "#########################################################" << endl;
354  cout << "# KATSURA 12 #" << endl;
355  cout << "#########################################################" << endl << endl;
356 
357  // Init element-prime tools
358  eltType::setModulo(modulo);
359 
360  // Number of generator
361  int nbGen;
362 
363  // Init monomial tools
365 
366  // Create polynomial array
367  vector<Polynomial<eltType>> polKatsura12;
368 
369  // Fill the polynomial array
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");
382 
383  // Create katsura12 ideal;
384  Ideal<eltType> katsura12(polKatsura12, 12, 20000000);
385 
386  // Compute a reduced groebner basis;
387  nbGen=katsura12.f4();
388 
389  // Print the reduced groebner basis into a file
390  if(magma)
391  {
392  katsura12.printReducedGroebnerBasis("katsura12", modulo);
393  }
394 
395  return nbGen;
396 }
397 
398 int randomIdealF4(bool magma)
399 {
400  cout << "#########################################################" << endl;
401  cout << "# RANDOM 10 #" << endl;
402  cout << "#########################################################" << endl << endl;
403 
404  // Init element-prime tools
405  eltType::setModulo(modulo);
406 
407  // Number of generator
408  int nbGen;
409 
410  // Init monomial tools
412 
413  // Create polynomial array
414  vector<Polynomial<eltType>> polRandomIdeal;
415 
416  // Fill the polynomial array
417  polRandomIdeal.emplace_back("3321501046*x1^5 + 4216465410*x1*x2^2*x3*x4 + 2865932757*x0^2*x3*x4*x5 + 3788788464*x0*x2*x4^2*x5 + 1581014319*x1*x2*x4*x5^2 + 3084424461*x3^2*x4^2 + 3351310712*x0^2*x4*x5 + 2966593550*x0^2*x4 + 3511552994*x3*x4^2 + 723879516*x5");
418  polRandomIdeal.emplace_back("2990172668*x1^4*x2 + 155715702*x0*x2^3*x3 + 1144902916*x0^4*x4 + 4219786921*x1*x2^2*x3*x4 + 3945895781*x0*x1*x2*x5^2 + 179502760*x0*x2*x4*x5 + 3436179860*x2*x4^2*x5 + 3175135897*x1^2*x2 + 3694637170*x0*x3*x4 + 315970291*x3^2*x5");
419  polRandomIdeal.emplace_back("2801464433*x0^3*x1*x2 + 2259511787*x0^2*x3^3 + 3274964350*x0^2*x1*x3*x4 + 3346018573*x2*x3*x4^3 + 4062905208*x2^2*x3^2*x5 + 3037120434*x1^2*x4^2*x5 + 1543552908*x1^2*x4*x5^2 + 2152568847*x1*x4*x5^3 + 2527771819*x0^2*x2*x5 + 1827741362*x2*x3*x5^2");
420  polRandomIdeal.emplace_back("2372585190*x1^3*x2^2 + 843546292*x1*x2^3*x4 + 1830835342*x1*x4^4 + 3647353261*x0*x2^3*x5 + 1441593613*x2^2*x4^2*x5 + 2161696749*x1^3*x5^2 + 721144626*x0*x3^2*x5^2 + 2827514473*x2*x4^2*x5^2 + 1505861843*x1^2*x3^2 + 2627219029*x3^2*x5^2");
421  polRandomIdeal.emplace_back("1977110653*x0^4*x1 + 2132293093*x3^5 + 3411929992*x0^3*x3*x4 + 666107476*x1*x3^3*x5 + 855576284*x0^2*x1*x4*x5 + 1369827629*x1^3*x5^2 + 3804083343*x3^2*x4*x5^2 + 3657029571*x0*x3*x5^3 + 4095698964*x0^2*x2*x4 + 2073811847*x2^2*x4");
422  polRandomIdeal.emplace_back("1691167827*x2^2*x3^2*x4 + 494059007*x2*x3^2*x4*x5 + 235691670*x1*x4^3*x5 + 2284461611*x1^2*x2*x5^2 + 3334537854*x1*x2*x3*x5^2 + 2027318262*x3^2*x5^3 + 865640818*x1*x3*x4^2 + 1973672771*x0*x1^2 + 1291108331*x2*x3^2 + 968241936*x3^2*x5");
423  polRandomIdeal.emplace_back("3982484885*x1^2*x2*x4^2 + 930970978*x1*x2^2*x4^2 + 3002178393*x2^2*x4^2*x5 + 803098703*x2*x4^3*x5 + 3315200638*x0^2*x2*x5 + 2783456165*x1^2*x2*x5 + 626963622*x2^2*x3*x5 + 1411188710*x0*x3^2*x5 + 14110205*x2*x3*x5^2 + 3927669247*x4^2");
424  polRandomIdeal.emplace_back("918584053*x0^3*x1*x2 + 1073858013*x0*x3^3*x4 + 872803870*x0*x1*x2*x3*x5 + 4092631501*x1^3*x4*x5 + 2210825489*x1*x2^2*x4*x5 + 1869783427*x3*x4*x5^3 + 3445272271*x2*x4^3 + 2082153076*x4^4 + 1969494894*x1^3*x5 + 2022009333*x5^3");
425  polRandomIdeal.emplace_back("2758266573*x0*x3^4 + 371075551*x1^2*x2*x3*x4 + 3544184607*x2^4*x5 + 1974875405*x0^2*x1^2 + 18571056*x0*x2^2*x4 + 1259555927*x2*x3^2*x5 + 740166081*x2^2*x5^2 + 3059201349*x1*x3*x5^2 + 3508031906*x2*x4*x5 + 1400156252*x2*x5^2");
426  polRandomIdeal.emplace_back("3236514088*x1^2*x2^3 + 1114154358*x1*x2^3*x3 + 752687686*x3^4*x4 + 1276406837*x0*x1*x4^3 + 3548353877*x0^3*x4*x5 + 3375755375*x3*x5^4 + 200174983*x2*x3*x5^2 + 634766406*x2^3 + 3370377929*x0*x2*x3 + 938930957*x1*x3");
427 
428  // Create katsura12 ideal;
429  Ideal<eltType> randomIdeal(polRandomIdeal, 6);
430 
431  // Compute a reduced groebner basis;
432  nbGen=randomIdeal.f4();
433 
434  // Print the reduced groebner basis into a file
435  if(magma)
436  {
437  randomIdeal.printReducedGroebnerBasis("randomIdeal", modulo);
438  }
439 
440  return nbGen;
441 }
442 
443 int main (int argc, char **argv)
444 {
445  cout << "#########################################################" << endl;
446  cout << "# BENCHMARK LONG #" << endl;
447  cout << "#########################################################" << endl << endl;
448 
449  // Time
450  chrono::steady_clock::time_point start;
451  typedef chrono::duration<int,milli> millisecs_t;
452 
453  // Number of threads
454  cout << NB_THREAD << " threads used " << endl << endl;
455 
456  // Magma output
457  bool magma = false;
458 
459  // Number of generator
460  int nbGen;
461 
462  // File
463  ofstream file("benchmark-long.txt");
464  if (file)
465  {
466  file << "Benchmark for ideal with integer long type coefficient." << endl << endl << endl;
467  }
468 
469  start=chrono::steady_clock::now();
470  nbGen=randomIdealF4(magma);
471  if (file)
472  {
473  file << "Random 10 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
474  }
475 
476  //start=chrono::steady_clock::now();
477  //nbGen=cyclic6F4(magma);
478  //if (file)
479  //{
480  //file << "Cyclic 6 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
481  //}
482 
483  //start=chrono::steady_clock::now();
484  //nbGen=cyclic7F4(magma);
485  //if (file)
486  //{
487  //file << "Cyclic 7 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
488  //}
489 
490  start=chrono::steady_clock::now();
491  nbGen=cyclic8F4(magma);
492  if (file)
493  {
494  file << "Cyclic 8 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
495  }
496 
497  //start=chrono::steady_clock::now();
498  //nbGen=cyclic9F4(magma);
499  //if (file)
500  //{
501  //file << "Cyclic 9 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
502  //}
503 
504  //start=chrono::steady_clock::now();
505  //nbGen=katsura9F4(magma);
506  //if (file)
507  //{
508  //file << "Katsura 9 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
509  //}
510 
511  //start=chrono::steady_clock::now();
512  //nbGen=katsura10F4(magma);
513  //if (file)
514  //{
515  //file << "Katsura 10 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
516  //}
517 
518  //start=chrono::steady_clock::now();
519  //nbGen=katsura11F4(magma);
520  //if (file)
521  //{
522  //file << "Katsura 11 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
523  //}
524 
525  start=chrono::steady_clock::now();
526  nbGen=katsura12F4(magma);
527  if (file)
528  {
529  file << "Katsura 12 : " << chrono::duration_cast<millisecs_t>(chrono::steady_clock::now()-start).count() << " ms (" << nbGen << " generators)" << endl << endl;
530  }
531 
532  return 0;
533 }
534 
535 
Represent an ideal.
Definition: ideal.h:68
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...
Definition: element-prime.h:47
static void setModulo(baseType modulo)
Set the static variable MODULO.
Declaration of class F4 methods.