Orbiter 2022
Combinatorial Objects
interface_coding_theory.cpp
Go to the documentation of this file.
1/*
2 * interface_coding_theory.cpp
3 *
4 * Created on: Apr 4, 2020
5 * Author: betten
6 */
7
8
9
10
11#include "orbiter.h"
12
13using namespace std;
14
15
16namespace orbiter {
17namespace layer5_applications {
18namespace user_interface {
19
20
22{
23 f_make_macwilliams_system = FALSE;
24 make_macwilliams_system_q = 0;
25 make_macwilliams_system_n = 0;
26 make_macwilliams_system_k = 0;
27
28 f_table_of_bounds = FALSE;
29 table_of_bounds_n_max = 0;
30 table_of_bounds_q = 0;
31
32 f_make_bounds_for_d_given_n_and_k_and_q = FALSE;
33 make_bounds_n = 0;
34 make_bounds_k = 0;
35 make_bounds_q = 0;
36
37 f_BCH = FALSE;
38 f_BCH_dual = FALSE;
39 BCH_n = 0;
40 BCH_q = 0;
41 BCH_t = 0;
42 //BCH_b = 0;
43
44 f_Hamming_space_distance_matrix = FALSE;
45 Hamming_space_n = 0;
46 Hamming_space_q = 0;
47
48 f_general_code_binary = FALSE;
49 general_code_binary_n = 0;
50 //std::string general_code_binary_text;
51
52 f_code_diagram = FALSE;
53 //std::string code_diagram_label;
54 //std::string code_diagram_codewords_text;
55 code_diagram_n = 0;
56
57 f_code_diagram_from_file = FALSE;
58 //std::string code_diagram_from_file_codewords_fname;
59
60 f_enhance = FALSE;
61 enhance_radius = 0;
62
63 f_metric_balls = FALSE;
64 metric_ball_radius = 0;
65
66 f_linear_code_through_basis = FALSE;
67 linear_code_through_basis_n = 0;
68 //std::string linear_code_through_basis_text;
69
70 f_linear_code_through_columns_of_parity_check_projectively = FALSE;
71 f_linear_code_through_columns_of_parity_check = FALSE;
72 linear_code_through_columns_of_parity_check_k = 0;
73 //std::string linear_code_through_columns_of_parity_check_text;
74
75 f_long_code = FALSE;
76 long_code_n = 0;
77 //long_code_generators;
78
79 f_encode_text_5bits = FALSE;
80 //encode_text_5bits_input;
81 //encode_text_5bits_fname;
82
83 f_field_induction = FALSE;
84 //std::string field_induction_fname_in;
85 //std::string field_induction_fname_out;
86 field_induction_nb_bits = 0;
87
88}
89
90
92 std::string *argv, int i, int verbose_level)
93{
95
96 if (ST.stringcmp(argv[i], "-make_macwilliams_system") == 0) {
97 cout << "-make_macwilliams_system <int : q> <int : n> <int k>" << endl;
98 }
99 else if (ST.stringcmp(argv[i], "-table_of_bounds") == 0) {
100 cout << "-table_of_bounds <int : n_max> <int : q> " << endl;
101 }
102 else if (ST.stringcmp(argv[i], "-make_bounds_for_d_given_n_and_k_and_q") == 0) {
103 cout << "-make_bounds_for_d_given_n_and_k_and_q <int : n> <int k> <int : q> " << endl;
104 }
105 else if (ST.stringcmp(argv[i], "-BCH") == 0) {
106 cout << "-BCH <int : n> <int : q> <int t>" << endl;
107 }
108 else if (ST.stringcmp(argv[i], "-BCH_dual") == 0) {
109 cout << "-BCH_dual <int : n> <int : q> <int t>" << endl;
110 }
111 else if (ST.stringcmp(argv[i], "-Hamming_space_distance_matrix") == 0) {
112 cout << "-Hamming_space_distance_matrix <int : n> <int : q>" << endl;
113 }
114 else if (ST.stringcmp(argv[i], "-general_code_binary") == 0) {
115 cout << "-general_code_binary <int : n> <string : set> " << endl;
116 }
117 else if (ST.stringcmp(argv[i], "-code_diagram") == 0) {
118 cout << "-code_diagram <string : label> <string : codewords> <int : n> " << endl;
119 }
120 else if (ST.stringcmp(argv[i], "-code_diagram_from_file") == 0) {
121 cout << "-code_diagram_from_file <string : label> <string : fname_codewords> <int : n> " << endl;
122 }
123 else if (ST.stringcmp(argv[i], "-enhance") == 0) {
124 cout << "-enhance <int : radius>" << endl;
125 }
126 else if (ST.stringcmp(argv[i], "-metric_balls") == 0) {
127 cout << "-metric_balls <int : radius_of_metric_ball> " << endl;
128 }
129 else if (ST.stringcmp(argv[i], "-linear_code_through_basis") == 0) {
130 cout << "-linear_code_through_basis <int : n> <string : set> " << endl;
131 }
132 else if (ST.stringcmp(argv[i], "-linear_code_through_columns_of_parity_check_projectively") == 0) {
133 cout << "-linear_code_through_columns_of_parity_check <int : k> <string : set> " << endl;
134 }
135 else if (ST.stringcmp(argv[i], "-linear_code_through_columns_of_parity_check") == 0) {
136 cout << "-linear_code_through_columns_of_parity_check <int : k> <string : set> " << endl;
137 }
138 else if (ST.stringcmp(argv[i], "-long_code") == 0) {
139 cout << "-long_code <int : n> <int : nb_generators=k> <string : generator_1> .. <string : generator_k>" << endl;
140 }
141 else if (ST.stringcmp(argv[i], "-encode_text_5bits") == 0) {
142 cout << "-encode_text_5bits <string : text> <string : fname>" << endl;
143 }
144 else if (ST.stringcmp(argv[i], "-field_induction") == 0) {
145 cout << "-field_induction <string : fname_in> <string : fname_out> <int : nb_bits>" << endl;
146 }
147}
148
150 std::string *argv, int i, int verbose_level)
151{
152 int f_v = (verbose_level >= 1);
154
155 if (i >= argc) {
156 return false;
157 }
158 if (f_v) {
159 cout << "interface_coding_theory::recognize_keyword argv[i]="
160 << argv[i] << " i=" << i << " argc=" << argc << endl;
161 }
162 if (ST.stringcmp(argv[i], "-make_macwilliams_system") == 0) {
163 return true;
164 }
165 else if (ST.stringcmp(argv[i], "-table_of_bounds") == 0) {
166 return true;
167 }
168 else if (ST.stringcmp(argv[i], "-make_bounds_for_d_given_n_and_k_and_q") == 0) {
169 return true;
170 }
171 else if (ST.stringcmp(argv[i], "-BCH") == 0) {
172 return true;
173 }
174 else if (ST.stringcmp(argv[i], "-BCH_dual") == 0) {
175 return true;
176 }
177 else if (ST.stringcmp(argv[i], "-Hamming_space_distance_matrix") == 0) {
178 return true;
179 }
180 else if (ST.stringcmp(argv[i], "-general_code_binary") == 0) {
181 return true;
182 }
183 else if (ST.stringcmp(argv[i], "-code_diagram") == 0) {
184 return true;
185 }
186 else if (ST.stringcmp(argv[i], "-code_diagram_from_file") == 0) {
187 return true;
188 }
189 else if (ST.stringcmp(argv[i], "-enhance") == 0) {
190 return true;
191 }
192 else if (ST.stringcmp(argv[i], "-metric_balls") == 0) {
193 return true;
194 }
195 else if (ST.stringcmp(argv[i], "-linear_code_through_basis") == 0) {
196 return true;
197 }
198 else if (ST.stringcmp(argv[i], "-linear_code_through_columns_of_parity_check_projectively") == 0) {
199 return true;
200 }
201 else if (ST.stringcmp(argv[i], "-linear_code_through_columns_of_parity_check") == 0) {
202 return true;
203 }
204 else if (ST.stringcmp(argv[i], "-long_code") == 0) {
205 return true;
206 }
207 else if (ST.stringcmp(argv[i], "-encode_text_5bits") == 0) {
208 return true;
209 }
210 else if (ST.stringcmp(argv[i], "-field_induction") == 0) {
211 return true;
212 }
213 if (f_v) {
214 cout << "interface_coding_theory::recognize_keyword not recognizing" << endl;
215 }
216 return false;
217}
218
220 std::string *argv, int &i, int verbose_level)
221{
222 int f_v = (verbose_level >= 1);
224
225 if (f_v) {
226 cout << "interface_coding_theory::read_arguments" << endl;
227 }
228
229
230
231 if (f_v) {
232 cout << "interface_coding_theory::read_arguments "
233 "the next argument is " << argv[i] << endl;
234 }
235
236
237 if (ST.stringcmp(argv[i], "-make_macwilliams_system") == 0) {
238 f_make_macwilliams_system = TRUE;
239 make_macwilliams_system_n = ST.strtoi(argv[++i]);
240 make_macwilliams_system_k = ST.strtoi(argv[++i]);
241 make_macwilliams_system_q = ST.strtoi(argv[++i]);
242 if (f_v) {
243 cout << "-make_macwilliams_system " << make_macwilliams_system_n << " " << make_macwilliams_system_k << " " << make_macwilliams_system_q << endl;
244 }
245 }
246 else if (ST.stringcmp(argv[i], "-table_of_bounds") == 0) {
247 f_table_of_bounds = TRUE;
248 table_of_bounds_n_max = ST.strtoi(argv[++i]);
249 table_of_bounds_q = ST.strtoi(argv[++i]);
250 if (f_v) {
251 cout << "-table_of_bounds " << table_of_bounds_n_max
252 << " " << table_of_bounds_q << endl;
253 }
254 }
255 else if (ST.stringcmp(argv[i], "-make_bounds_for_d_given_n_and_k_and_q") == 0) {
256 f_make_bounds_for_d_given_n_and_k_and_q = TRUE;
257 make_bounds_n = ST.strtoi(argv[++i]);
258 make_bounds_k = ST.strtoi(argv[++i]);
259 make_bounds_q = ST.strtoi(argv[++i]);
260 if (f_v) {
261 cout << "-make_bounds_for_d_given_n_and_k_and_q "
262 << make_bounds_n << " " << make_bounds_k << " " << make_bounds_q << endl;
263 }
264 }
265 else if (ST.stringcmp(argv[i], "-BCH") == 0) {
266 f_BCH = TRUE;
267 BCH_n = ST.strtoi(argv[++i]);
268 BCH_q = ST.strtoi(argv[++i]);
269 BCH_t = ST.strtoi(argv[++i]);
270 //BCH_b = atoi(argv[++i]);
271 if (f_v) {
272 cout << "-BCH " << BCH_n << " " << BCH_q << " " << BCH_t << endl;
273 }
274 }
275 else if (ST.stringcmp(argv[i], "-BCH_dual") == 0) {
276 f_BCH_dual = TRUE;
277 BCH_n = ST.strtoi(argv[++i]);
278 BCH_q = ST.strtoi(argv[++i]);
279 BCH_t = ST.strtoi(argv[++i]);
280 //BCH_b = atoi(argv[++i]);
281 if (f_v) {
282 cout << "-BCH " << BCH_n << " " << BCH_q << " " << BCH_t << endl;
283 }
284 }
285 else if (ST.stringcmp(argv[i], "-Hamming_space_distance_matrix") == 0) {
286 f_Hamming_space_distance_matrix = TRUE;
287 Hamming_space_n = ST.strtoi(argv[++i]);
288 Hamming_space_q = ST.strtoi(argv[++i]);
289 if (f_v) {
290 cout << "-Hamming_space_distance_matrix " << Hamming_space_n << " " << Hamming_space_q << endl;
291 }
292 }
293 else if (ST.stringcmp(argv[i], "-general_code_binary") == 0) {
294 f_general_code_binary = TRUE;
295 general_code_binary_n = ST.strtoi(argv[++i]);
296 general_code_binary_text.assign(argv[++i]);
297 if (f_v) {
298 cout << "-general_code_binary " << general_code_binary_n << " "
299 << general_code_binary_text << endl;
300 }
301 }
302 else if (ST.stringcmp(argv[i], "-code_diagram") == 0) {
303 f_code_diagram = TRUE;
304 code_diagram_label.assign(argv[++i]);
305 code_diagram_codewords_text.assign(argv[++i]);
306 code_diagram_n = ST.strtoi(argv[++i]);
307 if (f_v) {
308 cout << "-code_diagram " << code_diagram_label
309 << " " << code_diagram_codewords_text
310 << " " << code_diagram_n << endl;
311 }
312 }
313 else if (ST.stringcmp(argv[i], "-code_diagram_from_file") == 0) {
314 f_code_diagram_from_file = TRUE;
315 code_diagram_label.assign(argv[++i]);
316 code_diagram_from_file_codewords_fname.assign(argv[++i]);
317 code_diagram_n = ST.strtoi(argv[++i]);
318 if (f_v) {
319 cout << "-code_diagram_from_file " << code_diagram_label
320 << " " << code_diagram_from_file_codewords_fname
321 << " " << code_diagram_n << endl;
322 }
323 }
324
325 else if (ST.stringcmp(argv[i], "-enhance") == 0) {
326 f_enhance = TRUE;
327 enhance_radius = ST.strtoi(argv[++i]);
328 if (f_v) {
329 cout << "-enhance " << enhance_radius << endl;
330 }
331 }
332
333 else if (ST.stringcmp(argv[i], "-metric_balls") == 0) {
334 f_metric_balls = TRUE;
335 metric_ball_radius = ST.strtoi(argv[++i]);
336 if (f_v) {
337 cout << "-metric_balls " << metric_ball_radius << endl;
338 }
339 }
340
341
342
343 else if (ST.stringcmp(argv[i], "-linear_code_through_basis") == 0) {
344 f_linear_code_through_basis = TRUE;
345 linear_code_through_basis_n = ST.strtoi(argv[++i]);
346 linear_code_through_basis_text.assign(argv[++i]);
347 if (f_v) {
348 cout << "-linear_code_through_basis " << linear_code_through_basis_n
349 << " " << linear_code_through_basis_text << endl;
350 }
351 }
352
353 else if (ST.stringcmp(argv[i], "-linear_code_through_columns_of_parity_check_projectively") == 0) {
354 f_linear_code_through_columns_of_parity_check_projectively = TRUE;
355 linear_code_through_columns_of_parity_check_k = ST.strtoi(argv[++i]);
356 linear_code_through_columns_of_parity_check_text.assign(argv[++i]);
357 if (f_v) {
358 cout << "-linear_code_through_columns_of_parity_check_projectively "
359 << linear_code_through_columns_of_parity_check_k
360 << " " << linear_code_through_columns_of_parity_check_text << endl;
361 }
362 }
363
364 else if (ST.stringcmp(argv[i], "-linear_code_through_columns_of_parity_check") == 0) {
365 f_linear_code_through_columns_of_parity_check = TRUE;
366 linear_code_through_columns_of_parity_check_k = ST.strtoi(argv[++i]);
367 linear_code_through_columns_of_parity_check_text.assign(argv[++i]);
368 if (f_v) {
369 cout << "-linear_code_through_columns_of_parity_check "
370 << linear_code_through_columns_of_parity_check_k
371 << " " << linear_code_through_columns_of_parity_check_text << endl;
372 }
373 }
374
375 else if (ST.stringcmp(argv[i], "-long_code") == 0) {
376 f_long_code = TRUE;
377 long_code_n = ST.strtoi(argv[++i]);
378
379 int n, h;
380 n = ST.strtoi(argv[++i]);
381 for (h = 0; h < n; h++) {
382 string s;
383
384 s.assign(argv[++i]);
385#if 0
386 if (stringcmp(s, "-set_builder") == 0) {
387 set_builder_description Descr;
388
389 if (f_v) {
390 cout << "reading -set_builder" << endl;
391 }
392 i += Descr.read_arguments(argc - (i + 1),
393 argv + i + 1, verbose_level);
394
395 if (f_v) {
396 cout << "-set_builder" << endl;
397 cout << "i = " << i << endl;
398 cout << "argc = " << argc << endl;
399 if (i < argc) {
400 cout << "next argument is " << argv[i] << endl;
401 }
402 }
403
404 set_builder S;
405
406 S.init(&Descr, verbose_level);
407
408 if (f_v) {
409 cout << "set_builder found the following set of size " << S.sz << endl;
410 Orbiter->Lint_vec.print(cout, S.set, S.sz);
411 cout << endl;
412 }
413
414 s.assign("");
415 int j;
416 char str[1000];
417
418 for (j = 0; j < S.sz; j++) {
419 if (j) {
420 s.append(",");
421 }
422 sprintf(str, "%ld", S.set[j]);
423 s.append(str);
424 }
425 if (f_v) {
426 cout << "as string: " << s << endl;
427 }
428
429 }
430#endif
431 long_code_generators.push_back(s);
432 }
433 if (f_v) {
434 cout << "-long_code " << long_code_n << endl;
435 for (int h = 0; h < n; h++) {
436 cout << " " << long_code_generators[h] << endl;
437 }
438 }
439 }
440 else if (ST.stringcmp(argv[i], "-encode_text_5bits") == 0) {
441 f_encode_text_5bits = TRUE;
442 encode_text_5bits_input.assign(argv[++i]);
443 encode_text_5bits_fname.assign(argv[++i]);
444 if (f_v) {
445 cout << "-encode_text_5bits " << encode_text_5bits_input << " "
446 << encode_text_5bits_fname << endl;
447 }
448 }
449 else if (ST.stringcmp(argv[i], "-field_induction") == 0) {
450 f_field_induction = TRUE;
451 field_induction_fname_in.assign(argv[++i]);
452 field_induction_fname_out.assign(argv[++i]);
453 field_induction_nb_bits = ST.strtoi(argv[++i]);
454 if (f_v) {
455 cout << "-field_induction " << field_induction_fname_in
456 << " " << field_induction_fname_out
457 << " " << field_induction_nb_bits
458 << endl;
459 }
460 }
461 if (f_v) {
462 cout << "interface_coding_theory::read_arguments done" << endl;
463 }
464}
465
466
468{
469 if (f_make_macwilliams_system) {
470 cout << "-make_macwilliams_system " << make_macwilliams_system_n << " " << make_macwilliams_system_k << " " << make_macwilliams_system_q << endl;
471 }
472 if (f_table_of_bounds) {
473 cout << "-table_of_bounds " << table_of_bounds_n_max << " " << table_of_bounds_q << endl;
474 }
475 if (f_make_bounds_for_d_given_n_and_k_and_q) {
476 cout << "-make_bounds_for_d_given_n_and_k_and_q " << make_bounds_n << " " << make_bounds_k << " " << make_bounds_q << endl;
477 }
478 if (f_BCH) {
479 cout << "-BCH " << BCH_n << " " << BCH_q << " " << BCH_t << endl;
480 }
481 if (f_BCH_dual) {
482 cout << "-BCH " << BCH_n << " " << BCH_q << " " << BCH_t << endl;
483 }
484 if (f_Hamming_space_distance_matrix) {
485 cout << "-Hamming_space_distance_matrix " << Hamming_space_n << " " << Hamming_space_q << endl;
486 }
487 if (f_general_code_binary) {
488 cout << "-general_code_binary " << general_code_binary_n << " "
489 << general_code_binary_text << endl;
490 }
491 if (f_code_diagram) {
492 cout << "-code_diagram " << code_diagram_label
493 << " " << code_diagram_codewords_text
494 << " " << code_diagram_n << endl;
495 }
496 if (f_code_diagram_from_file) {
497 cout << "-code_diagram_from_file " << code_diagram_label
498 << " " << code_diagram_from_file_codewords_fname
499 << " " << code_diagram_n << endl;
500 }
501
502 if (f_enhance) {
503 cout << "-enhance " << enhance_radius << endl;
504 }
505
506 if (f_metric_balls) {
507 cout << "-metric_balls " << metric_ball_radius << endl;
508 }
509
510
511
512 if (f_linear_code_through_basis) {
513 cout << "-linear_code_through_basis " << linear_code_through_basis_n
514 << " " << linear_code_through_basis_text << endl;
515 }
516
517 if (f_linear_code_through_columns_of_parity_check_projectively) {
518 cout << "-linear_code_through_columns_of_parity_check_projectively "
519 << linear_code_through_columns_of_parity_check_k
520 << " " << linear_code_through_columns_of_parity_check_text
521 << endl;
522 }
523
524 if (f_linear_code_through_columns_of_parity_check) {
525 cout << "-linear_code_through_columns_of_parity_check "
526 << linear_code_through_columns_of_parity_check_k
527 << " " << linear_code_through_columns_of_parity_check_text
528 << endl;
529 }
530
531 if (f_long_code) {
532 cout << "-long_code " << long_code_n << endl;
533 for (int h = 0; h < long_code_n; h++) {
534 cout << " " << long_code_generators[h] << endl;
535 }
536 }
537 if (f_encode_text_5bits) {
538 cout << "-encode_text_5bits " << encode_text_5bits_input << " "
539 << encode_text_5bits_fname << endl;
540 }
541 if (f_field_induction) {
542 cout << "-field_induction " << field_induction_fname_in
543 << " " << field_induction_fname_out
544 << " " << field_induction_nb_bits
545 << endl;
546 }
547}
548
549
550void interface_coding_theory::worker(int verbose_level)
551{
552 int f_v = (verbose_level >= 1);
553
554 if (f_v) {
555 cout << "interface_coding_theory::worker" << endl;
556 }
557
558 if (f_make_macwilliams_system) {
559
561
562 Coding.do_make_macwilliams_system(make_macwilliams_system_q, make_macwilliams_system_n, make_macwilliams_system_k, verbose_level);
563 }
564 else if (f_table_of_bounds) {
565
567
568 Coding.make_table_of_bounds(table_of_bounds_n_max, table_of_bounds_q, verbose_level);
569 }
570 else if (f_make_bounds_for_d_given_n_and_k_and_q) {
571
573 int d_GV;
574 int d_singleton;
575 int d_hamming;
576 int d_plotkin;
577 int d_griesmer;
578
579 d_GV = Coding.gilbert_varshamov_lower_bound_for_d(make_bounds_n, make_bounds_k, make_bounds_q, verbose_level);
580 d_singleton = Coding.singleton_bound_for_d(make_bounds_n, make_bounds_k, make_bounds_q, verbose_level);
581 d_hamming = Coding.hamming_bound_for_d(make_bounds_n, make_bounds_k, make_bounds_q, verbose_level);
582 d_plotkin = Coding.plotkin_bound_for_d(make_bounds_n, make_bounds_k, make_bounds_q, verbose_level);
583 d_griesmer = Coding.griesmer_bound_for_d(make_bounds_n, make_bounds_k, make_bounds_q, verbose_level);
584
585 cout << "n = " << make_bounds_n << " k=" << make_bounds_k << " q=" << make_bounds_q << endl;
586
587 cout << "d_GV = " << d_GV << endl;
588 cout << "d_singleton = " << d_singleton << endl;
589 cout << "d_hamming = " << d_hamming << endl;
590 cout << "d_plotkin = " << d_plotkin << endl;
591 cout << "d_griesmer = " << d_griesmer << endl;
592
593 }
594 else if (f_BCH) {
595
597
598 Coding.make_BCH_codes(BCH_n, BCH_q, BCH_t, 1, FALSE, verbose_level);
599 }
600 else if (f_BCH_dual) {
601
603
604 Coding.make_BCH_codes(BCH_n, BCH_q, BCH_t, 1, TRUE, verbose_level);
605 }
606 else if (f_Hamming_space_distance_matrix) {
607
609
610 Coding.make_Hamming_graph_and_write_file(Hamming_space_n, Hamming_space_q,
611 FALSE /* f_projective*/, verbose_level);
612 }
613 else if (f_general_code_binary) {
614 long int *set;
615 int sz;
616 int f_embellish = FALSE;
617
619
620
621 Lint_vec_scan(general_code_binary_text, set, sz);
622
623 Codes.investigate_code(set, sz, general_code_binary_n, f_embellish, verbose_level);
624
625 FREE_lint(set);
626
627 }
628
629 else if (f_code_diagram) {
630 long int *codewords;
631 int nb_words;
632
634
635
636 Lint_vec_scan(code_diagram_codewords_text, codewords, nb_words);
637
638
639
640 Codes.code_diagram(
641 code_diagram_label,
642 codewords,
643 nb_words, code_diagram_n, f_metric_balls, metric_ball_radius,
644 f_enhance, 0 /*nb_enhance */,
645 verbose_level);
646 }
647
648 else if (f_code_diagram_from_file) {
649 long int *codewords;
650 int m, nb_words;
652
654
655
656 Fio.lint_matrix_read_csv(code_diagram_from_file_codewords_fname, codewords, m, nb_words, verbose_level);
657
658
659
660 Codes.code_diagram(
661 code_diagram_label,
662 codewords,
663 nb_words, code_diagram_n, f_metric_balls, metric_ball_radius,
664 f_enhance, enhance_radius,
665 verbose_level);
666 }
667
668 else if (f_code_diagram_from_file) {
669 long int *codewords;
670 int nb_words;
671
673
674
675 Lint_vec_scan(code_diagram_codewords_text, codewords, nb_words);
676
677
678
679 Codes.code_diagram(
680 code_diagram_label,
681 codewords,
682 nb_words, code_diagram_n, f_metric_balls, metric_ball_radius,
683 f_enhance, enhance_radius,
684 verbose_level);
685 }
686
687 else if (f_linear_code_through_basis) {
688 long int *set;
689 int sz;
690 int f_embellish = FALSE;
691
693
694
695 //Orbiter->Lint_vec.scan(linear_code_through_basis_text, set, sz);
696 orbiter_kernel_system::Orbiter->get_lint_vector_from_label(linear_code_through_basis_text, set, sz, verbose_level);
697
699 linear_code_through_basis_n,
700 set, sz /*k*/,
701 f_embellish,
702 verbose_level);
703
704 FREE_lint(set);
705
706 }
707
708 else if (f_linear_code_through_columns_of_parity_check_projectively) {
709 long int *set;
710 int n;
711
713
714
715 //Orbiter->Lint_vec.scan(linear_code_through_columns_of_parity_check_text, set, n);
716 orbiter_kernel_system::Orbiter->get_lint_vector_from_label(linear_code_through_columns_of_parity_check_text, set, n, verbose_level);
717
719 n,
720 set, linear_code_through_columns_of_parity_check_k /*k*/,
721 verbose_level);
722
723 FREE_lint(set);
724
725 }
726
727
728 else if (f_linear_code_through_columns_of_parity_check) {
729 long int *set;
730 int n;
731
733
734
735 //Orbiter->Lint_vec.scan(linear_code_through_columns_of_parity_check_text, set, n);
736 orbiter_kernel_system::Orbiter->get_lint_vector_from_label(linear_code_through_columns_of_parity_check_text, set, n, verbose_level);
737
739 n,
740 set, linear_code_through_columns_of_parity_check_k /*k*/,
741 verbose_level);
742
743 FREE_lint(set);
744
745 }
746
747 else if (f_long_code) {
749 string dummy;
750
751 Codes.do_long_code(
752 long_code_n,
753 long_code_generators,
754 FALSE /* f_nearest_codeword */,
755 dummy /* const char *nearest_codeword_text */,
756 verbose_level);
757
758 }
759 else if (f_encode_text_5bits) {
761
762 Codes.encode_text_5bits(encode_text_5bits_input,
763 encode_text_5bits_fname,
764 verbose_level);
765
766 }
767 else if (f_field_induction) {
769
770 Codes.field_induction(field_induction_fname_in,
771 field_induction_fname_out,
772 field_induction_nb_bits,
773 verbose_level);
774
775 }
776 if (f_v) {
777 cout << "interface_coding_theory::worker done" << endl;
778 }
779}
780
781
782
783}}}
784
785
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)
int gilbert_varshamov_lower_bound_for_d(int n, int k, int q, int verbose_level)
void encode_text_5bits(std::string &text, std::string &fname, int verbose_level)
void do_make_macwilliams_system(int q, int n, int k, int verbose_level)
void make_BCH_codes(int n, int q, int t, int b, int f_dual, int verbose_level)
int singleton_bound_for_d(int n, int k, int q, int verbose_level)
void do_linear_code_through_columns_of_parity_check(int n, long int *columns_set, int k, 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 investigate_code(long int *Words, int nb_words, int n, int f_embellish, 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 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 field_induction(std::string &fname_in, std::string &fname_out, int nb_bits, int verbose_level)
void print(std::ostream &ost, long int *v, int len)
Definition: lint_vec.cpp:246
functions related to strings and character arrays
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1558
void get_lint_vector_from_label(std::string &label, long int *&v, int &sz, int verbose_level)
void print_help(int argc, std::string *argv, int i, int verbose_level)
int recognize_keyword(int argc, std::string *argv, int i, int verbose_level)
void read_arguments(int argc, std::string *argv, int &i, int verbose_level)
#define Lint_vec_scan(A, B, C)
Definition: foundations.h:717
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define FREE_lint(p)
Definition: foundations.h:642
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects