Orbiter 2022
Combinatorial Objects
finite_field_activity_description.cpp
Go to the documentation of this file.
1/*
2 * finite_field_activity_description.cpp
3 *
4 * Created on: Nov 4, 2020
5 * Author: betten
6 */
7
8
9
10#include "foundations.h"
11
12using namespace std;
13
14
15
16namespace orbiter {
17namespace layer1_foundations {
18namespace field_theory {
19
20
22{
23
25
27 //std::string write_code_for_division_fname;
28 //std::string write_code_for_division_A;
29 //std::string write_code_for_division_B;
30
32 //polynomial_division_A;
33 //polynomial_division_B;
34
36
38 //std::string polynomial_mult_mod_A;
39 //std::string polynomial_mult_mod_B;
40 //std::string polynomial_mult_mod_M;
41
43 //Berlekamp_matrix_coeffs;
44
47
49 //polynomial_find_roots_A;
50
53
54
56 //nullspace_input_matrix = NULL;
57
58 f_RREF = FALSE;
59 //RREF_input_matrix
60
61 //cout << "finite_field_activity_description::finite_field_activity_description 3" << endl;
62 //RREF_text = NULL;
63
65 //std::string weight_enumerator_input_matrix;
66
68 //std::string Walsh_Hadamard_transform_fname_csv_in;
70
72 //std::string algebraic_normal_form_fname_csv_in;
74
75
76
78 //std::string apply_trace_function_fname_csv_in;
79
81 //std::string apply_power_function_fname_csv_in;
83
85 //std::string identity_function_fname_csv_out;
86
87 f_trace = FALSE;
88 f_norm = FALSE;
89
92
94
96
99
101 EC_s = 0;
102 //EC_message = NULL;
104 f_EC_add = FALSE;
105 //EC_pt1_text = NULL;
106 //EC_pt2_text = NULL;
108 EC_b = 0;
109 EC_c = 0;
110 //EC_pt_text = NULL;
114 //EC_discrete_log_pt_text = NULL;
116 //EC_bsgs_G = NULL;
117 EC_bsgs_N = 0;
118 //EC_bsgs_cipher_text = NULL;
120 //EC_bsgs_A = NULL;
121 //EC_bsgs_keys = NULL;
122
123
124 //cout << "finite_field_activity_description::finite_field_activity_description done" << endl;
126 NTRU_encrypt_N = 0;
127 NTRU_encrypt_p = 0;
128 //NTRU_encrypt_H, NTRU_encrypt_R, NTRU_encrypt_Msg
130 //polynomial_center_lift_A
132 //polynomial_reduce_mod_p_A;
133
136
140
143
146
151
155
159
163
165 //std::string polynomial_division_from_file_fname;
167
169 //std::string polynomial_division_from_file_all_k_bit_error_patterns_fname;
172
173
177
178
179
181 //transversal_line_1_basis = NULL;
182 //transversal_line_2_basis = NULL;
183 //transversal_point = NULL;
185 //line_1_basis = NULL;
186 //line_2_basis = NULL;
187
189 //field_reduction_label
193 // field_reduction_text;
194
196 //parse_name_of_formula
197 //parse_managed_variables
198 //std::string parse_text;
199 //std::string parse_parameters
200
202 //std::string product_of_elements;
203
204 f_sum_of = FALSE;
205 //std::string sum_of_elements;
206
207 f_negate = FALSE;
208 //std::string negate_elements;
209
211 //std::string inverse_elements;
212
214 power_map_k = 0;
215 //std::string power_map_elements;
216
218 //std::string evaluate_formula_label;
219 //std::string evaluate_parameters;
220
221
223 // std::string inverse_isomorphism_klein_quadric_matrix_A6;
224
226 //rank_point_in_PG_label;
227
229 //std::string unrank_point_in_PG_text;
230
231#if 0
232 f_rank_point_in_PG_given_as_pairs = FALSE;
233 rank_point_in_PG_given_as_pairs_n = 0;
234 //std::string f_rank_point_in_PG_given_as_pairs_text;
235#endif
236
239 //std::string generator_matrix_cyclic_code_poly
240
242 nth_roots_n = 0;
243
245 make_BCH_code_n = 0;
246 make_BCH_code_d = 0;
247
249 //std::string make_BCH_code_and_encode_text;
250 //std::string make_BCH_code_and_encode_fname;
251
252 f_NTT = FALSE;
253 NTT_n = 0;
254 NTT_q = 0;
255
256}
257
258
260{
261
262}
263
265 int argc, std::string *argv,
266 int verbose_level)
267{
268 int f_v = (verbose_level >= 1);
269 int i;
271
272 if (f_v) {
273 cout << "finite_field_activity_description::read_arguments" << endl;
274 }
275 for (i = 0; i < argc; i++) {
276
277 if (ST.stringcmp(argv[i], "-cheat_sheet_GF") == 0) {
279 if (f_v) {
280 cout << "-cheat_sheet_GF " << endl;
281 }
282 }
283
284 else if (ST.stringcmp(argv[i], "-write_code_for_division") == 0) {
286 write_code_for_division_fname.assign(argv[++i]);
287 write_code_for_division_A.assign(argv[++i]);
288 write_code_for_division_B.assign(argv[++i]);
289 if (f_v) {
290 cout << "-write_code_for_division "
293 << write_code_for_division_B << endl;
294 }
295 }
296 else if (ST.stringcmp(argv[i], "-polynomial_division") == 0) {
298 polynomial_division_A.assign(argv[++i]);
299 polynomial_division_B.assign(argv[++i]);
300 if (f_v) {
301 cout << "-polynomial_division " << polynomial_division_A << " "
302 << polynomial_division_B << endl;
303 }
304 }
305 else if (ST.stringcmp(argv[i], "-extended_gcd_for_polynomials") == 0) {
307 polynomial_division_A.assign(argv[++i]);
308 polynomial_division_B.assign(argv[++i]);
309 if (f_v) {
310 cout << "-extended_gcd_for_polynomials " << polynomial_division_A
311 << " " << polynomial_division_B << endl;
312 }
313 }
314 else if (ST.stringcmp(argv[i], "-polynomial_mult_mod") == 0) {
316 polynomial_mult_mod_A.assign(argv[++i]);
317 polynomial_mult_mod_B.assign(argv[++i]);
318 polynomial_mult_mod_M.assign(argv[++i]);
319 if (f_v) {
320 cout << "-polynomial_mult_mod "
321 << " " << polynomial_mult_mod_A
322 << " " << polynomial_mult_mod_B
323 << " " << polynomial_mult_mod_M << endl;
324 }
325 }
326 else if (ST.stringcmp(argv[i], "-Berlekamp_matrix") == 0) {
328 Berlekamp_matrix_coeffs.assign(argv[++i]);
329 if (f_v) {
330 cout << "-Berlekamp_matrix " << Berlekamp_matrix_coeffs << endl;
331 }
332 }
333 else if (ST.stringcmp(argv[i], "-normal_basis") == 0) {
335 normal_basis_d = ST.strtoi(argv[++i]);
336 if (f_v) {
337 cout << "-normal_basis " << normal_basis_d << endl;
338 }
339 }
340 else if (ST.stringcmp(argv[i], "-normalize_from_the_right") == 0) {
342 if (f_v) {
343 cout << "-normalize_from_the_right " << endl;
344 }
345 }
346 else if (ST.stringcmp(argv[i], "-normalize_from_the_left") == 0) {
348 if (f_v) {
349 cout << "-normalize_from_the_left " << endl;
350 }
351 }
352 else if (ST.stringcmp(argv[i], "-nullspace") == 0) {
354 nullspace_input_matrix.assign(argv[++i]);
355 if (f_v) {
356 cout << "-nullspace " << nullspace_input_matrix << endl;
357 }
358 }
359 else if (ST.stringcmp(argv[i], "-polynomial_find_roots") == 0) {
361 polynomial_find_roots_A.assign(argv[++i]);
362 if (f_v) {
363 cout << "-polynomial_find_roots " << polynomial_find_roots_A << endl;
364 }
365 }
366 else if (ST.stringcmp(argv[i], "-RREF") == 0) {
367 f_RREF = TRUE;
368 RREF_input_matrix.assign(argv[++i]);
369 if (f_v) {
370 cout << "-RREF " << RREF_input_matrix << endl;
371 }
372 }
373 else if (ST.stringcmp(argv[i], "-weight_enumerator") == 0) {
375 weight_enumerator_input_matrix.assign(argv[++i]);
376 if (f_v) {
377 cout << "-weight_enumerator " << weight_enumerator_input_matrix << endl;
378 }
379 }
380
381 else if (ST.stringcmp(argv[i], "-Walsh_Hadamard_transform") == 0) {
384 Walsh_Hadamard_transform_n = ST.strtoi(argv[++i]);
385 if (f_v) {
386 cout << "-Walsh_Hadamard_transform "
388 << " " << Walsh_Hadamard_transform_n << endl;
389 }
390 }
391
392 else if (ST.stringcmp(argv[i], "-algebraic_normal_form") == 0) {
394 algebraic_normal_form_fname_csv_in.assign(argv[++i]);
395 algebraic_normal_form_n = ST.strtoi(argv[++i]);
396 if (f_v) {
397 cout << "-algebraic_normal_form "
399 << " " << algebraic_normal_form_n << endl;
400 }
401 }
402
403 else if (ST.stringcmp(argv[i], "-apply_trace_function") == 0) {
405 apply_trace_function_fname_csv_in.assign(argv[++i]);
406 if (f_v) {
407 cout << "-apply_trace_function "
409 << endl;
410 }
411 }
412
413 else if (ST.stringcmp(argv[i], "-apply_power_function") == 0) {
415 apply_power_function_fname_csv_in.assign(argv[++i]);
416 apply_power_function_d = ST.strtoi(argv[++i]);
417 if (f_v) {
418 cout << "-apply_power_function "
420 << " " << apply_power_function_d
421 << endl;
422 }
423 }
424
425 else if (ST.stringcmp(argv[i], "-identity_function") == 0) {
427 identity_function_fname_csv_out.assign(argv[++i]);
428 if (f_v) {
429 cout << "-identity_function "
431 << endl;
432 }
433 }
434
435 else if (ST.stringcmp(argv[i], "-trace") == 0) {
436 f_trace = TRUE;
437 if (f_v) {
438 cout << "-trace " << endl;
439 }
440 }
441 else if (ST.stringcmp(argv[i], "-norm") == 0) {
442 f_norm = TRUE;
443 if (f_v) {
444 cout << "-norm " << endl;
445 }
446 }
447
448 else if (ST.stringcmp(argv[i], "-Walsh_matrix") == 0) {
450 Walsh_matrix_n = ST.strtoi(argv[++i]);
451 if (f_v) {
452 cout << "-Walsh_matrix " << Walsh_matrix_n << endl;
453 }
454 }
455
456 else if (ST.stringcmp(argv[i], "-Vandermonde_matrix") == 0) {
458 if (f_v) {
459 cout << "-Vandermonde_matrix " << endl;
460 }
461 }
462 else if (ST.stringcmp(argv[i], "-search_APN_function") == 0) {
464 if (f_v) {
465 cout << "-search_APN_function " << endl;
466 }
467 }
468
469
470 else if (ST.stringcmp(argv[i], "-make_table_of_irreducible_polynomials") == 0) {
473 if (f_v) {
474 cout << "-make_table_of_irreducible_polynomials "
476 }
477 }
478 else if (ST.stringcmp(argv[i], "-EC_Koblitz_encoding") == 0) {
480 EC_b = ST.strtoi(argv[++i]);
481 EC_c = ST.strtoi(argv[++i]);
482 EC_s = ST.strtoi(argv[++i]);
483 EC_pt_text.assign(argv[++i]);
484 EC_message.assign(argv[++i]);
485 if (f_v) {
486 cout << "-EC_Koblitz_encoding "
487 << EC_b << " " << EC_c << " " << EC_s << " "
488 << EC_pt_text << " " << EC_message << endl;
489 }
490 }
491 else if (ST.stringcmp(argv[i], "-EC_points") == 0) {
493 EC_label.assign(argv[++i]);
494 EC_b = ST.strtoi(argv[++i]);
495 EC_c = ST.strtoi(argv[++i]);
496 if (f_v) {
497 cout << "-EC_points " << " " << EC_label << " " << EC_b << " " << EC_c << endl;
498 }
499 }
500 else if (ST.stringcmp(argv[i], "-EC_add") == 0) {
501 f_EC_add = TRUE;
502 EC_b = ST.strtoi(argv[++i]);
503 EC_c = ST.strtoi(argv[++i]);
504 EC_pt1_text.assign(argv[++i]);
505 EC_pt2_text.assign(argv[++i]);
506 if (f_v) {
507 cout << "-EC_add " << EC_b << " " << EC_c << " " << EC_pt1_text << " " << EC_pt2_text << endl;
508 }
509 }
510 else if (ST.stringcmp(argv[i], "-EC_cyclic_subgroup") == 0) {
512 EC_b = ST.strtoi(argv[++i]);
513 EC_c = ST.strtoi(argv[++i]);
514 EC_pt_text.assign(argv[++i]);
515 if (f_v) {
516 cout << "-EC_cyclic_subgroup " << " " << EC_b << " " << EC_c << " " << EC_pt_text << endl;
517 }
518 }
519 else if (ST.stringcmp(argv[i], "-EC_multiple_of") == 0) {
521 EC_b = ST.strtoi(argv[++i]);
522 EC_c = ST.strtoi(argv[++i]);
523 EC_pt_text.assign(argv[++i]);
524 EC_multiple_of_n = ST.strtoi(argv[++i]);
525 if (f_v) {
526 cout << "-EC_multiple_of " << " " << EC_b << " " << EC_c << " " << EC_pt_text
527 << " " << EC_multiple_of_n << endl;
528 }
529 }
530 else if (ST.stringcmp(argv[i], "-EC_discrete_log") == 0) {
532 EC_b = ST.strtoi(argv[++i]);
533 EC_c = ST.strtoi(argv[++i]);
534 EC_pt_text.assign(argv[++i]);
535 EC_discrete_log_pt_text.assign(argv[++i]);
536 if (f_v) {
537 cout << "-EC_discrete_log " << " " << EC_b << " " << EC_c << " " << EC_pt_text << " "
538 << EC_discrete_log_pt_text << endl;
539 }
540 }
541 else if (ST.stringcmp(argv[i], "-EC_bsgs") == 0) {
543 EC_b = ST.strtoi(argv[++i]);
544 EC_c = ST.strtoi(argv[++i]);
545 EC_bsgs_G.assign(argv[++i]);
546 EC_bsgs_N = ST.strtoi(argv[++i]);
547 EC_bsgs_cipher_text.assign(argv[++i]);
548 if (f_v) {
549 cout << "-EC_baby_step_giant_step " << " " << EC_b << " " << EC_c << " "
550 << EC_bsgs_G << " "
551 << EC_bsgs_N << " "
552 << EC_bsgs_cipher_text << endl;
553 }
554 }
555 else if (ST.stringcmp(argv[i], "-EC_bsgs_decode") == 0) {
557 EC_b = ST.strtoi(argv[++i]);
558 EC_c = ST.strtoi(argv[++i]);
559 EC_bsgs_A.assign(argv[++i]);
560 EC_bsgs_N = ST.strtoi(argv[++i]);
561 EC_bsgs_cipher_text.assign(argv[++i]);
562 EC_bsgs_keys.assign(argv[++i]);
563 if (f_v) {
564 cout << "-EC_baby_step_giant_step_decode "
565 << EC_b << " " << EC_c << " "
566 << EC_bsgs_A << " "
567 << EC_bsgs_N << " "
568 << EC_bsgs_cipher_text << " "
569 << EC_bsgs_keys << " "
570 << endl;
571 }
572 }
573 else if (ST.stringcmp(argv[i], "-NTRU_encrypt") == 0) {
575 NTRU_encrypt_N = ST.strtoi(argv[++i]);
576 NTRU_encrypt_p = ST.strtoi(argv[++i]);
577 NTRU_encrypt_H.assign(argv[++i]);
578 NTRU_encrypt_R.assign(argv[++i]);
579 NTRU_encrypt_Msg.assign(argv[++i]);
580 if (f_v) {
581 cout << "-polynomial_mult_mod " << NTRU_encrypt_N
582 << " " << NTRU_encrypt_p
583 << " " << NTRU_encrypt_H
584 << " " << NTRU_encrypt_R
585 << " " << NTRU_encrypt_Msg << endl;
586 }
587 }
588 else if (ST.stringcmp(argv[i], "-polynomial_center_lift") == 0) {
590 polynomial_center_lift_A.assign(argv[++i]);
591 if (f_v) {
592 cout << "-polynomial_center_lift " << polynomial_center_lift_A << endl;
593 }
594 }
595 else if (ST.stringcmp(argv[i], "-polynomial_reduce_mod_p") == 0) {
597 polynomial_reduce_mod_p_A.assign(argv[++i]);
598 if (f_v) {
599 cout << "-polynomial_reduce_mod_p " << polynomial_reduce_mod_p_A << endl;
600 }
601 }
602
603
604 else if (ST.stringcmp(argv[i], "-cheat_sheet_PG") == 0) {
606 cheat_sheet_PG_n = ST.strtoi(argv[++i]);
607 if (f_v) {
608 cout << "-cheat_sheet_PG " << cheat_sheet_PG_n << endl;
609 }
610 }
611 else if (ST.stringcmp(argv[i], "-cheat_sheet_Gr") == 0) {
613 cheat_sheet_Gr_n = ST.strtoi(argv[++i]);
614 cheat_sheet_Gr_k = ST.strtoi(argv[++i]);
615 if (f_v) {
616 cout << "-cheat_sheet_Gr " << cheat_sheet_Gr_n << " " << cheat_sheet_Gr_k << endl;
617 }
618 }
619
620
621 else if (ST.stringcmp(argv[i], "-cheat_sheet_hermitian") == 0) {
624 if (f_v) {
625 cout << "-cheat_sheet_hermitian " << cheat_sheet_hermitian_projective_dimension << endl;
626 }
627 }
628 else if (ST.stringcmp(argv[i], "-cheat_sheet_desarguesian_spread") == 0) {
631 if (f_v) {
632 cout << "-cheat_sheet_desarguesian_spread " << cheat_sheet_desarguesian_spread_m << endl;
633 }
634 }
635 else if (ST.stringcmp(argv[i], "-find_CRC_polynomials") == 0) {
640 if (f_v) {
641 cout << "-find_CRC_polynomials "
645 << endl;
646 }
647 }
648 else if (ST.stringcmp(argv[i], "-sift_polynomials") == 0) {
650 sift_polynomials_r0 = ST.strtolint(argv[++i]);
651 sift_polynomials_r1 = ST.strtolint(argv[++i]);
652 if (f_v) {
653 cout << "-sift_polynomials "
654 << " " << sift_polynomials_r0
655 << " " << sift_polynomials_r1
656 << endl;
657 }
658 }
659 else if (ST.stringcmp(argv[i], "-mult_polynomials") == 0) {
661 mult_polynomials_r0 = ST.strtolint(argv[++i]);
662 mult_polynomials_r1 = ST.strtolint(argv[++i]);
663 if (f_v) {
664 cout << "-mult_polynomials "
665 << " " << mult_polynomials_r0
666 << " " << mult_polynomials_r1
667 << endl;
668 }
669 }
670 else if (ST.stringcmp(argv[i], "-polynomial_division_ranked") == 0) {
672 polynomial_division_r0 = ST.strtolint(argv[++i]);
673 polynomial_division_r1 = ST.strtolint(argv[++i]);
674 if (f_v) {
675 cout << "-polynomial_division_ranked "
676 << " " << polynomial_division_r0
677 << " " << polynomial_division_r1
678 << endl;
679 }
680 }
681 else if (ST.stringcmp(argv[i], "-polynomial_division_from_file") == 0) {
683 polynomial_division_from_file_fname.assign(argv[++i]);
685 if (f_v) {
686 cout << "-polynomial_division_from_file "
689 << endl;
690 }
691 }
692
693 else if (ST.stringcmp(argv[i], "-polynomial_division_from_file_all_k_bit_error_patterns") == 0) {
698 if (f_v) {
699 cout << "-polynomial_division_from_file_all_k_bit_error_patterns "
703 << endl;
704 }
705 }
706
707
708 else if (ST.stringcmp(argv[i], "-RREF_random_matrix") == 0) {
710 RREF_random_matrix_m = ST.strtolint(argv[++i]);
711 RREF_random_matrix_n = ST.strtolint(argv[++i]);
712 if (f_v) {
713 cout << "-RREF_demo "
714 << " " << RREF_random_matrix_m
715 << " " << RREF_random_matrix_n
716 << endl;
717 }
718 }
719
720
721
722
723
724
725 else if (ST.stringcmp(argv[i], "-transversal") == 0) {
727 transversal_line_1_basis.assign(argv[++i]);
728 transversal_line_2_basis.assign(argv[++i]);
729 transversal_point.assign(argv[++i]);
730 if (f_v) {
731 cout << "-transversal "
734 << " " << transversal_point << endl;
735 }
736 }
737 else if (ST.stringcmp(argv[i], "-intersection_of_two_lines") == 0) {
739 line_1_basis.assign(argv[++i]);
740 line_2_basis.assign(argv[++i]);
741 if (f_v) {
742 cout << "-intersection_of_two_lines "
743 << " " << line_1_basis
744 << " " << line_2_basis
745 << endl;
746 }
747 }
748 else if (ST.stringcmp(argv[i], "-inverse_isomorphism_klein_quadric") == 0) {
751 if (f_v) {
752 cout << "-inverse_isomorphism_klein_quadric "
754 }
755 }
756 else if (ST.stringcmp(argv[i], "-rank_point_in_PG") == 0) {
758 rank_point_in_PG_label.assign(argv[++i]);
759 if (f_v) {
760 cout << "-rank_point_in_PG " << rank_point_in_PG_label << endl;
761 }
762 }
763 else if (ST.stringcmp(argv[i], "-unrank_point_in_PG") == 0) {
765 unrank_point_in_PG_text.assign(argv[++i]);
766 if (f_v) {
767 cout << "-unrank_point_in_PG " << unrank_point_in_PG_text << endl;
768 }
769 }
770
771
772#if 0
773 else if (ST.stringcmp(argv[i], "-rank_point_in_PG_given_as_pairs") == 0) {
774 f_rank_point_in_PG_given_as_pairs = TRUE;
775 rank_point_in_PG_given_as_pairs_n = ST.strtoi(argv[++i]);
776 rank_point_in_PG_given_as_pairs_text.assign(argv[++i]);
777 if (f_v) {
778 cout << "-rank_point_in_PG " << rank_point_in_PG_given_as_pairs_n << " " << rank_point_in_PG_given_as_pairs_text << endl;
779 }
780 }
781#endif
782
783 else if (ST.stringcmp(argv[i], "-field_reduction") == 0) {
785 field_reduction_label.assign(argv[++i]);
786 field_reduction_q = ST.strtoi(argv[++i]);
787 field_reduction_m = ST.strtoi(argv[++i]);
788 field_reduction_n = ST.strtoi(argv[++i]);
789 field_reduction_text.assign(argv[++i]);
790 if (f_v) {
791 cout << "-field_reduction "
792 << " " << field_reduction_label
793 << " " << field_reduction_q
794 << " " << field_reduction_m
795 << " " << field_reduction_n
796 << " " << field_reduction_text << endl;
797 }
798 }
799 else if (ST.stringcmp(argv[i], "-parse_and_evaluate") == 0) {
801 parse_name_of_formula.assign(argv[++i]);
802 parse_managed_variables.assign(argv[++i]);
803 parse_text.assign(argv[++i]);
804 parse_parameters.assign(argv[++i]);
805 if (f_v) {
806 cout << "-parse_and_evaluate " << parse_name_of_formula
808 << " " << parse_text
809 << " " << parse_parameters
810 << endl;
811 }
812 }
813
814 else if (ST.stringcmp(argv[i], "-product_of") == 0) {
816 product_of_elements.assign(argv[++i]);
817 if (f_v) {
818 cout << "-product_of " << product_of_elements
819 << endl;
820 }
821 }
822 else if (ST.stringcmp(argv[i], "-sum_of") == 0) {
823 f_sum_of = TRUE;
824 sum_of_elements.assign(argv[++i]);
825 if (f_v) {
826 cout << "-sum_of " << sum_of_elements
827 << endl;
828 }
829 }
830 else if (ST.stringcmp(argv[i], "-negate") == 0) {
831 f_negate = TRUE;
832 negate_elements.assign(argv[++i]);
833 if (f_v) {
834 cout << "-negate " << negate_elements
835 << endl;
836 }
837 }
838 else if (ST.stringcmp(argv[i], "-inverse") == 0) {
839 f_inverse = TRUE;
840 inverse_elements.assign(argv[++i]);
841 if (f_v) {
842 cout << "-inverse " << inverse_elements
843 << endl;
844 }
845 }
846 else if (ST.stringcmp(argv[i], "-power_map") == 0) {
848 power_map_k = ST.strtoi(argv[++i]);
849 power_map_elements.assign(argv[++i]);
850 if (f_v) {
851 cout << "-power_map " << power_map_k
852 << " " << power_map_elements
853 << endl;
854 }
855 }
856
857
858 else if (ST.stringcmp(argv[i], "-evaluate") == 0) {
860 evaluate_formula_label.assign(argv[++i]);
861 evaluate_parameters.assign(argv[++i]);
862 if (f_v) {
863 cout << "-evaluate " << evaluate_formula_label
864 << " " << evaluate_parameters
865 << endl;
866 }
867 }
868 else if (ST.stringcmp(argv[i], "-generator_matrix_cyclic_code") == 0) {
871 generator_matrix_cyclic_code_poly.assign(argv[++i]);
872 if (f_v) {
873 cout << "-generator_matrix_cyclic_code " << generator_matrix_cyclic_code_n
875 << endl;
876 }
877 }
878 else if (ST.stringcmp(argv[i], "-nth_roots") == 0) {
880 nth_roots_n = ST.strtoi(argv[++i]);
881 if (f_v) {
882 cout << "-nth_roots " << nth_roots_n << endl;
883 }
884 }
885 else if (ST.stringcmp(argv[i], "-make_BCH_code") == 0) {
887 make_BCH_code_n = ST.strtoi(argv[++i]);
888 make_BCH_code_d = ST.strtoi(argv[++i]);
889 if (f_v) {
890 cout << "-make_BCH_code " << make_BCH_code_n
891 << " " << make_BCH_code_d
892 << endl;
893 }
894 }
895 else if (ST.stringcmp(argv[i], "-make_BCH_code_and_encode") == 0) {
897 make_BCH_code_n = ST.strtoi(argv[++i]);
898 make_BCH_code_d = ST.strtoi(argv[++i]);
899 make_BCH_code_and_encode_text.assign(argv[++i]);
900 make_BCH_code_and_encode_fname.assign(argv[++i]);
901 if (f_v) {
902 cout << "-make_BCH_code_and_encode "
903 << " " << make_BCH_code_n
904 << " " << make_BCH_code_d
907 << endl;
908 }
909 }
910 else if (ST.stringcmp(argv[i], "-NTT") == 0) {
911 f_NTT = TRUE;
912 NTT_n = ST.strtoi(argv[++i]);
913 NTT_q = ST.strtoi(argv[++i]);
914 if (f_v) {
915 cout << "-NTT " << NTT_n
916 << " " << NTT_q
917 << endl;
918 }
919 }
920
921
922 else if (ST.stringcmp(argv[i], "-end") == 0) {
923 if (f_v) {
924 cout << "-end" << endl;
925 }
926 break;
927 }
928 else {
929 cout << "finite_field_activity_description::read_arguments "
930 "unrecognized option " << argv[i] << endl;
931 exit(1);
932 }
933 } // next i
934 if (f_v) {
935 cout << "finite_field_activity_description::read_arguments done" << endl;
936 }
937 return i + 1;
938}
939
941{
942 if (f_cheat_sheet_GF) {
943 cout << "-cheat_sheet_GF " << endl;
944 }
945 else if (f_write_code_for_division) {
946 cout << "-write_code_for_division "
949 << write_code_for_division_B << endl;
950 }
952 cout << "-polynomial_division " << polynomial_division_A << " "
953 << polynomial_division_B << endl;
954 }
956 cout << "-extended_gcd_for_polynomials " << polynomial_division_A
957 << " " << polynomial_division_B << endl;
958 }
960 cout << "-polynomial_mult_mod "
961 << " " << polynomial_mult_mod_A
962 << " " << polynomial_mult_mod_B
963 << " " << polynomial_mult_mod_M << endl;
964 }
965 if (f_Berlekamp_matrix) {
966 cout << "-Berlekamp_matrix " << Berlekamp_matrix_coeffs << endl;
967 }
968 if (f_normal_basis) {
969 cout << "-normal_basis " << normal_basis_d << endl;
970 }
972 cout << "-normalize_from_the_right " << endl;
973 }
975 cout << "-normalize_from_the_left " << endl;
976 }
977 if (f_nullspace) {
978 cout << "-nullspace " << nullspace_input_matrix << endl;
979 }
981 cout << "-polynomial_find_roots " << polynomial_find_roots_A << endl;
982 }
983 if (f_RREF) {
984 cout << "-RREF " << RREF_input_matrix << endl;
985 }
987 cout << "-weight_enumerator " << weight_enumerator_input_matrix << endl;
988 }
989
991 cout << "-Walsh_Hadamard_transform "
993 << " " << Walsh_Hadamard_transform_n << endl;
994 }
995
997 cout << "-algebraic_normal_form "
999 << " " << algebraic_normal_form_n << endl;
1000 }
1001
1003 cout << "-apply_trace_function "
1005 << endl;
1006 }
1007
1009 cout << "-apply_power_function "
1011 << " " << apply_power_function_d
1012 << endl;
1013 }
1014
1015 if (f_identity_function) {
1016 cout << "-identity_function "
1018 << endl;
1019 }
1020
1021 if (f_trace) {
1022 cout << "-trace " << endl;
1023 }
1024 if (f_norm) {
1025 cout << "-norm " << endl;
1026 }
1027
1028 if (f_Walsh_matrix) {
1029 cout << "-Walsh_matrix " << Walsh_matrix_n << endl;
1030 }
1032 cout << "-Vandermonde_matrix " << endl;
1033 }
1035 cout << "-search_APN_function " << endl;
1036 }
1037
1039 cout << "-make_table_of_irreducible_polynomials "
1041 }
1043 cout << "-EC_Koblitz_encoding "
1044 << EC_b << " " << EC_c << " " << EC_s << " "
1045 << EC_pt_text << " " << EC_message << endl;
1046 }
1047 if (f_EC_points) {
1048 cout << "-EC_points " << " " << EC_label << " " << EC_b << " " << EC_c << endl;
1049 }
1050 if (f_EC_add) {
1051 cout << "-EC_add " << EC_b << " " << EC_c << " " << EC_pt1_text << " " << EC_pt2_text << endl;
1052 }
1054 cout << "-EC_cyclic_subgroup " << " " << EC_b << " " << EC_c << " " << EC_pt_text << endl;
1055 }
1056 if (f_EC_multiple_of) {
1057 cout << "-EC_multiple_of " << " " << EC_b << " " << EC_c << " " << EC_pt_text
1058 << " " << EC_multiple_of_n << endl;
1059 }
1060 if (f_EC_discrete_log) {
1061 cout << "-EC_discrete_log "
1062 << " " << EC_b
1063 << " " << EC_c
1064 << " " << EC_pt_text
1065 << " " << EC_discrete_log_pt_text
1066 << endl;
1067 }
1069 cout << "-EC_baby_step_giant_step "
1070 << " " << EC_b
1071 << " " << EC_c
1072 << " " << EC_bsgs_G
1073 << " " << EC_bsgs_N
1074 << " " << EC_bsgs_cipher_text
1075 << endl;
1076 }
1078 cout << "-EC_baby_step_giant_step_decode "
1079 << EC_b << " " << EC_c << " "
1080 << EC_bsgs_A << " "
1081 << EC_bsgs_N << " "
1082 << EC_bsgs_cipher_text << " "
1083 << EC_bsgs_keys << " "
1084 << endl;
1085 }
1086 if (f_NTRU_encrypt) {
1087 cout << "-NTRU_encrypt " << NTRU_encrypt_N
1088 << " " << NTRU_encrypt_p
1089 << " " << NTRU_encrypt_H
1090 << " " << NTRU_encrypt_R
1091 << " " << NTRU_encrypt_Msg << endl;
1092 }
1094 cout << "-polynomial_center_lift " << polynomial_center_lift_A << endl;
1095 }
1097 cout << "-polynomial_reduce_mod_p " << polynomial_reduce_mod_p_A << endl;
1098 }
1099
1100
1101 if (f_cheat_sheet_PG) {
1102 cout << "-cheat_sheet_PG " << cheat_sheet_PG_n << endl;
1103 }
1104 if (f_cheat_sheet_Gr) {
1105 cout << "-cheat_sheet_Gr " << cheat_sheet_Gr_n << " " << cheat_sheet_Gr_k << endl;
1106 }
1107
1108
1110 cout << "-cheat_sheet_hermitian " << cheat_sheet_hermitian_projective_dimension << endl;
1111 }
1113 cout << "-cheat_sheet_desarguesian_spread " << cheat_sheet_desarguesian_spread_m << endl;
1114 }
1116 cout << "-find_CRC_polynomials "
1120 << endl;
1121 }
1122 if (f_sift_polynomials) {
1123 cout << "-sift_polynomials "
1124 << " " << sift_polynomials_r0
1125 << " " << sift_polynomials_r1
1126 << endl;
1127 }
1128 if (f_mult_polynomials) {
1129 cout << "-mult_polynomials "
1130 << " " << mult_polynomials_r0
1131 << " " << mult_polynomials_r1
1132 << endl;
1133 }
1135 cout << "-polynomial_division_ranked "
1136 << " " << polynomial_division_r0
1137 << " " << polynomial_division_r1
1138 << endl;
1139 }
1141 cout << "-polynomial_division_from_file "
1144 << endl;
1145 }
1146
1148 cout << "-polynomial_division_from_file_all_k_bit_error_patterns "
1152 << endl;
1153 }
1154
1155
1157 cout << "-RREF_demo "
1158 << " " << RREF_random_matrix_m
1159 << " " << RREF_random_matrix_n
1160 << endl;
1161 }
1162
1163
1164
1165
1166
1167
1168 if (f_transversal) {
1169 cout << "-transversal "
1170 << " " << transversal_line_1_basis
1171 << " " << transversal_line_2_basis
1172 << " " << transversal_point << endl;
1173 }
1175 cout << "-intersection_of_two_lines "
1176 << " " << line_1_basis
1177 << " " << line_2_basis
1178 << endl;
1179 }
1181 cout << "-inverse_isomorphism_klein_quadric "
1183 }
1184 if (f_rank_point_in_PG) {
1185 cout << "-rank_point_in_PG " << rank_point_in_PG_label << endl;
1186 }
1188 cout << "-unrank_point_in_PG " << unrank_point_in_PG_text << endl;
1189 }
1190#if 0
1191 if (f_rank_point_in_PG_given_as_pairs) {
1192 cout << "-rank_point_in_PG " << rank_point_in_PG_given_as_pairs_n << " " << rank_point_in_PG_given_as_pairs_text << endl;
1193 }
1194#endif
1195 if (f_field_reduction) {
1196 cout << "-field_reduction "
1197 << " " << field_reduction_label
1198 << " " << field_reduction_q
1199 << " " << field_reduction_m
1200 << " " << field_reduction_n
1201 << " " << field_reduction_text << endl;
1202 }
1204 cout << "-parse_and_evaluate " << parse_name_of_formula
1205 << " " << parse_managed_variables
1206 << " " << parse_text
1207 << " " << parse_parameters
1208 << endl;
1209 }
1210
1211 if (f_product_of) {
1212 cout << "-product_of " << product_of_elements
1213 << endl;
1214 }
1215 if (f_sum_of) {
1216 cout << "-sum_of " << sum_of_elements
1217 << endl;
1218 }
1219 if (f_negate) {
1220 cout << "-negate " << negate_elements
1221 << endl;
1222 }
1223 if (f_inverse) {
1224 cout << "-inverse " << inverse_elements
1225 << endl;
1226 }
1227 if (f_power_map) {
1228 cout << "-power_map " << power_map_k
1229 << " " << power_map_elements
1230 << endl;
1231 }
1232
1233 if (f_evaluate) {
1234 cout << "-evaluate " << evaluate_formula_label
1235 << " " << evaluate_parameters
1236 << endl;
1237 }
1239 cout << "-generator_matrix_cyclic_code " << generator_matrix_cyclic_code_n
1241 << endl;
1242 }
1243 if (f_nth_roots) {
1244 cout << "-nth_roots " << nth_roots_n << endl;
1245 }
1246 if (f_make_BCH_code) {
1247 cout << "-make_BCH_code " << make_BCH_code_n
1248 << " " << make_BCH_code_d
1249 << endl;
1250 }
1252 cout << "-make_BCH_code_and_encode "
1253 << " " << make_BCH_code_n
1254 << " " << make_BCH_code_d
1257 << endl;
1258 }
1259 if (f_NTT) {
1260 cout << "-NTT " << NTT_n
1261 << " " << NTT_q
1262 << endl;
1263 }
1264
1265}
1266
1267
1268}}}
1269
1270
1271
1272
1273
functions related to strings and character arrays
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects