Orbiter 2022
Combinatorial Objects
tensor_codes.cpp
Go to the documentation of this file.
1/*
2 * tensor_codes.cpp
3 *
4 * Created on: Jun 24, 2021
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13using namespace std;
14
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace coding_theory {
20
21
23 int *&H_subfield, int &m, int &n,
25 int f_construction_A, int f_hyperoval,
26 int f_construction_B, int verbose_level)
27{
28 int f_v = (verbose_level >= 1);
29 int f_vv = (verbose_level >= 2);
30 int index;
31 int exponents[9];
32 int *M;
33 //int *H_subfield;
34 int *C;
35 int *C_inv;
36
37 int q = f->q;
38 int q2;
39 int Q;
40 //int m, n;
41 int r;
42 int beta, beta_q;
43 int f_elements_exponential = TRUE;
44 string symbol_for_print;
45 string symbol_for_print_subfield;
46
47
48 symbol_for_print.assign("\\alpha");
49 symbol_for_print_subfield.assign("\\omega");
50
51
52 if (f_v) {
53 cout << "twisted_tensor_product_codes" << endl;
54 cout << "f_construction_A=" << f_construction_A << endl;
55 cout << "f_hyperoval=" << f_hyperoval << endl;
56 cout << "f_construction_B=" << f_construction_B << endl;
57 }
58
59
60 q2 = q * q;
61 Q = 0;
62 if (f_construction_A) {
63 Q = q2;
64 }
65 else if (f_construction_B) {
66 Q = q2 * q;
67 }
68 index = (Q - 1) / (q - 1);
69
70 if (Q != F->q) {
71 cout << "twisted_tensor_product_codes Q != F->q" << endl;
72 exit(1);
73 }
74
75
76 if (f_vv) {
77 cout << "q = " << q << endl;
78 cout << "Q = " << Q << endl;
79 cout << "index = " << index << endl;
80 }
81
82#if 0
83 F.init_override_polynomial(Q, override_poly_Q, verbose_level - 2);
84
85 if (f_vv) {
86 cout << "field of order " << Q << " initialized" << endl;
87 }
88
89 f.init_override_polynomial(q, override_poly_q, verbose_level - 2);
90
91 if (f_vv) {
92 cout << "field of order " << q << " initialized" << endl;
93 cout << "index = " << index << endl;
94 }
95#endif
96
97 F->compute_subfields(verbose_level - 2);
98
99
101 M,
102 F, f,
103 m, n, beta, r, exponents,
104 f_construction_A, f_hyperoval, f_construction_B,
105 f_elements_exponential, symbol_for_print,
106 verbose_level - 2);
107
108 beta_q = F->power(beta, q);
109
110 if (f_vv) {
111 cout << "twisted_tensor_product_codes after create_matrix_M" << endl;
112 cout << "m = " << m << endl;
113 cout << "n = " << n << endl;
114 cout << "Q = " << Q << endl;
115 cout << "q2 = " << q2 << endl;
116 cout << "beta = " << beta << endl;
117 cout << "beta_q = " << beta_q << endl;
118 cout << "Exponents: ";
119 Int_vec_print(cout, exponents, m);
120 cout << endl;
121 }
122
123 if (f_vv) {
124 cout << "twisted_tensor_product_codes: M:" << endl;
125 Int_vec_print_integer_matrix_width(cout, M, m, n, n, 2);
126
127 F->latex_matrix(cout, f_elements_exponential, symbol_for_print, M, m, n);
128 }
129
130
131
132
133#if 0
134 for (j = 0; j < n; j++) {
135 PG_element_normalize(F, M + j, n, m);
136 }
137 cout << "column normalized M:" << endl;
138 print_integer_matrix_width(cout, M, m, n, n, 2);
139#endif
140
141
142
143
144 C = NEW_int(m * m);
145 C_inv = NEW_int(m * m);
146 H_subfield = NEW_int(m * n);
147
148
150 H_subfield, C, C_inv, M, m, n, beta, beta_q,
151 f_elements_exponential, symbol_for_print, symbol_for_print_subfield,
152 f_construction_A, f_hyperoval, f_construction_B,
153 verbose_level - 2);
154
155
156 if (f_v) {
157 cout << "twisted_tensor_product_codes: after create_matrix_H_subfield" << endl;
158 cout << "H_subfield:" << endl;
159 Int_vec_print_integer_matrix_width(cout, H_subfield, m, n, n, 2);
160 f->latex_matrix(cout, f_elements_exponential, symbol_for_print_subfield, H_subfield, m, n);
161 }
162
163 FREE_int(M);
164 FREE_int(C);
165 FREE_int(C_inv);
166
167}
168
169
171 int *&M,
173 int &m, int &n, int &beta, int &r, int *exponents,
174 int f_construction_A, int f_hyperoval, int f_construction_B,
175 int f_elements_exponential, std::string &symbol_for_print,
176 int verbose_level)
177// int exponents[9]
178{
179 int f_v = (verbose_level >= 1);
180 //int f_vv = (verbose_level >= 2);
181 int i, j, t, q, Q, q2;
182
183 q = f->q;
184 q2 = q * q;
185
186
187 if (f_construction_A) {
188
189#if 0
190 //q = 2; override_poly_Q = ""; override_poly = "";
191 //q = 3; override_poly_Q = ""; override_poly = "";
192 q = 4; override_poly_Q = "19"; override_poly = "7";
193 // F_256 generated by X^8 + X^4 + X^3 + X^2 + 1
194 // F_16 generated by X^4+X+1 = 19
195 // F_4 generated by X^2+X+1 = 7
196 //q = 5; override_poly_Q = "47"; override_poly = "";
197 // F_625 generated by X^4 + X^3 + 3X + 2
198 // F_25 generated by X^2 + 4X + 2 = 47
199 //q = 7; override_poly_Q = ""; override_poly = "";
200 //q = 8; override_poly_Q = "97"; override_poly = "11";
201 // F_4096 generated by x^12+x^6+x^4+x+1
202 // F_64 generated by X^6+X^5+1 = 97
203 // F_8 generated by X^3+X+1 = 11
204 //q = 9; override_poly_Q = ""; override_poly = "17";
205#endif
206 Q = q2;
207 beta = q;
208 m = 9;
209 if (f_hyperoval) {
210 n = Q + 2;
211 }
212 else {
213 n = Q + 1;
214 }
215 r = 5;
216 if (q == 4)
217 r = 7;
218 if (q == 3)
219 r = 9;
220 // 3 orbits of length 1: 0, q+1, 2q+2
221 exponents[0] = 0;
222 exponents[1] = q + 1;
223 exponents[2] = 2 * q + 2;
224 //orbit (q,1)
225 exponents[3] = q;
226 exponents[4] = 1;
227 // orbit (2q, 2)
228 exponents[5] = 2 * q;
229 exponents[6] = 2;
230 // orbit (2q+1, q+2)
231 exponents[7] = 2 * q + 1;
232 exponents[8] = q + 2;
233 //exponents[0] = 0;
234 //exponents[1] = q;
235 //exponents[2] = 2 * q;
236 //exponents[3] = 1;
237 //exponents[4] = q + 1;
238 //exponents[5] = 2 * q + 1;
239 //exponents[6] = 2;
240 //exponents[7] = q + 2;
241 //exponents[8] = 2 * q + 2;
242 }
243 else if (f_construction_B) {
244
245#if 0
246 //q = 2; override_poly_Q = ""; override_poly = ""; r = 9;
247 //q = 3; override_poly_Q = ""; override_poly = ""; r = 5;
248 q = 4; override_poly_Q = ""; override_poly = "7"; r = 4;
249 // F_4096 generated by X^8 + X^4 + X^3 + X^2 + 1 = 4096
250 //q = 5; override_poly_Q = ""; override_poly = ""; r = 4;
251 //q = 7; override_poly_Q = ""; override_poly = ""; r = 4;
252#endif
253
254 beta = q;
255 Q = q2 * q;
256 m = 8;
257 n = Q + 1;
258
259 exponents[0] = 0;
260 exponents[1] = q2 + q + 1;
261 exponents[2] = 1;
262 exponents[3] = q;
263 exponents[4] = q2;
264 exponents[5] = q + 1;
265 exponents[6] = q2 + q;
266 exponents[7] = q2 + 1;
267 //exponents[0] = 0;
268 //exponents[1] = q;
269 //exponents[2] = 1;
270 //exponents[3] = q + 1;
271 //exponents[4] = q2;
272 //exponents[5] = q2 + q;
273 //exponents[6] = q2 + 1;
274 //exponents[7] = q2 + q + 1;
275 }
276 else {
277 cout << "coding_theory_domain::create_matrix_M please specify the construction using option -A or -B" << endl;
278 exit(1);
279 }
280
281
282 // create matrix M:
283 M = NEW_int(m * n);
284 for (i = 0; i < m; i++) {
285 for (j = 0; j < n; j++) {
286 M[i * n + j] = 0;
287 }
288 }
289 for (t = 0; t < Q; t++) {
290 for (i = 0; i < m; i++) {
291 M[i * n + t] = F->power(t, exponents[i]);
292 }
293 }
294 if (f_construction_A) {
295 M[2 * n + Q] = 1;
296 if (f_hyperoval)
297 M[1 * n + Q + 1] = 1;
298 }
299 else if (f_construction_B) {
300 M[1 * n + Q] = 1;
301 }
302
303 if (f_v) {
304 cout << "M:" << endl;
305 Int_vec_print_integer_matrix_width(cout, M, m, n, n, 2);
306
307 F->latex_matrix(cout, f_elements_exponential,
308 symbol_for_print, M, m, n);
309 }
310
311
312 if (f_v) {
313 int *all_one, *col_sum;
314
315 all_one = NEW_int(n);
316 col_sum = NEW_int(m);
317 for (i = 0; i < n; i++)
318 all_one[i] = 1;
319 F->Linear_algebra->mult_matrix_matrix(M, all_one, col_sum, m, n, 1,
320 0 /* verbose_level */);
321 cout << "overall col_sum:" << endl;
322 Int_vec_print_integer_matrix_width(cout, col_sum, m, 1, 1, 2);
323 FREE_int(all_one);
324 FREE_int(col_sum);
325 }
326
327
328}
329
330
331
334 int *H_subfield, int *C, int *C_inv, int *M,
335 int m, int n, int beta, int beta_q,
336 int f_elements_exponential, std::string &symbol_for_print,
337 std::string &symbol_for_print_subfield,
338 int f_construction_A, int f_hyperoval, int f_construction_B,
339 int verbose_level)
340{
341 int f_v = (verbose_level >= 1);
342 int f_vv = (verbose_level >= 2);
343 int i, j;
344 int q;
345 //int *C;
346 //int *C_inv;
347 int *H;
348 int *AA;
350
351 q = f->q;
352
353
354 Rep.init(F, verbose_level);
355 // matrix C is zero:
356 H = NEW_int(m * n);
357 AA = NEW_int(m * m);
358 for (i = 0; i < m; i++) {
359 for (j = 0; j < m; j++) {
360 C[i * m + j] = 0;
361 }
362 }
363
364
365 if (f_construction_A) {
366 int nb_C_coeffs = 15;
367 int k, aa;
368 int C_coeffs[] = {
369 0, 0, 1,
370 1, 1, 1,
371 2, 2, 1,
372 3, 3, 1,
373 3, 4, 1,
374 4, 3, beta_q,
375 4, 4, beta,
376 5, 5, 1,
377 5, 6, 1,
378 6, 5, beta_q,
379 6, 6, beta,
380 7, 7, 1,
381 7, 8, 1,
382 8, 7, beta_q,
383 8, 8, beta,
384 };
385 for (k = 0; k < nb_C_coeffs; k++) {
386 i = C_coeffs[k * 3 + 0];
387 j = C_coeffs[k * 3 + 1];
388 aa = C_coeffs[k * 3 + 2];
389 C[i * m + j] = aa;
390 }
391 }
392 else if (f_construction_B) {
393 int nb_C_coeffs = 20;
394 int k, aa;
395 int C_coeffs[] = {
396 0, 0, 1,
397 1, 1, 1,
398 2, 2, 1,
399 2, 3, 1,
400 2, 4, 1,
401 3, 2, beta,
402 3, 3, beta_q,
403 3, 4, Rep.beta_trinomial(q, beta, 1, 0, 0),
404 4, 2, Rep.beta_trinomial(q, beta, 0, 0, 2),
405 4, 3, Rep.beta_trinomial(q, beta, 0, 2, 0),
406 4, 4, Rep.beta_trinomial(q, beta, 2, 0, 0),
407 5, 5, 1,
408 5, 6, 1,
409 5, 7, 1,
410 6, 5, Rep.beta_trinomial(q, beta, 0, 1, 1),
411 6, 6, Rep.beta_trinomial(q, beta, 1, 1, 0),
412 6, 7, Rep.beta_trinomial(q, beta, 1, 0, 1),
413 7, 5, Rep.beta_trinomial(q, beta, 0, 2, 2),
414 7, 6, Rep.beta_trinomial(q, beta, 2, 2, 0),
415 7, 7, Rep.beta_trinomial(q, beta, 2, 0, 2),
416 };
417 for (k = 0; k < nb_C_coeffs; k++) {
418 i = C_coeffs[k * 3 + 0];
419 j = C_coeffs[k * 3 + 1];
420 aa = C_coeffs[k * 3 + 2];
421 C[i * m + j] = aa;
422 }
423 }
424
425
426 if (f_v) {
427 cout << "matrix C:" << endl;
428 Int_vec_print_integer_matrix_width(cout, C, m, m, m, 2);
429 F->latex_matrix(cout, f_elements_exponential,
430 symbol_for_print, C, m, m);
431 }
432
433
434 F->Linear_algebra->invert_matrix(C, C_inv, m, 0 /* verbose_level */);
435
436 if (f_vv) {
437 cout << "C_inv:" << endl;
438 Int_vec_print_integer_matrix_width(cout, C_inv, m, m, m, 2);
439 }
440
441 F->Linear_algebra->mult_matrix_matrix(C, C_inv, AA, m, m, m,
442 0 /* verbose_level */);
443
444 if (f_vv) {
445 cout << "C * C_inv:" << endl;
446 Int_vec_print_integer_matrix_width(cout, AA, m, m, m, 2);
447 }
448
449
450 F->Linear_algebra->mult_matrix_matrix(C, M, H, m, m, n,
451 0 /* verbose_level */);
452
453 if (f_v) {
454 cout << "H = C * M:" << endl;
455 Int_vec_print_integer_matrix_width(cout, H, m, n, n, 2);
456 F->latex_matrix(cout, f_elements_exponential,
457 symbol_for_print, H, m, n);
458 }
459
460
461#if 0
462 rk = F.Gauss_int(M, FALSE /* f_special */, TRUE /* f_complete */, base_cols,
463 FALSE /* f_P */, NULL, m /* m */, n /* n */, 0 /* Pn */,
464 verbose_level - 2);
465 cout << "has rank " << rk << endl;
466#endif
467
468 tt_field_reduction(*F, *f, m, n, H, H_subfield, verbose_level - 2);
469
470 if (f_v) {
471 cout << "H_subfield:" << endl;
472 Int_vec_print_integer_matrix_width(cout, H_subfield, m, n, n, 2);
473 f->latex_matrix(cout, f_elements_exponential,
474 symbol_for_print_subfield, H_subfield, m, n);
475 }
476
477 FREE_int(H);
478 FREE_int(AA);
479}
480
481
482
485 int m, int n, int *M, int *MM, int verbose_level)
486{
487 int f_v = (verbose_level >= 1);
488 int f_vv = (verbose_level >= 2);
489 int i, j, a, z, b, c, Q, q;
490 int index;
491
492 Q = F.q;
493 q = f.q;
494 index = (Q - 1) / (q - 1);
495 if (f_v) {
496 cout << "field reduction, Q=" << Q
497 << " q=" << q << " index=" << index << endl;
498 }
499 if (f_vv) {
500 cout << "before:" << endl;
501 Int_vec_print_integer_matrix_width(cout, M, m, n, n, 2);
502 //print_integer_matrix(cout, M, m, n);
503 cout << endl;
504 F.print_integer_matrix_zech(cout, M, m, n);
505 cout << endl;
506 }
507 for (i = 0; i < m; i++) {
508 for (j = 0; j < n; j++) {
509 a = M[i * n + j];
510 if (a == 0) {
511 c = 0;
512 }
513 else {
514 if (f.e == 1) {
515 if (a >= q) {
516 cout << "field reduction: element does not "
517 "lie in the subfield: " << a << endl;
518 exit(1);
519 }
520 c = a;
521 }
522 else {
523 z = F.log_alpha(a);
524 b = z / index;
525 if (b * index != z) {
526 cout << "b * index != z" << endl;
527 exit(1);
528 }
529 c = f.alpha_power(b);
530 }
531 }
532 MM[i * n + j] = c;
533 }
534 }
535 if (f_vv) {
536 cout << "after:" << endl;
537 Int_vec_print_integer_matrix_width(cout, MM, m, n, n, 2);
538 //print_integer_matrix(cout, MM, m, n);
539 cout << endl;
540 f.print_integer_matrix_zech(cout, MM, m, n);
541 cout << endl;
542 }
543}
544
545
546
547
548
549//############################################### old stuff:
550
553 int *&the_set, int &length,
554 int verbose_level)
555{
556 int f_v = (verbose_level >= 1);
557 int f_hyperoval = FALSE;
558 const char *override_poly = "";
559 const char *override_poly_Q = "";
560 int i, t, q;
561 int *code;
562
563 if (f_v) {
564 cout << "make_tensor_code_9dimensional_as_point_set" << endl;
565 }
566 q = F->q;
567 if (q == 2) {
568 override_poly_Q = ""; override_poly = ""; f_hyperoval = FALSE;
569 }
570 else if (q == 3) {
571 override_poly_Q = ""; override_poly = ""; f_hyperoval = FALSE;
572 }
573 else if (q == 4) {
574 override_poly_Q = "19"; override_poly = "7"; f_hyperoval = FALSE;
575 // F_256 generated by X^8 + X^4 + X^3 + X^2 + 1
576 // F_16 generated by X^4+X+1 = 19
577 // F_4 generated by X^2+X+1 = 7
578 }
579 else if (q == 5) {
580 override_poly_Q = "47"; override_poly = ""; f_hyperoval = FALSE;
581 // F_625 generated by X^4 + X^3 + 3X + 2
582 // F_25 generated by X^2 + 4X + 2 = 47
583 }
584 else if (q == 7) {
585 override_poly_Q = ""; override_poly = ""; f_hyperoval = FALSE;
586 }
587 else if (q == 8) {
588 override_poly_Q = "97"; override_poly = "11"; f_hyperoval = TRUE;
589 // F_4096 generated by x^12+x^6+x^4+x+1
590 // F_64 generated by X^6+X^5+1 = 97
591 // F_8 generated by X^3+X+1 = 11
592 }
593 else if (q == 9) {
594 override_poly_Q = ""; override_poly = "17"; f_hyperoval = FALSE;
595 }
596
597 string poly_Q, poly_q;
598
599 poly_Q.assign(override_poly_Q);
600 poly_q.assign(override_poly);
601
602 make_tensor_code_9_dimensional(q, poly_Q, poly_q,
603 f_hyperoval, code, length, verbose_level - 1);
604
605 the_set = NEW_int(length);
606
607 int pt[9], rk;
608
609 for (t = 0; t < length; t++) {
610 for (i = 0; i < 9; i++) {
611 pt[i] = code[i * length + t];
612 }
613 F->PG_element_rank_modified(pt, 1, 9, rk);
614 the_set[t] = rk;
615 }
616 FREE_int(code);
617 if (f_v) {
618 cout << "make_tensor_code_9dimensional_as_point_set done" << endl;
619 cout << "created the set: ";
620 Int_vec_print(cout, the_set, length);
621 cout << endl;
622 }
623}
624
626 std::string &override_poly_Q, std::string &override_poly,
627 int f_hyperoval,
628 int *&code, int &length,
629 int verbose_level)
630{
634 int exponents[9];
635 int *M;
636 int *C;
637 int *C_inv;
638 int *H;
639 int *H_subfield;
640 int index, Q, i, j, t, m, n, r, beta, beta_q;
641 int f_v = (verbose_level >= 1);
642 int f_vv = (verbose_level >= 2);
643
644
645 if (f_v) {
646 cout << "make_tensor_code_9_dimensional q=" << q << endl;
647 }
648
649 //q = 2; override_poly_Q = ""; override_poly = ""; int f_hyperoval = FALSE;
650 //q = 3; override_poly_Q = ""; override_poly = ""; int f_hyperoval = FALSE;
651 //q = 4; override_poly_Q = "19"; override_poly = "7"; int f_hyperoval = FALSE;
652 // F_256 generated by X^8 + X^4 + X^3 + X^2 + 1
653 // F_16 generated by X^4+X+1 = 19
654 // F_4 generated by X^2+X+1 = 7
655 //q = 5; override_poly_Q = "47"; override_poly = ""; int f_hyperoval = FALSE;
656 // F_625 generated by X^4 + X^3 + 3X + 2
657 // F_25 generated by X^2 + 4X + 2 = 47
658 //q = 7; override_poly_Q = ""; override_poly = ""; int f_hyperoval = FALSE;
659 //q = 8; override_poly_Q = "97"; override_poly = "11"; int f_hyperoval = TRUE;
660 // F_4096 generated by x^12+x^6+x^4+x+1
661 // F_64 generated by X^6+X^5+1 = 97
662 // F_8 generated by X^3+X+1 = 11
663 //q = 9; override_poly_Q = ""; override_poly = "17"; int f_hyperoval = FALSE;
664 beta = q;
665 Q = q * q;
666 m = 9;
667 if (f_hyperoval) {
668 n = Q + 2;
669 }
670 else {
671 n = Q + 1;
672 }
673 r = 5;
674 if (q == 4)
675 r = 7;
676 if (q == 3)
677 r = 9;
678 exponents[0] = 0;
679 exponents[1] = q + 1;
680 exponents[2] = 2 * q + 2;
681 exponents[3] = q;
682 exponents[4] = 1;
683 exponents[5] = 2 * q;
684 exponents[6] = 2;
685 exponents[7] = 2 * q + 1;
686 exponents[8] = q + 2;
687 //exponents[0] = 0;
688 //exponents[1] = q;
689 //exponents[2] = 2 * q;
690 //exponents[3] = 1;
691 //exponents[4] = q + 1;
692 //exponents[5] = 2 * q + 1;
693 //exponents[6] = 2;
694 //exponents[7] = q + 2;
695 //exponents[8] = 2 * q + 2;
696
697 index = (Q - 1) / (q - 1);
698
699
700 cout << "q = " << q << " override polynomial = " << override_poly << endl;
701 cout << "Q = " << Q << endl;
702
703 F.init_override_polynomial(Q, override_poly_Q, FALSE /* f_without_tables */, verbose_level);
704 cout << "field of order " << Q << " initialized" << endl;
705 beta_q = F.power(beta, q);
706 f.init_override_polynomial(q, override_poly, FALSE /* f_without_tables */, verbose_level);
707 cout << "field of order " << q << " initialized" << endl;
708 cout << "n = " << n << endl;
709 cout << "index = " << index << endl;
710 cout << "beta = " << beta << endl;
711 cout << "beta_q = " << beta_q << endl;
712 F.compute_subfields(verbose_level - 3);
713
714 M = NEW_int(m * n);
715 C = NEW_int(m * m);
716 C_inv = NEW_int(m * m);
717 H = NEW_int(m * n);
718 H_subfield = NEW_int(m * n);
719
720 rc.init(&f, m, n, r + 1);
721
722 for (i = 0; i < m; i++) {
723 for (j = 0; j < n; j++) {
724 M[i * n + j] = 0;
725 }
726 }
727 for (i = 0; i < m; i++) {
728 for (j = 0; j < m; j++) {
729 C[i * m + j] = 0;
730 }
731 }
732 for (t = 0; t < Q; t++) {
733 for (i = 0; i < m; i++) {
734 M[i * n + t] = F.power(t, exponents[i]);
735 }
736 }
737 {
738 M[2 * n + Q] = 1;
739 if (f_hyperoval)
740 M[1 * n + Q + 1] = 1;
741 int nb_C_coeffs = 15;
742 int k, aa;
743 int C_coeffs[] = {
744 0, 0, 1,
745 1, 1, 1,
746 2, 2, 1,
747 3, 3, 1,
748 3, 4, 1,
749 4, 3, beta_q,
750 4, 4, beta,
751 5, 5, 1,
752 5, 6, 1,
753 6, 5, beta_q,
754 6, 6, beta,
755 7, 7, 1,
756 7, 8, 1,
757 8, 7, beta_q,
758 8, 8, beta,
759 };
760 for (k = 0; k < nb_C_coeffs; k++) {
761 i = C_coeffs[k * 3 + 0];
762 j = C_coeffs[k * 3 + 1];
763 aa = C_coeffs[k * 3 + 2];
764 C[i * m + j] = aa;
765 }
766 }
767
768 cout << "M:" << endl;
769 Int_vec_print_integer_matrix_width(cout, M, m, n, n, 2);
770
771 {
772 int *all_one, *col_sum;
773
774 all_one = NEW_int(n);
775 col_sum = NEW_int(m);
776 for (i = 0; i < n; i++) {
777 all_one[i] = 1;
778 }
779 F.Linear_algebra->mult_matrix_matrix(M, all_one, col_sum, m, n, 1,
780 0 /* verbose_level */);
781 cout << "col_sum:" << endl;
782 Int_vec_print_integer_matrix_width(cout, col_sum, m, 1, 1, 2);
783 FREE_int(all_one);
784 FREE_int(col_sum);
785 }
786
787#if 0
788 for (j = 0; j < n; j++) {
789 PG_element_normalize(F, M + j, n, m);
790 }
791 cout << "column normalized M:" << endl;
792 print_integer_matrix_width(cout, M, m, n, n, 2);
793#endif
794
795
796 cout << "C:" << endl;
797 Int_vec_print_integer_matrix_width(cout, C, m, m, m, 2);
798
799 F.Linear_algebra->invert_matrix(C, C_inv, m, 0 /* verbose_level */);
800
801 cout << "C_inv:" << endl;
802 Int_vec_print_integer_matrix_width(cout, C_inv, m, m, m, 2);
803
804 {
805 int *AA;
806 AA = NEW_int(m * m);
807 F.Linear_algebra->mult_matrix_matrix(C, C_inv, AA, m, m, m,
808 0 /* verbose_level */);
809 cout << "C * C_inv:" << endl;
810 Int_vec_print_integer_matrix_width(cout, AA, m, m, m, 2);
811 FREE_int(AA);
812 }
813
814 F.Linear_algebra->mult_matrix_matrix(C, M, H, m, m, n,
815 0 /* verbose_level */);
816 cout << "H = C * M:" << endl;
817 Int_vec_print_integer_matrix_width(cout, H, m, n, n, 2);
818
819
820#if 0
821 rk = F.Gauss_int(M, FALSE /* f_special */, TRUE /* f_complete */, base_cols,
822 FALSE /* f_P */, NULL, m /* m */, n /* n */, 0 /* Pn */,
823 FALSE, FALSE);
824 cout << "has rank " << rk << endl;
825#endif
826
827 if (f_vv) {
828 cout << "before field reduction:" << endl;
829 Int_vec_print_integer_matrix_width(cout, H, m, n, n, 2);
830 cout << endl;
831 f.print_integer_matrix_zech(cout, H, m, n);
832 cout << endl;
833 }
834 F.retract_int_vec(f, 2, H, H_subfield, m * n, 0 /* verbose_level */);
835 //field_reduction(F, f, m, n, H, H_subfield, TRUE, TRUE);
836 if (f_vv) {
837 cout << "after field reduction:" << endl;
838 Int_vec_print_integer_matrix_width(cout, H_subfield, m, n, n, 2);
839 cout << endl;
840 f.print_integer_matrix_zech(cout, H_subfield, m, n);
841 cout << endl;
842 }
843 cout << "H_subfield:" << endl;
844 Int_vec_print_integer_matrix_width(cout, H_subfield, m, n, n, 2);
845
846 code = H_subfield;
847 length = n;
848
849 FREE_int(M);
850 FREE_int(C);
851 FREE_int(C_inv);
852 FREE_int(H);
853
854}
855
856
857
858}}}
859
860
861
862
863
to check whether any d - 1 elements of a given set are linearly independent
Definition: algebra.h:655
void init(field_theory::finite_field *GFq, int m, int n, int d)
void make_tensor_code_9_dimensional(int q, std::string &override_poly_Q, std::string &override_poly, int f_hyperoval, int *&code, int &length, int verbose_level)
void tt_field_reduction(field_theory::finite_field &F, field_theory::finite_field &f, int m, int n, int *M, int *MM, int verbose_level)
void create_matrix_M(int *&M, field_theory::finite_field *F, field_theory::finite_field *f, int &m, int &n, int &beta, int &r, int *exponents, int f_construction_A, int f_hyperoval, int f_construction_B, int f_elements_exponential, std::string &symbol_for_print, int verbose_level)
void twisted_tensor_product_codes(int *&H_subfield, int &m, int &n, field_theory::finite_field *F, field_theory::finite_field *f, int f_construction_A, int f_hyperoval, int f_construction_B, int verbose_level)
void make_tensor_code_9dimensional_as_point_set(field_theory::finite_field *F, int *&the_set, int &length, int verbose_level)
void create_matrix_H_subfield(field_theory::finite_field *F, field_theory::finite_field *f, int *H_subfield, int *C, int *C_inv, int *M, int m, int n, int beta, int beta_q, int f_elements_exponential, std::string &symbol_for_print, std::string &symbol_for_print_subfield, int f_construction_A, int f_hyperoval, int f_construction_B, int verbose_level)
void PG_element_rank_modified(int *v, int stride, int len, int &a)
void retract_int_vec(finite_field &subfield, int index, int *v_in, int *v_out, int len, int verbose_level)
void init_override_polynomial(int q, std::string &poly, int f_without_tables, int verbose_level)
void latex_matrix(std::ostream &f, int f_elements_exponential, std::string &symbol_for_print, int *M, int m, int n)
void print_integer_matrix_zech(std::ostream &ost, int *p, int m, int n)
void invert_matrix(int *A, int *A_inv, int n, int verbose_level)
void mult_matrix_matrix(int *A, int *B, int *C, int m, int n, int o, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_int(n)
Definition: foundations.h:625
#define Int_vec_print_integer_matrix_width(A, B, C, D, E, F)
Definition: foundations.h:691
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects