17namespace layer1_foundations {
20static int finitefield_primes[] = {
21 2, 3, 4, 5, 7, 8, 9, 11, 13, 16,
22 17, 19, 23, 25, 27, 29, 31, 32, 37, 41,
23 43, 47, 49, 53, 59, 61, 67, 71, 73, 79, 81, 83,
24 89, 97, 101, 103, 107, 109, 113, 121, 127, 131, 137,
25 139, 149, 151, 157, 163, 167, 169, 173, 179, 181, 191,
26 193, 197, 199, 211, 223, 227, 229, 233, 239, 241,
27 251, 257, 263, 269, 271, 277, 281, 283, 289, 293, 307,
28 311, 313, 317, 331, 337, 347, 349, 353, 359, 367,
29 373, 379, 383, 389, 397, 401, 409, 419, 421, 431,
30 433, 439, 443, 449, 457, 461, 463, 467, 479, 487,
31 491, 499, 761, 941, 1301
35static int finitefield_nb_primes =
36 sizeof(finitefield_primes) /
sizeof(finitefield_primes[0]);
38static int finitefield_largest_degree_irreducible_polynomial[] = {
152static const char *finitefield_primitive_polynomial[][100] = {
210 "144115188075855917",
211 "288230376151711843",
212 "576460752303423611",
213 "1729382256910270465",
216 "13835058055282163713",
217 "18446744073709551643",
219 "73786976294838206829",
221 "295147905179352826019",
223 "1180591620717411303467",
225 "4722366482869645213791",
265 "150094635296999501",
266 "450283905890997415",
267 "1350851717672992133",
268 "4052555153018976583",
269 "16210220612075905070",
270 "36472996377170786410",
271 "109418989131512359574",
273 "984770902183611232910",
274 "2954312706550833698707",
277 "79766443076872509863840",
278 "239299329230617529590147",
279 "717897987691852588770464",
280 "2153693963075557766310754",
281 "6461081889226673298932654",
312 "288230376151711787",
313 "1152921504606847314",
340 "357627868652343772",
341 "1490116119384765787",
342 "7450580596923828147",
343 "37252902984619140763",
344 "186264514923095703278",
345 "931322574615478516308",
388 "162129586585337914",
389 "1152921504606847061",
457 "1152921504606847276",
458 "18446744073709555773",
459 "313594649253062377474",
460 "5017514388048998039762",
461 "75557863725914323419394",
462 "1284483683340543498125410",
491"15181127029874798664",
492"288441413567621168150",
519"1549720764160156255",
520"38743019104003906255",
521"968575477600097656255",
522"24214386940002441406255",
537"4202649788315975391",
538"113471544284531335479",
539"3063731695682346057855",
540"82720755783423343562007",
958 int p,
int e,
int verbose_level)
960 int f_v = (verbose_level >= 1);
966 cout <<
"knowledge_base::get_primitive_polynomial" << endl;
969 if (!Sorting.
int_vec_search(finitefield_primes, finitefield_nb_primes, p, idx)) {
970 cout <<
"knowledge_base::get_primitive_polynomial "
971 "I don't have prime " << p <<
" in the tables" << endl;
975 cout <<
"searching for a polynomial of degree " << e << endl;
979 s = AG.search_for_primitive_polynomial_of_given_degree(p, e, verbose_level);
980 cout <<
"the search came up with a polynomial of degree " << e <<
", coded as " << s << endl;
985 if (e > finitefield_largest_degree_irreducible_polynomial[idx]) {
986 cout <<
"knowledge_base::get_primitive_polynomial "
987 "I do not have a polynomial" << endl;
988 cout <<
"of that degree over that field" << endl;
989 cout <<
"requested: degree " << e <<
" polynomial over GF(" << p <<
")" << endl;
992 const char *m = finitefield_primitive_polynomial[idx][e - 2];
993 if (strlen(m) == 0) {
994 cout <<
"knowledge_base::get_primitive_polynomial "
995 "I do not have a polynomial" << endl;
996 cout <<
"of that degree over that field" << endl;
997 cout <<
"requested: degree " << e <<
" polynomial over GF(" << p <<
")" << endl;
1002 cout <<
"knowledge_base::get_primitive_polynomial done" << endl;
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
void get_primitive_polynomial(std::string &poly, int p, int e, int verbose_level)
the orbiter library for the classification of combinatorial objects