16namespace layer1_foundations {
17namespace coding_theory {
37 int n,
int k,
int q,
int verbose_level)
39 int f_v = (verbose_level >= 1);
44 cout <<
"coding_theory_domain::make_mac_williams_equations" << endl;
48 for (i = 0; i <= n; i++) {
49 for (j = 0; j <= n; j++) {
50 Combi.
krawtchouk(M[i * (n + 1) + j], n, q, i, j);
60 snprintf(str, 1000,
"MacWilliams_n%d_k%d_q%d.tex", n, k, q);
62 snprintf(title, 1000,
"MacWilliams System for a $[%d,%d]_{%d}$ code", n, k, q);
84 cout <<
"coding_theory_domain::make_mac_williams_equations "
85 "before print_longinteger_matrix_tex" << endl;
91 ost <<
"\\left[" << endl;
93 ost <<
"\\right]" << endl;
97 cout <<
"coding_theory_domain::make_mac_williams_equations "
98 "after print_longinteger_matrix_tex" << endl;
107 cout <<
"written file " << fname <<
" of size "
112 cout <<
"coding_theory_domain::make_mac_williams_equations done" << endl;
117 int n_max,
int q,
int verbose_level)
119 int f_v = (verbose_level >= 1);
120 int n, k, d_S, d_H, d_P, d_G, d_GV;
123 cout <<
"coding_theory_domain::make_table_of_bounds" << endl;
125 vector<vector<long int>> Table;
127 for (n = 2; n <= n_max; n++) {
128 for (k = 1; k <= n; k++) {
129 cout <<
"n=" << n <<
" k=" << k <<
" q=" << q << endl;
131 cout <<
"d_S=" << d_S << endl;
133 cout <<
"d_H=" << d_H << endl;
135 cout <<
"d_P=" << d_P << endl;
137 cout <<
"d_G=" << d_G << endl;
139 cout <<
"d_GV=" << d_GV << endl;
140 vector<long int> entry;
145 entry.push_back(d_GV);
146 entry.push_back(d_S);
147 entry.push_back(d_H);
148 entry.push_back(d_P);
149 entry.push_back(d_G);
150 Table.push_back(entry);
161 for (i = 0; i < N; i++) {
162 for (j = 0; j < nb_cols; j++) {
163 T[i * nb_cols + j] = Table[i][j];
170 sprintf(str,
"_n%d_q%d", n_max, q);
172 fname.assign(
"table_of_bounds");
174 fname.append(
".csv");
178 headers =
new string[8];
180 headers[0].assign(
"n");
181 headers[1].assign(
"k");
182 headers[2].assign(
"q");
183 headers[3].assign(
"GV");
184 headers[4].assign(
"S");
185 headers[5].assign(
"H");
186 headers[6].assign(
"P");
187 headers[7].assign(
"G");
190 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
197 cout <<
"coding_theory_domain::make_table_of_bounds done" << endl;
202 int n,
int k,
int d,
int q,
205 int f_v = (verbose_level >= 1);
208 cout <<
"coding_theory_domain::make_gilbert_varshamov_code" << endl;
209 cout <<
"coding_theory_domain::make_gilbert_varshamov_code P->N_points = " << P->
N_points << endl;
222 cout <<
"coding_theory_domain::make_gilbert_varshamov_code found "
223 "the following parity check matrix as projective set: ";
239 cout <<
"coding_theory_domain::make_gilbert_varshamov_code parity check matrix:" << endl;
242 cout <<
"coding_theory_domain::make_gilbert_varshamov_code parity check matrix:" << endl;
248 cout <<
"coding_theory_domain::make_gilbert_varshamov_code generator matrix:" << endl;
252 cout <<
"coding_theory_domain::make_gilbert_varshamov_code generator matrix:" << endl;
264 cout <<
"coding_theory_domain::make_gilbert_varshamov_code done" << endl;
270 long int *set,
int *f_forbidden,
int level,
int verbose_level)
272 int f_v = (verbose_level >= 1);
275 cout <<
"coding_theory_domain::make_gilbert_varshamov_code level = " << level << endl;
276 cout <<
"coding_theory_domain::make_gilbert_varshamov_code set = ";
282 cout <<
"done" << endl;
289 if (!f_forbidden[a]) {
295 cout <<
"coding_theory_domain::make_gilbert_varshamov_code_recursion "
296 "failure to construct the code" << endl;
301 cout <<
"coding_theory_domain::make_gilbert_varshamov_code_recursion "
302 "picking a=" << a << endl;
314 cout <<
"coding_theory_domain::make_gilbert_varshamov_code nmk = " << nmk << endl;
317 f_forbidden[a] =
TRUE;
318 add_set.push_back(a);
326 int s, N, h, u, c, e, t, f;
338 for (i = 1; i <= s; i++) {
341 cout <<
"coding_theory_domain::make_gilbert_varshamov_code "
342 "N_" << i <<
" = " << N << endl;
346 cout <<
"looping over all subsets of size " << i <<
":" << endl;
348 for (h = 0; h < N; h++) {
351 for (u = 0; u < i; u++) {
355 for (t = 0; t < nmk; t++) {
356 v3[t] = P->
F->
add(v3[t], v1[t]);
360 for (t = 0; t < nmk; t++) {
361 v3[t] = P->
F->
add(v3[t], v1[t]);
365 cout <<
"h=" << h <<
" / " << N <<
" : ";
371 if (!f_forbidden[f]) {
372 f_forbidden[f] =
TRUE;
373 add_set.push_back(f);
376 cout <<
" : is new forbidden point " << cnt;
391 cout <<
"coding_theory_domain::make_gilbert_varshamov_code "
392 "level = " << level <<
" : cnt = " << cnt <<
" calling the recursion:" << endl;
396 cout <<
"coding_theory_domain::make_gilbert_varshamov_code "
397 "level = " << level <<
" : cnt = " << cnt <<
" done with the recursion:" << endl;
400 for (i = 0; i < add_set.size(); i++) {
402 f_forbidden[b] =
FALSE;
407 cout <<
"coding_theory_domain::make_gilbert_varshamov_code done" << endl;
416 int f_v = (verbose_level >= 1);
423 cout <<
"coding_theory_domain::gilbert_varshamov_lower_bound_for_d" << endl;
425 qnmk.
create(q, __FILE__, __LINE__);
426 qm1.
create(q - 1, __FILE__, __LINE__);
428 qm1_power.
create(1, __FILE__, __LINE__);
429 S.
create(0, __FILE__, __LINE__);
433 D.
mult(b, qm1_power, s);
442 D.
mult(qm1_power, qm1, s);
446 cout <<
"coding_theory_domain::gilbert_varshamov_lower_bound_for_d done" << endl;
453 int n,
int k,
int q,
int verbose_level)
455 int f_v = (verbose_level >= 1);
459 cout <<
"coding_theory_domain::singleton_bound_for_d" << endl;
467 int n,
int k,
int q,
int verbose_level)
469 int f_v = (verbose_level >= 1);
470 int f_vv = (verbose_level >= 2);
478 cout <<
"coding_theory_domain::hamming_bound_for_d" << endl;
480 qnmk.
create(q, __FILE__, __LINE__);
481 qm1.
create(q - 1, __FILE__, __LINE__);
483 qm1_power.
create(1, __FILE__, __LINE__);
484 B.
create(0, __FILE__, __LINE__);
486 cout <<
"coding_theory_domain::hamming_bound_for_d: "
487 "q=" << q <<
" n=" << n <<
" k=" << k <<
" "
488 << q <<
"^" << n - k <<
" = " << qnmk << endl;
492 D.
mult(b, qm1_power, s);
500 cout <<
"B=" << B <<
" t=" << t <<
" d=" << d << endl;
505 cout <<
"e=" << e <<
" B=" << B <<
" is OK" << endl;
507 D.
mult(qm1_power, qm1, s);
511 cout <<
"coding_theory_domain::hamming_bound_for_d done" << endl;
517 int n,
int k,
int q,
int verbose_level)
519 int f_v = (verbose_level >= 1);
520 int f_vv = (verbose_level >= 2);
526 cout <<
"coding_theory_domain::plotkin_bound_for_d" << endl;
531 qkm1.
create(q, __FILE__, __LINE__);
533 a.
create(n, __FILE__, __LINE__);
537 a.
create(q - 1, __FILE__, __LINE__);
542 a.
create(q, __FILE__, __LINE__);
546 a.
create(-1, __FILE__, __LINE__);
551 cout <<
"coding_theory_domain::plotkin_bound_for_d "
552 "q=" << q <<
" n=" << n <<
" k=" << k << endl;
557 cout << c <<
" / " << b <<
" = " << d << endl;
560 cout <<
"coding_theory_domain::plotkin_bound_for_d" << endl;
566 int n,
int k,
int q,
int verbose_level)
568 int f_v = (verbose_level >= 1);
572 cout <<
"coding_theory_domain::griesmer_bound_for_d" << endl;
574 for (d = 1; d <= n; d++) {
582 cout <<
"coding_theory_domain::griesmer_bound_for_d done" << endl;
588 int k,
int d,
int q,
int verbose_level)
590 int f_v = (verbose_level >= 1);
591 int f_vv = (verbose_level >= 2);
597 cout <<
"coding_theory_domain::griesmer_bound_for_n" << endl;
599 one.
create(1, __FILE__, __LINE__);
600 d1.
create(d, __FILE__, __LINE__);
601 qq.
create(q, __FILE__, __LINE__);
602 qi.
create(1, __FILE__, __LINE__);
603 S.
create(0, __FILE__, __LINE__);
605 cout <<
"coding_theory_domain::griesmer_bound_for_n q=" << q
606 <<
" d=" << d <<
" k=" << k << endl;
608 for (i = 0; i < k; i++) {
621 cout <<
"i=" << i <<
" S=" << S << endl;
626 cout <<
"coding_theory_domain::griesmer_bound_for_n" << endl;
633 int q,
int n,
int k,
int verbose_level)
635 int f_v = (verbose_level >= 1);
641 cout <<
"interface_coding_theory::do_make_macwilliams_system" << endl;
646 cout <<
"\\begin{array}{r|*{" << n <<
"}{r}}" << endl;
647 for (i = 0; i <= n; i++) {
648 for (j = 0; j <= n; j++) {
649 cout << M[i * (n + 1) + j];
654 cout <<
"\\\\" << endl;
656 cout <<
"\\end{array}" << endl;
659 for (i = 0; i <= n; i++) {
661 for (j = 0; j <= n; j++) {
662 cout << M[i * (n + 1) + j];
676 cout <<
"coding_theory_domain::do_make_macwilliams_system done" << endl;
683 int f_projective,
int verbose_level)
685 int f_v = (verbose_level >= 1);
695 cout <<
"coding_theory_domain::make_Hamming_graph_and_write_file" << endl;
715 int_vec_zero(Adj, N * N);
719 cout <<
"width=" << width << endl;
723 Table =
NEW_int(height * width);
724 for (i = 0; i < height; i++) {
733 for (j = 0; j < width; j++) {
743 for (h = 0; h < n; h++) {
750 if (f_graph && d == 1) {
755 Table[i * width + j] = d;
764 sprintf(str,
"Hamming_n%d_q%d.csv", n, q);
770 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
774 cout <<
"coding_theory_domain::make_Hamming_graph_and_write_file" << endl;
793 ost <<
"projective weights: " << endl;
794 for (i = 0; i <= n; i++) {
795 if (weights[i] == 0) {
798 ost << i <<
" : " << weights[i] << endl;
804 int *code,
int verbose_level)
807 int f_v = (verbose_level >= 1);
808 int *weight_enumerator;
812 cout <<
"coding_theory_domain::code_minimum_distance" << endl;
814 weight_enumerator =
NEW_int(n + 1);
821 for (i = 1; i <= n; i++) {
822 if (weight_enumerator[i]) {
827 cout <<
"coding_theory_domain::code_minimum_distance "
828 "the minimum weight is undefined" << endl;
840 int f_v = (verbose_level >= 1);
847 cout <<
"coding_theory_domain::codewords_affine" << endl;
851 cout << N <<
" messages" << endl;
856 for (h = 0; h < N; h++) {
865 cout <<
"coding_theory_domain::codewords_affine done" << endl;
872 int *weight_enumerator,
875 int f_v = (verbose_level >= 1);
876 int f_vv = (verbose_level >= 1);
887 cout <<
"coding_theory_domain::code_projective_weight_enumerator" << endl;
891 cout << N <<
" messages" << endl;
898 for (h = 0; h < N; h++) {
902 cout << setw(10) << h <<
" / " << setw(10) << N <<
" : ";
906 cout <<
"so far, the weight enumerator is:" << endl;
907 for (i = 0; i <= n; i++) {
908 if (weight_enumerator[i] == 0)
910 cout << setw(5) << i <<
" : " << setw(10)
911 << weight_enumerator[i] << endl;
918 for (i = 0; i < n; i++) {
923 weight_enumerator[wt]++;
926 cout <<
"the weight enumerator is:" << endl;
927 for (i = 0; i <= n; i++) {
928 if (weight_enumerator[i] == 0) {
931 cout << setw(5) << i <<
" : " << setw(10)
932 << weight_enumerator[i] << endl;
944 int *weight_enumerator,
947 int f_v = (verbose_level >= 1);
948 int f_vv = (verbose_level >= 1);
959 cout <<
"coding_theory_domain::code_weight_enumerator" << endl;
963 cout << N <<
" messages" << endl;
970 for (h = 0; h < N; h++) {
974 cout << setw(10) << h <<
" / " << setw(10) << N <<
" : ";
978 cout <<
"so far, the weight enumerator is:" << endl;
979 for (i = 0; i <= n; i++) {
980 if (weight_enumerator[i] == 0) {
983 cout << setw(5) << i <<
" : " << setw(10)
984 << weight_enumerator[i] << endl;
991 for (i = 0; i < n; i++) {
996 weight_enumerator[wt]++;
999 cout <<
"the weight enumerator is:" << endl;
1000 for (i = 0; i <= n; i++) {
1001 if (weight_enumerator[i] == 0) {
1004 cout << setw(5) << i <<
" : " << setw(10)
1005 << weight_enumerator[i] << endl;
1018 int *weight_enumerator,
1021 int f_v = (verbose_level >= 1);
1022 int f_vv = (verbose_level >= 2);
1033 cout <<
"coding_theory_domain::code_weight_enumerator_fast" << endl;
1037 cout << N <<
" projective messages" << endl;
1045 for (h = 0; h < N; h++) {
1049 cout << setw(10) << h <<
" / " << setw(10) << N <<
" : ";
1053 cout <<
"so far, the weight enumerator is:" << endl;
1054 for (i = 0; i <= n; i++) {
1055 if (weight_enumerator[i] == 0) {
1058 cout << setw(5) << i <<
" : " << setw(10)
1059 << (F->
q - 1) * weight_enumerator[i] << endl;
1067 for (i = 0; i < n; i++) {
1072 weight_enumerator[wt]++;
1074 cout << h <<
" / " << N <<
" msg: ";
1076 cout <<
" codeword ";
1078 cout <<
" weight " << wt << endl;
1081 weight_enumerator[0] = 1;
1082 for (i = 1; i <= n; i++) {
1083 weight_enumerator[i] *= F->
q - 1;
1086 cout <<
"the weight enumerator is:" << endl;
1087 for (i = 0; i <= n; i++) {
1088 if (weight_enumerator[i] == 0) {
1091 cout << setw(5) << i <<
" : " << setw(10)
1092 << weight_enumerator[i] << endl;
1108 int f_v = (verbose_level >= 1);
1120 cout <<
"coding_theory_domain::code_projective_weights" << endl;
1124 cout << N <<
" projective messages" << endl;
1130 for (h = 0; h < N; h++) {
1134 cout << setw(10) << h <<
" / " << setw(10) << N <<
" : ";
1142 for (i = 0; i < n; i++) {
1150 cout <<
"coding_theory_domain::code_projective_weights done" << endl;
1165 for (i = 0; i <= n; i++) {
1166 for (j = 0; j <= n; j++) {
1167 D.
krawtchouk(M[i * (n + 1) + j], n, q, i, j);
1174 int n = 19, k = 7, q = 2;
1179 qk.
create(q, __FILE__, __LINE__);
1181 cout << q <<
"^" << k <<
" = " << qk << endl;
1189 for (i = 0; i <= n; i++) {
1190 A1[i].
create(0, __FILE__, __LINE__);
1192 A1[0].
create(1, __FILE__, __LINE__);
1193 A1[8].
create(78, __FILE__, __LINE__);
1194 A1[12].
create(48, __FILE__, __LINE__);
1195 A1[16].
create(1, __FILE__, __LINE__);
1212 int *M,
int m,
int n,
1213 int f_normalize_from_the_left,
int f_normalize_from_the_right,
1216 int f_v = (verbose_level >= 1);
1219 int *weight_enumerator;
1224 cout <<
"coding_theory_domain::do_weight_enumerator" << endl;
1229 weight_enumerator =
NEW_int(n + 1);
1233 cout <<
"coding_theory_domain::do_weight_enumerator input matrix:" << endl;
1236 cout <<
"$$" << endl;
1237 cout <<
"\\left[" << endl;
1239 cout <<
"\\right]" << endl;
1240 cout <<
"$$" << endl;
1246 FALSE , NULL , m, n, n,
1251 cout <<
"coding_theory_domain::do_weight_enumerator after RREF:" << endl;
1253 cout <<
"rk=" << rk << endl;
1256 cout <<
"$$" << endl;
1257 cout <<
"\\left[" << endl;
1259 cout <<
"\\right]" << endl;
1260 cout <<
"$$" << endl;
1263 cout <<
"coding_theory_domain::do_weight_enumerator coefficients:" << endl;
1274 cout <<
"coding_theory_domain::do_weight_enumerator The weight enumerator is:" << endl;
1275 for (i = 0; i <= n; i++) {
1276 cout << i <<
" : " << weight_enumerator[i] << endl;
1281 for (i = 0; i <= n; i++) {
1282 if (weight_enumerator[i] == 0) {
1291 cout << weight_enumerator[i];
1301 cout <<
"(" << i <<
")";
1314 cout <<
"(" << n - i <<
")";
1323 cout <<
"coding_theory_domain::do_weight_enumerator The weight enumerator is:" << endl;
1324 for (i = 0; i <= n; i++) {
1325 cout << i <<
" : " << weight_enumerator[i] << endl;
1330 for (i = 0; i <= n; i++) {
1331 if (weight_enumerator[i] == 0) {
1340 cout << weight_enumerator[i];
1350 cout <<
"{" << i <<
"}";
1363 cout <<
"{" << n - i <<
"}";
1371 cout <<
"weight enumerator:" << endl;
1378 if (f_normalize_from_the_left) {
1380 cout <<
"coding_theory_domain::do_weight_enumerator normalizing from the left" << endl;
1382 for (i = 0; i < rk; i++) {
1388 cout <<
"coding_theory_domain::do_weight_enumerator after normalize from the left:" << endl;
1390 cout <<
"rk=" << rk << endl;
1394 if (f_normalize_from_the_right) {
1396 cout <<
"coding_theory_domain::do_weight_enumerator normalizing from the right" << endl;
1398 for (i = 0; i < rk; i++) {
1404 cout <<
"coding_theory_domain::do_weight_enumerator after normalize from the right:" << endl;
1406 cout <<
"coding_theory_domain::do_weight_enumerator rk=" << rk << endl;
1416 cout <<
"coding_theory_domain::do_weight_enumerator done" << endl;
1424 long int *basis_set,
int k,
1428 cout <<
"coding_theory_domain::linear_code_through_basis:" << endl;
1442 for (i = 0; i < k; i++) {
1447 cout <<
"genma:" << endl;
1458 for (i = 0; i < sz; i++) {
1461 code_word, 1, k, n, 0 );
1468 cout <<
" : " << set[i] << endl;
1472 cout <<
"Codewords : ";
1483 snprintf(fname, 1000,
"code_n%d_k%d_q%d.tex", n, k, F->
q);
1484 snprintf(title, 1000,
"Linear $[%d,%d]$ code over GF($%d$)", n, k, F->
q);
1490 ofstream ost(fname);
1504 ost <<
"$$" << endl;
1505 ost <<
"\\left[" << endl;
1507 ost <<
"\\right]" << endl;
1508 ost <<
"$$" << endl;
1509 ost <<
"Codewords: ";
1520 cout <<
"written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
1534 int n,
int k,
long int *columns_set_of_size_n,
1538 int f_v = (verbose_level >= 1);
1541 cout <<
"coding_theory_domain::matrix_from_projective_set" << endl;
1547 for (j = 0; j < n; j++) {
1550 for (i = 0; i < k; i++) {
1551 genma[i * n + j] = v[i];
1557 cout <<
"coding_theory_domain::matrix_from_projective_set done" << endl;
1563 long int *columns_set,
int k,
1566 int f_v = (verbose_level >= 1);
1569 cout <<
"coding_theory_domain::do_linear_code_through_columns_of_parity_check_projectively" << endl;
1586 for (j = 0; j < n; j++) {
1589 for (i = 0; i < k; i++) {
1590 genma[i * n + j] = v[i];
1593 cout <<
"genma:" << endl;
1603 for (i = 0; i < N; i++) {
1606 code_word, 1, k, n, 0 );
1613 cout <<
" : " << set[i] << endl;
1617 cout <<
"Codewords : ";
1625 snprintf(str, 1000,
"codewords_n%d_k%d_q%d.csv", n, k, F->
q);
1626 fname_csv.assign(str);
1628 cout <<
"written file " << fname_csv <<
" of size "
1638 snprintf(fname, 1000,
"code_n%d_k%d_q%d.tex", n, k, F->
q);
1639 snprintf(title, 1000,
"Linear $[%d,%d]$ code over GF($%d$)", n, k, F->
q);
1645 ofstream ost(fname);
1659 ost <<
"$$" << endl;
1660 ost <<
"\\left[" << endl;
1662 ost <<
"\\right]" << endl;
1663 ost <<
"$$" << endl;
1665 ost <<
"Codewords: ";
1667 lint_vec_print(ost, set, n);
1677 cout <<
"written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
1691 cout <<
"coding_theory_domain::do_linear_code_through_columns_of_parity_check_projectively done" << endl;
1697 long int *columns_set,
int k,
1700 int f_v = (verbose_level >= 1);
1703 cout <<
"coding_theory_domain::do_linear_code_through_columns_of_parity_check" << endl;
1720 for (j = 0; j < n; j++) {
1723 for (i = 0; i < k; i++) {
1724 genma[i * n + j] = v[i];
1727 cout <<
"genma:" << endl;
1737 for (i = 0; i < N; i++) {
1740 code_word, 1, k, n, 0 );
1747 cout <<
" : " << set[i] << endl;
1751 cout <<
"Codewords : ";
1759 snprintf(str, 1000,
"codewords_n%d_k%d_q%d.csv", n, k, F->
q);
1760 fname_csv.assign(str);
1762 cout <<
"written file " << fname_csv <<
" of size "
1772 snprintf(fname, 1000,
"code_n%d_k%d_q%d.tex", n, k, F->
q);
1773 snprintf(title, 1000,
"Linear $[%d,%d]$ code over GF($%d$)", n, k, F->
q);
1779 ofstream ost(fname);
1793 ost <<
"$$" << endl;
1794 ost <<
"\\left[" << endl;
1796 ost <<
"\\right]" << endl;
1797 ost <<
"$$" << endl;
1799 ost <<
"Codewords: ";
1801 lint_vec_print(ost, set, n);
1811 cout <<
"written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
1825 cout <<
"coding_theory_domain::do_linear_code_through_columns_of_parity_check done" << endl;
1831 int polynomial_degree,
1832 int polynomial_nb_vars,
1833 std::string &polynomial_text,
1837 int f_v = (verbose_level >= 1);
1840 cout <<
"reading polynomial " << polynomial_text <<
" of degree "
1841 << polynomial_degree <<
" in "
1842 << polynomial_nb_vars <<
" variables" << endl;
1845 long int *poly_monomials;
1846 int poly_monomials_sz;
1855 Lint_vec_scan(polynomial_text, poly_monomials, poly_monomials_sz);
1856 cout <<
"polynomial after scan: ";
1865 Poly->
init(Fq, polynomial_nb_vars, polynomial_degree,
1867 Monomial_ordering_type,
1869 mon =
NEW_int(polynomial_nb_vars);
1874 for (i = 0; i < poly_monomials_sz; i++) {
1876 a = poly_monomials[i];
1884 mon[0] += polynomial_degree - j;
1886 coeff[idx] = Fq->
add(coeff[idx], 1);
1900 v =
NEW_int(polynomial_nb_vars);
1907 for (h = 0; h < Poly->
get_P()->N_points; h++) {
1911 cout <<
" : " << f[h] << endl;
1912 if (f[h] == 1 && v[polynomial_nb_vars - 1] == 1) {
1921 cout <<
"We found a set of size " << set_sz <<
" : " << endl;
1935 int f_v = (verbose_level >= 1);
1938 cout <<
"coding_theory_domain::do_sylvester_hadamard" << endl;
1943 cout <<
"for Hadamard matrices, n must be divisible by 4." << endl;
1947 int nb_factors, sz, sz1, j, a;
1950 int H2[4] = {1,1,1,2};
1956 cout <<
"nb_factors = " << nb_factors << endl;
1958 if ((2 << nb_factors) != n) {
1959 cout <<
"for Sylvester type Hadamard matrices, n must be 4 times a power of two" << endl;
1971 for (i = 0; i < nb_factors; i++) {
1973 cout <<
"M1=" << endl;
1984 cout <<
"Sylvester type Hadamard matrix:" << endl;
1986 for (i = 0; i < sz; i++) {
1987 for (j = 0; j < sz; j++) {
1989 M1[(sz + i) * sz + j] = F->
negate(a);
1993 for (i = 0; i < 2 * sz; i++) {
1994 for (j = 0; j < sz; j++) {
2001 cout <<
"Sylvester type Hadamard code:" << endl;
2008 for (i = 0; i < 2 * sz; i++) {
2025 int nb_words,
int n,
int f_metric_balls,
int radius_of_metric_ball,
2026 int f_enhance,
int radius,
2029 int f_v = (verbose_level >= 1);
2030 int nb_rows, nb_cols;
2041 cout <<
"coding_theory_domain::code_diagram" << endl;
2042 cout <<
"n=" << n << endl;
2043 cout <<
"set:" << endl;
2051 cout <<
"coding_theory_domain::code_diagram" << endl;
2052 cout <<
"nb_rows=" << nb_rows << endl;
2053 cout <<
"nb_cols=" << nb_cols << endl;
2057 M1 =
NEW_int(nb_rows * nb_cols);
2058 M2 =
NEW_int(nb_rows * nb_cols);
2059 M3 =
NEW_int(nb_rows * nb_cols);
2060 M =
NEW_int(nb_rows * nb_cols);
2066 for (h = 0; h < nb_rows * nb_cols; h++) {
2072 cout <<
"N=" << N << endl;
2074 cout <<
"placing codewords" << endl;
2075 for (h = 0; h < N; h++) {
2077 M1[i * nb_cols + j] = h;
2080 cout <<
"placing position values done" << endl;
2083 cout <<
"placing codewords" << endl;
2085 for (h = 0; h < nb_words; h++) {
2087 cout <<
"codeword " << h + 1 <<
" = " << setw(5) << Words[h];
2092 M[i * nb_cols + j] = h + 1;
2093 M2[i * nb_cols + j] = 1;
2094 M3[i * nb_cols + j] = 0;
2097 embellish(M, nb_rows, nb_cols, i, j, h + 1 , radius);
2100 embellish(M2, nb_rows, nb_cols, i, j, 1 , radius);
2104 cout <<
"placing codewords done" << endl;
2108 if (f_metric_balls) {
2112 set_of_errors =
NEW_int(radius_of_metric_ball);
2114 for (h = 0; h < nb_words; h++) {
2116 cout <<
"codeword " << h + 1 <<
" = " << setw(5) << Words[h];
2121 for (u = 1; u <= radius_of_metric_ball; u++) {
2125 for (t = 0; t < N; t++) {
2128 for (s = 0; s < u; s++) {
2129 a = set_of_errors[s];
2130 v[a] = (v[a] + 1) % 2;
2133 if (M[i * nb_cols + j]) {
2134 cout <<
"the metric balls overlap!" << endl;
2135 cout <<
"h=" << h << endl;
2136 cout <<
"t=" << t << endl;
2137 cout <<
"i=" << i << endl;
2138 cout <<
"j=" << j << endl;
2141 M[i * nb_cols + j] = h + 1;
2148 int *Dist_from_code_enumerator;
2150 int s, original_value, a;
2155 Dist_from_code_enumerator =
NEW_int(n + 1);
2158 for (d = 0; d < n; d++) {
2159 cout <<
"computing words of distance " << d + 1 <<
" from the code" << endl;
2160 for (h = 0; h < nb_rows * nb_cols; h++) {
2162 Dist_from_code_enumerator[d]++;
2166 for (s = 0; s < n; s++) {
2167 original_value = v[s];
2168 v[s] = (v[s] + 1) % 2;
2170 a = i * nb_cols + j;
2171 if (M3[a] > d + 1) {
2174 v[s] = original_value;
2178 cout <<
"We found " << Dist_from_code_enumerator[d]
2179 <<
" words at distance " << d <<
" from the code" << endl;
2181 if (Dist_from_code_enumerator[d] == 0) {
2185 cout <<
"d : # words at distance d from code" << endl;
2186 for (d = 0; d < n; d++) {
2187 cout << d <<
" : " << Dist_from_code_enumerator[d] << endl;
2198 fname.assign(label);
2200 sprintf(str,
"_%d_%d.tex", n, nb_words);
2221 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2232 fname.assign(label);
2234 sprintf(str,
"_diagram_%d_%d.csv", n, nb_words);
2240 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2251 fname.assign(label);
2253 sprintf(str,
"_diagram_01_%d_%d.csv", n, nb_words);
2259 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2267 fname.assign(label);
2269 sprintf(str,
"_holes_%d_%d.csv", n, nb_words);
2275 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2285 cout <<
"coding_theory_domain::code_diagram done" << endl;
2290 int nb_words,
int n,
int f_embellish,
int verbose_level)
2292 int f_v = (verbose_level >= 1);
2293 int nb_rows, nb_cols;
2304 cout <<
"coding_theory_domain::investigate_code" << endl;
2305 cout <<
"n=" << n << endl;
2306 cout <<
"set:" << endl;
2314 cout <<
"coding_theory_domain::investigate_code" << endl;
2315 cout <<
"nb_rows=" << nb_rows << endl;
2316 cout <<
"nb_cols=" << nb_cols << endl;
2320 M1 =
NEW_int(nb_rows * nb_cols);
2321 M2 =
NEW_int(nb_rows * nb_cols);
2322 M =
NEW_int(nb_rows * nb_cols);
2331 cout <<
"N=" << N << endl;
2333 cout <<
"placing codewords" << endl;
2334 for (h = 0; h < N; h++) {
2336 M1[i * nb_cols + j] = h;
2339 cout <<
"placing position values done" << endl;
2345 C =
new colored_graph;
2347 C->init_adjacency_no_colors(
int nb_points,
int *Adj,
int verbose_level);
2353 sprintf(fname,
"code_%d_%d.tex", n, nb_words);
2366 cout <<
"placing codewords" << endl;
2368 for (h = 0; h < nb_words; h++) {
2370 cout <<
"codeword " << h + 1 <<
" = " << setw(5) << Words[h];
2375 M[i * nb_cols + j] = h + 1;
2376 M2[i * nb_cols + j] = 1;
2378 embellish(M, nb_rows, nb_cols, i, j, h + 1, 3);
2382 cout <<
"placing codewords done" << endl;
2391 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2393 cout <<
"M2:" << endl;
2401 sprintf(str,
"code_matrix_%d_%d.csv", nb_rows, nb_cols);
2414 cout <<
"before create_Levi_graph_from_incidence_matrix" << endl;
2415 CG->create_Levi_graph_from_incidence_matrix(M, nb_rows, nb_cols,
2419 cout <<
"after create_Levi_graph_from_incidence_matrix" << endl;
2424 sprintf(fname,
"code_%d_%d_Levi_%d_%d.bin",
2425 n, nb_words, nb_rows, nb_cols);
2426 CG->save(fname, verbose_level);
2440 cout <<
"before BF->init, n=" << n << endl;
2449 for (h = 0; h < nb_words; h++) {
2453 cout <<
"computing the polynomial representation: " << endl;
2462 cout <<
"The representation as polynomial is: ";
2473 for (h = 0; h < BF->
Q; h++) {
2475 cout <<
"f[h] != g[h], h = " << h <<
", an error has occured" << endl;
2488 for (i = 0; i < nb_words; i++) {
2489 for (j = i + 1; j < nb_words; j++) {
2490 d =
distance(n, Words[i], Words[j]);
2496 cout <<
"minimum distance d = " << D << endl;
2497 cout <<
"attained for:" << endl;
2498 for (i = 0; i < nb_words; i++) {
2499 for (j = i + 1; j < nb_words; j++) {
2500 if (
distance(n, Words[i], Words[j]) == D) {
2501 cout << i <<
", " << j << endl;
2511 std::vector<std::string> &long_code_generators_text,
2512 int f_nearest_codeword,
2513 std::string &nearest_codeword_text,
2516 int f_v = (verbose_level >= 1);
2519 cout <<
"coding_theory_domain::do_long_code" << endl;
2526 k = long_code_generators_text.size();
2529 for (i = 0; i < k; i++) {
2536 for (j = 0; j < sz; j++) {
2537 genma[i * n + set[j]] = 1;
2542 cout <<
"genma:" << endl;
2550 sprintf(str,
"long_code_genma_n%d_k%d.csv", n, k);
2553 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2560 int nb_rows, nb_cols;
2571 cout <<
"n=" << n << endl;
2572 cout <<
"nb_rows=" << nb_rows << endl;
2573 cout <<
"nb_cols=" << nb_cols << endl;
2579 M =
NEW_int(nb_rows * nb_cols);
2589 for (i = 0; i < sz; i++) {
2592 code_word, 1, k, n, 0 );
2596 for (h = 0; h < n; h++) {
2602 for (h = 0; h < n; h++) {
2605 M[r * nb_cols + c] = 1;
2613 sprintf(str,
"long_code_genma_n%d_k%d_codeword_%d.csv", n, k, i);
2616 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2621 cout <<
"Weight distribution:";
2628 cout <<
"i : weight of the i-th codeword" << endl;
2629 for (i = 0; i < sz; i++) {
2630 cout << i <<
" : " << Wt[i] << endl;
2645 cout <<
"before BF->init, ln=" << ln << endl;
2652 if (f_nearest_codeword) {
2654 cout <<
"nearest codeword" << endl;
2656 long int *nearest_codeword_set;
2657 int nearest_codeword_sz;
2662 nearest_codeword_set, nearest_codeword_sz);
2667 for (j = 0; j < nearest_codeword_sz; j++) {
2668 word[nearest_codeword_set[j]] = 1;
2670 for (h = 0; h < n; h++) {
2681 for (h = 0; h < n; h++) {
2683 M[r * nb_cols + c] = g[h];
2690 sprintf(str,
"long_code_genma_n%d_k%d_nearest_codeword_fourier.csv", n, k);
2693 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2697 for (h = 0; h < n; h++) {
2700 M[r * nb_cols + c] = 1;
2708 sprintf(str,
"long_code_genma_n%d_k%d_nearest_codeword.csv", n, k);
2711 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
2718 for (i = 0; i < sz; i++) {
2721 code_word, 1, k, n, 0 );
2724 for (h = 0; h < n; h++) {
2725 if (word[h] != code_word[h]) {
2732 cout <<
"distance distribution:";
2739 cout <<
"i : distance from the i-th codeword" << endl;
2740 for (i = 0; i < sz; i++) {
2741 cout << i <<
" : " << D[i] << endl;
2749 cout <<
"no nearest codeword option" << endl;
2794 for (u = -rad; u <= rad; u++) {
2795 for (v = -rad; v <= rad; v++) {
2802 for (h = 0; h < 8 + 18; h++) {
2803 i = i0 + ij[h * 2 + 0];
2804 j = j0 + ij[h * 2 + 1];
2824 M[i * nb_cols + j] = a;
2831 int nb_rows, nb_cols;
2838 cout <<
"N=" << N << endl;
2840 for (h = 0; h < N; h++) {
2842 cout << h <<
" : (" << i <<
"," << j <<
")" << endl;
2851 M =
NEW_int(nb_rows * nb_cols);
2855 for (h = 0; h < r; h++) {
2858 cout <<
"s = " << setw(5) << s;
2863 M[i * nb_cols + j] = 1;
2864 s = (a * s + c) % N;
2872 for (i = 0; i < r; i++) {
2873 for (j = i + 1; j < r; j++) {
2875 cout <<
"The distance between word " << i <<
" and word " << j <<
" is " << d << endl;
2880 cout <<
"minimum distance d = " << D << endl;
2881 cout <<
"attained for:" << endl;
2882 for (i = 0; i < r; i++) {
2883 for (j = i + 1; j < r; j++) {
2884 if (
distance(n, W[i], W[j]) == D) {
2885 cout << i <<
", " << j << endl;
2917 for (c = n - 1; c >= 0; c--) {
2926 for (c = 0; c < n; c++) {
2941 for (c = 0; c < n; c++) {
2942 if (a % 2 != b % 2) {
2960 for (c = 0; h; c++) {
2986 for (c = 0; c < n; c++) {
3008 int m,
int n, std::string &genma_text,
3011 int f_v = (verbose_level >= 1);
3018 cout <<
"coding_theory_domain::field_reduction" << endl;
3025 Sub->
init(FQ, Fq, verbose_level);
3035 cout <<
"sz != m * n" << endl;
3041 for (i = 0; i < m; i++) {
3053 snprintf(str, 1000,
"field_reduction_Q%d_q%d_%d_%d.tex", FQ->
q, Fq->
q, m, n);
3055 snprintf(title, 1000,
"Field Reduction");
3061 ofstream ost(fname);
3077 ost <<
"$$" << endl;
3078 ost <<
"\\left[" << endl;
3080 ost <<
"\\right]" << endl;
3081 ost <<
"$$" << endl;
3084 ost <<
"\\\\" << endl;
3093 cout <<
"coding_theory_domain::field_reduction written "
3094 "file " << fname <<
" of size "
3099 fname_csv.assign(label);
3100 fname_csv.append(
".csv");
3109 cout <<
"coding_theory_domain::field_reduction done" << endl;
3115 std::string &text, std::string &fname,
3118 int f_v = (verbose_level >= 1);
3121 cout <<
"coding_theory_domain::CRC_encode_text e=" << Nth->
F->
e << endl;
3132 for (i = 0; i < l; i++) {
3134 if (c >=
'A' && c <=
'Z') {
3137 else if (c >=
'a' && c <=
'z') {
3140 else if (c ==
' ') {
3143 else if (c ==
',') {
3146 else if (c ==
'.') {
3154 for (h = 0; h < 5; h++) {
3155 encoding[j++] = a % 2;
3164 degree = Nth->
FX->
degree(CRC_poly);
3166 cout <<
"coding_theory_domain::CRC_encode_text degree=" << degree << endl;
3177 nb_bits = Nth->
F->
e;
3179 IP = nb_rows * nb_cols + nb_rows + nb_cols;
3187 int *information_and_parity;
3188 int *information_and_parity_Fq;
3192 information =
NEW_int(nb_rows * nb_cols);
3193 information_and_parity =
NEW_int(nb_rows * nb_cols + nb_rows + nb_cols);
3194 information_and_parity_Fq =
NEW_int(IPq);
3195 codeword_Fq =
NEW_int(IPq + degree);
3201 row_parity =
NEW_int(nb_rows);
3202 col_parity =
NEW_int(nb_cols);
3207 for (I = 0; I * nb_rows * nb_cols < len; I++) {
3211 for (j = 0; j < nb_rows * nb_cols; j++) {
3212 h = I * nb_rows * nb_cols + j;
3214 information[j] = encoding[h];
3227 fname_base.assign(fname);
3230 sprintf(str,
"_word%d", I);
3231 fname_base.append(str);
3235 fname_out.assign(fname_base);
3236 fname_out.append(
"_information.csv");
3241 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3243 for (j = 0; j < nb_cols; j++) {
3245 for (i = 0; i < nb_rows; i++) {
3246 a += information[i * nb_cols + j];
3253 fname_out.assign(fname_base);
3254 fname_out.append(
"_col_parity.csv");
3259 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3262 for (i = 0; i < nb_rows; i++) {
3264 for (j = 0; j < nb_cols; j++) {
3265 a += information[i * nb_cols + j];
3271 fname_out.assign(fname_base);
3272 fname_out.append(
"_row_parity.csv");
3277 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3279 Int_vec_copy(information, information_and_parity, nb_rows * nb_cols);
3280 Int_vec_copy(row_parity, information_and_parity + nb_rows * nb_cols, nb_rows);
3281 Int_vec_copy(col_parity, information_and_parity + nb_rows * nb_cols + nb_rows, nb_cols);
3284 fname_out.assign(fname_base);
3285 fname_out.append(
"_IP.csv");
3289 Fio.
int_matrix_write_csv(fname_out, information_and_parity, 1, nb_rows * nb_cols + nb_rows + nb_cols);
3290 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3293 for (i = 0; i < IPq; i++) {
3294 for (h = 0; h < nb_bits; h++) {
3295 v[h] = information_and_parity[i * nb_bits + h];
3298 information_and_parity_Fq[i] = a;
3301 fname_out.assign(fname_base);
3302 fname_out.append(
"_IPq.csv");
3305 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3310 for (i = 0; i < IPq; i++) {
3311 a = information_and_parity_Fq[i];
3312 Nth->
FX->
s_i(P, i + degree) = a;
3331 Int_vec_copy(information_and_parity_Fq, codeword_Fq + degree, IPq);
3332 for (i = 0; i < degree; i++) {
3333 a = Nth->
FX->
s_i(R, i);
3337 fname_out.assign(fname_base);
3338 fname_out.append(
"_codeword_Fq.csv");
3341 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3347 cout <<
"coding_theory_domain::CRC_encode_text done" << endl;
3352 std::string &fname,
int verbose_level)
3363 for (i = 0; i < l; i++) {
3365 if (c >=
'A' && c <=
'Z') {
3368 else if (c >=
'a' && c <=
'z') {
3371 else if (c ==
' ') {
3374 else if (c ==
',') {
3377 else if (c ==
'.') {
3381 cout <<
"unknown character " << c <<
" skipping" << endl;
3385 for (h = 0; h < 5; h++) {
3386 encoding[j++] = a % 2;
3397 cout <<
"Written file " << fname <<
" of size " << Fio.
file_size(fname) << endl;
3402 std::string &fname_out,
int nb_bits,
int verbose_level)
3404 int i, h, len, len2;
3415 cout <<
"Reading file " << fname_in <<
" of size " << Fio.
file_size(fname_in) << endl;
3418 len2 = (len + nb_bits - 1) / nb_bits;
3421 for (i = 0; i < len2; i++) {
3422 for (h = 0; h < nb_bits; h++) {
3423 v[h] = M[i * nb_bits + h];
3429 cout <<
"Written file " << fname_out <<
" of size " << Fio.
file_size(fname_out) << endl;
3438 for (i = 0; i < n; i++) {
3439 if (v1[i] != v2[i]) {
3452 for (i = 0; i < n; i++) {
3468 std::string &poly_coeffs,
3471 int f_v = (verbose_level >= 1);
3474 cout <<
"coding_theory_domain::generator_matrix_cyclic_code" << endl;
3493 for (i = 0; i < k; i++) {
3497 cout <<
"generator matrix:" << endl;
3501 cout <<
"generator matrix:" << endl;
3507 for (j = 0; j < n; j++) {
3508 for (i = 0; i < k; i++) {
3509 v[i] = M[i * n + j];
3516 cout <<
"generator matrix in projective points:" << endl;
3521 cout <<
"coding_theory_domain::generator_matrix_cyclic_code" << endl;
3540 int t,
int da,
int dc,
3543 int f_v = (verbose_level >= 1);
3546 cout <<
"coding_theory_domain::find_CRC_polynomials t=" << t
3547 <<
" info=" << da <<
" check=" << dc << endl;
3557 long int nb_sol = 0;
3567 for (i = 0; i <= dc; i++) {
3572 std::vector<std::vector<int>> Solutions;
3576 nb_sol, Solutions, verbose_level - 1);
3580 nb_sol, Solutions, verbose_level - 1);
3583 cout <<
"coding_theory_domain::find_CRC_polynomials info=" << da
3584 <<
" check=" << dc <<
" nb_sol=" << nb_sol << endl;
3586 for (i = 0; i < Solutions.size(); i++) {
3588 for (
int j = dc; j >= 0; j--) {
3589 cout << Solutions[i][j];
3593 cout <<
"coding_theory_domain::find_CRC_polynomials info=" << da
3594 <<
" check=" << dc <<
" nb_sol=" << nb_sol << endl;
3599 int da,
int *A,
int dc,
int *C,
3602 std::vector<std::vector<int> > &Solutions,
3612 if (ret && t >= 3) {
3617 cout <<
"illegal value for t, t=" << t << endl;
3621 cout <<
"solution " << nb_sol <<
" is ";
3622 for (
int j = dc; j >= 0; j--) {
3629 for (
int j = 0; j <= dc; j++) {
3630 sol.push_back(C[j]);
3632 Solutions.push_back(sol);
3646 i + 1, F, nb_sol, Solutions, verbose_level);
3653 for (c = 0; c < F->
q; c++) {
3658 i + 1, F, nb_sol, Solutions, verbose_level);
3664 int da,
int *A,
int dc,
int *C,
int i,
3666 std::vector<std::vector<int> > &Solutions,
3676 if (ret && t >= 3) {
3681 cout <<
"illegal value for t, t=" << t << endl;
3685 cout <<
"solution " << nb_sol <<
" is ";
3686 for (
int j = dc; j >= 0; j--) {
3693 for (
int j = 0; j <= dc; j++) {
3694 sol.push_back(C[j]);
3696 Solutions.push_back(sol);
3709 i + 1, nb_sol, Solutions, verbose_level);
3716 for (c = 0; c < 2; c++) {
3721 i + 1, nb_sol, Solutions, verbose_level);
3736 int f_v = (verbose_level >= 1);
3746 cout <<
"testing polynomial: ";
3747 for (k = dc; k >= 0; k--) {
3753 for (i = 0; i < da; i++) {
3757 for (i = 0; i < da; i++) {
3759 for (ai = 1; ai < F->
q; ai++) {
3763 for (j = i + 1; j < da; j++) {
3765 for (aj = 1; aj < F->
q; aj++) {
3769 for (k = 0; k < dc; k++) {
3772 for (k = 0; k < da; k++) {
3777 cout <<
"testing error pattern: ";
3778 for (k = dc + da - 1; k >= 0; k--) {
3789 for (k = dc - 1; k >= 0; k--) {
3818 int f_v = (verbose_level >= 1);
3827 cout <<
"testing polynomial: ";
3828 for (k = dc; k >= 0; k--) {
3834 for (
int h = 0; h < da; h++) {
3838 for (i1 = 0; i1 < da; i1++) {
3840 for (a1 = 1; a1 < F->
q; a1++) {
3844 for (i2 = i1 + 1; i2 < da; i2++) {
3846 for (a2 = 1; a2 < F->
q; a2++) {
3850 for (i3 = i2 + 1; i3 < da; i3++) {
3852 for (a3 = 1; a3 < F->
q; a3++) {
3856 for (
int h = 0; h < dc; h++) {
3859 for (
int h = 0; h < da; h++) {
3864 cout <<
"testing error pattern: ";
3865 for (
int h = dc + da - 1; h >= 0; h--) {
3876 for (
int h = dc - 1; h >= 0; h--) {
3906 int f_v = (verbose_level >= 1);
3915 cout <<
"testing polynomial: ";
3916 for (k = dc; k >= 0; k--) {
3922 for (i = 0; i < da; i++) {
3926 for (i = 0; i < da; i++) {
3931 for (j = i + 1; j < da; j++) {
3936 for (k = 0; k < dc; k++) {
3939 for (k = 0; k < da; k++) {
3944 cout <<
"testing error pattern: ";
3945 for (k = dc + da - 1; k >= 0; k--) {
3956 for (k = dc - 1; k >= 0; k--) {
3982 int f_v = (verbose_level >= 1);
3990 cout <<
"testing polynomial: ";
3991 for (k = dc; k >= 0; k--) {
3997 for (
int h = 0; h < da; h++) {
4001 for (i1 = 0; i1 < da; i1++) {
4005 for (i2 = i1 + 1; i2 < da; i2++) {
4010 for (i3 = i2 + 1; i3 < da; i3++) {
4015 for (
int h = 0; h < dc; h++) {
4018 for (
int h = 0; h < da; h++) {
4023 cout <<
"testing error pattern: ";
4024 for (
int h = dc + da - 1; h >= 0; h--) {
4035 for (
int h = dc - 1; h >= 0; h--) {
4061 int i, j, k, a, mav;
4063 for (i = da + db - 1; i >= db; i--) {
4071 for (j = db, k = i; j >= 0; j--, k--) {
4074 A[k] = F->
add(A[k], F->
mult(mav, B[j]));
4082 for (
int k = db - 1; k >= 0; k--) {
4098 for (i = da + db - 1; i >= db; i--) {
4106 for (j = db, k = i; j >= 0; j--, k--) {
4108 A[k] = (A[k] + B[j]) % 2;
4117 for (
int k = db - 1; k >= 0; k--) {
various functions related to coding theory
int Hamming_distance(int *v1, int *v2, int n)
void do_long_code(int n, std::vector< std::string > &long_code_generators_text, int f_nearest_codeword, std::string &nearest_codeword_text, int verbose_level)
void field_reduction(field_theory::finite_field *FQ, field_theory::finite_field *Fq, std::string &label, int m, int n, std::string &genma_text, int verbose_level)
int plotkin_bound_for_d(int n, int k, int q, int verbose_level)
int gilbert_varshamov_lower_bound_for_d(int n, int k, int q, int verbose_level)
void codewords_affine(field_theory::finite_field *F, int n, int k, int *code, int *codewords, int verbose_level)
void place_binary(long int h, int &i, int &j)
void search_for_CRC_polynomials(int t, int da, int *A, int dc, int *C, int i, field_theory::finite_field *F, long int &nb_sol, std::vector< std::vector< int > > &Solutions, int verbose_level)
void encode_text_5bits(std::string &text, std::string &fname, int verbose_level)
int code_minimum_distance(field_theory::finite_field *F, int n, int k, int *code, int verbose_level)
void CRC_encode_text(field_theory::nth_roots *Nth, ring_theory::unipoly_object &CRC_poly, std::string &text, std::string &fname, int verbose_level)
void print_binary(int n, int *v)
int Hamming_distance_binary(int a, int b, int n)
void do_make_macwilliams_system(int q, int n, int k, int verbose_level)
int test_all_two_bit_patterns_binary(int da, int *A, int dc, int *C, int verbose_level)
int distance(int n, int a, int b)
void matrix_from_projective_set(field_theory::finite_field *F, int n, int k, long int *columns_set_of_size_n, int *genma, int verbose_level)
void embellish(int *M, int nb_rows, int nb_cols, int i0, int j0, int a, int rad)
void search_for_CRC_polynomials_binary(int t, int da, int *A, int dc, int *C, int i, long int &nb_sol, std::vector< std::vector< int > > &Solutions, int verbose_level)
int singleton_bound_for_d(int n, int k, int q, int verbose_level)
void code_projective_weight_enumerator(field_theory::finite_field *F, int n, int k, int *code, int *weight_enumerator, int verbose_level)
void do_linear_code_through_columns_of_parity_check(int n, long int *columns_set, int k, int verbose_level)
void dimensions_N(int N, int &nb_rows, int &nb_cols)
int remainder_is_nonzero_binary(int da, int *A, int db, int *B)
void make_gilbert_varshamov_code_recursion(geometry::projective_space *P, int n, int d, long int *set, int *f_forbidden, int level, int verbose_level)
void compute_and_print_projective_weights(std::ostream &ost, field_theory::finite_field *F, int *M, int n, int k)
int test_all_three_bit_patterns_binary(int da, int *A, int dc, int *C, int verbose_level)
void code_weight_enumerator_fast(field_theory::finite_field *F, int n, int k, int *code, int *weight_enumerator, int verbose_level)
void make_Hamming_graph_and_write_file(int n, int q, int f_projective, int verbose_level)
void do_linear_code_through_basis(int n, long int *basis_set, int k, int f_embellish, int verbose_level)
int griesmer_bound_for_d(int n, int k, int q, int verbose_level)
void convert_to_binary(int n, long int h, int *v)
void do_it(int n, int r, int a, int c, int seed, int verbose_level)
int remainder_is_nonzero(int da, int *A, int db, int *B, field_theory::finite_field *F)
int test_all_two_bit_patterns(int da, int *A, int dc, int *C, field_theory::finite_field *F, int verbose_level)
void make_mac_williams_equations(ring_theory::longinteger_object *&M, int n, int k, int q, int verbose_level)
void investigate_code(long int *Words, int nb_words, int n, int f_embellish, int verbose_level)
void do_polynomial(int n, int polynomial_degree, int polynomial_nb_vars, std::string &polynomial_text, int f_embellish, int verbose_level)
void find_CRC_polynomials(field_theory::finite_field *F, int t, int da, int dc, int verbose_level)
void do_linear_code_through_columns_of_parity_check_projectively(int n, long int *columns_set, int k, int verbose_level)
void do_sylvester_hadamard(int n, int f_embellish, int verbose_level)
int test_all_three_bit_patterns(int da, int *A, int dc, int *C, field_theory::finite_field *F, int verbose_level)
void code_weight_enumerator(field_theory::finite_field *F, int n, int k, int *code, int *weight_enumerator, int verbose_level)
void make_gilbert_varshamov_code(int n, int k, int d, int q, geometry::projective_space *P, int verbose_level)
void generator_matrix_cyclic_code(field_theory::finite_field *F, int n, std::string &poly_coeffs, int verbose_level)
void code_diagram(std::string &label, long int *Words, int nb_words, int n, int f_metric_balls, int radius_of_metric_ball, int f_enhance, int radius, int verbose_level)
void code_projective_weights(field_theory::finite_field *F, int n, int k, int *code, int *&weights, int verbose_level)
void dimensions(int n, int &nb_rows, int &nb_cols)
void field_induction(std::string &fname_in, std::string &fname_out, int nb_bits, int verbose_level)
void determine_weight_enumerator()
void do_weight_enumerator(field_theory::finite_field *F, int *M, int m, int n, int f_normalize_from_the_left, int f_normalize_from_the_right, int verbose_level)
void place_entry(int *M, int nb_rows, int nb_cols, int i, int j, int a)
int griesmer_bound_for_n(int k, int d, int q, int verbose_level)
void make_table_of_bounds(int n_max, int q, int verbose_level)
int hamming_bound_for_d(int n, int k, int q, int verbose_level)
void mac_williams_equations(ring_theory::longinteger_object *&M, int n, int k, int q)
void evaluate(int *coeff, int *f)
void init(int n, int verbose_level)
void apply_Walsh_transform(int *in, int *out)
ring_theory::homogeneous_polynomial_domain * Poly
void compute_polynomial_representation(int *func, int *coeff, int verbose_level)
a collection of combinatorial functions
void binomial(ring_theory::longinteger_object &a, int n, int k, int verbose_level)
void unrank_k_subset(int rk, int *set, int n, int k)
long int int_n_choose_k(int n, int k)
void krawtchouk(ring_theory::longinteger_object &a, int n, int q, int k, int x)
long int binomial_lint(int n, int k)
a collection of functions related to sorted vectors
void lint_vec_heapsort(long int *v, int len)
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
void print_first(int f_backwards)
void PG_element_normalize_from_front(int *v, int stride, int len)
void PG_element_normalize(int *v, int stride, int len)
void PG_element_unrank_modified(int *v, int stride, int len, int a)
void finite_field_init(int q, int f_without_tables, int verbose_level)
linear_algebra::linear_algebra * Linear_algebra
void PG_element_rank_modified_lint(int *v, int stride, int len, long int &a)
the nth roots over Fq using an extension field
ring_theory::unipoly_domain * FX
a finite field as a vector space over a subfield
void init(finite_field *FQ, finite_field *Fq, int verbose_level)
void field_reduction(int *input, int sz, int *output, int verbose_level)
various functions related to geometries
void AG_element_unrank(int q, int *v, int stride, int len, long int a)
long int nb_PG_elements(int n, int q)
long int nb_AG_elements(int n, int q)
long int AG_element_rank(int q, int *v, int stride, int len)
projective space PG(n,q) of dimension n over Fq
field_theory::finite_field * F
long int rank_point(int *v)
void unrank_point(int *v, long int rk)
void mult_vector_from_the_left(int *v, int *A, int *vA, int m, int n)
int Gauss_int(int *A, int f_special, int f_complete, int *base_cols, int f_P, int *P, int m, int n, int Pn, int verbose_level)
void mult_matrix_matrix(int *A, int *B, int *C, int m, int n, int o, int verbose_level)
int RREF_and_kernel(int n, int k, int *A, int verbose_level)
void Kronecker_product_square_but_arbitrary(int *A, int *B, int na, int nb, int *AB, int &N, int verbose_level)
basic number theoretic functions
int i_power_j(int i, int j)
a collection of functions related to file io
void int_matrix_write_csv(std::string &fname, int *M, int m, int n)
void lint_matrix_write_csv(std::string &fname, long int *M, int m, int n)
void lint_matrix_write_csv_override_headers(std::string &fname, std::string *headers, long int *M, int m, int n)
long int file_size(std::string &fname)
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
interface to create latex output files
void head_easy(std::ostream &ost)
void int_matrix_print_tex(std::ostream &ost, int *p, int m, int n)
void print_integer_matrix_tex(std::ostream &ost, int *p, int m, int n)
void head(std::ostream &ost, int f_book, int f_title, const char *title, const char *author, int f_toc, int f_landscape, int f_12pt, int f_enlarged_page, int f_pagenumbers, const char *extras_for_preamble)
void print_longinteger_matrix_tex(std::ostream &ost, ring_theory::longinteger_object *p, int m, int n)
void foot(std::ostream &ost)
void get_lint_vector_from_label(std::string &label, long int *&v, int &sz, int verbose_level)
interface to system functions
void time_check_delta(std::ostream &ost, int dt)
homogeneous polynomials of a given degree in a given number of variables over a finite field GF(q)
void init(field_theory::finite_field *F, int nb_vars, int degree, int f_init_incidence_structure, monomial_ordering_type Monomial_ordering_type, int verbose_level)
void polynomial_function(int *coeff, int *f, int verbose_level)
void unrank_point(int *v, int rk)
void print_equation(std::ostream &ost, int *coeffs)
int index_of_monomial(int *v)
geometry::projective_space * get_P()
domain to compute with objects of type longinteger
int compare(longinteger_object &a, longinteger_object &b)
void add(longinteger_object &a, longinteger_object &b, longinteger_object &c)
void mult(longinteger_object &a, longinteger_object &b, longinteger_object &c)
void matrix_entries_integral_division_exact(longinteger_object *A, longinteger_object &b, int Am, int An)
void matrix_product(longinteger_object *A, longinteger_object *B, longinteger_object *&C, int Am, int An, int Bn)
void integral_division(longinteger_object &a, longinteger_object &b, longinteger_object &q, longinteger_object &r, int verbose_level)
void power_int(longinteger_object &a, int n)
void matrix_print_tex(std::ostream &ost, longinteger_object *A, int Am, int An)
a class to represent arbitrary precision integers
void assign_to(longinteger_object &b)
void create(long int i, const char *file, int line)
int & s_i(unipoly_object p, int i)
void create_object_of_degree(unipoly_object &p, int d)
void division_with_remainder(unipoly_object a, unipoly_object b, unipoly_object &q, unipoly_object &r, int verbose_level)
int degree(unipoly_object p)
void print_object(unipoly_object p, std::ostream &ost)
#define Get_int_vector_from_label(A, B, C, D)
#define Int_vec_scan(A, B, C)
#define Int_vec_zero(A, B)
#define Int_vec_print_fully(A, B, C)
#define Lint_vec_scan(A, B, C)
#define Lint_vec_print(A, B, C)
#define Int_matrix_print(A, B, C)
#define NEW_OBJECTS(type, n)
#define Int_vec_copy(A, B, C)
#define Int_vec_print(A, B, C)
#define Lint_vec_print_fully(A, B, C)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects