Orbiter 2022
Combinatorial Objects
spread_tables.cpp
Go to the documentation of this file.
1/*
2 * spread_tables.cpp
3 *
4 * Created on: Feb 24, 2019
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace geometry {
20
21
22static int spread_table_compare_func(void *a, void *b, void *data);
23
24
26{
27 q = 0;
28 d = 4; // = 4
29 F = NULL;
30 P = NULL; // PG(3,q)
31 Gr = NULL; // Gr_{4,2}
32 nb_lines = 0;
33 spread_size = 0;
35
36 //std::string prefix;
37
38 //std::string fname_dual_line_idx;
39 //std::string fname_self_dual_lines;
40 //std::string fname_spreads;
41 //std::string fname_isomorphism_type_of_spreads;
42 //std::string fname_dual_spread;
43 //std::string fname_self_dual_spreads;
44 //std::string fname_schreier_table;
45
46
47 dual_line_idx = NULL;
48 self_dual_lines = NULL;
50
51 nb_spreads = 0;
52 spread_table = NULL;
53 spread_iso_type = NULL;
54 dual_spread_idx = NULL;
55 self_dual_spreads = NULL;
57
58 schreier_table = NULL;
59
60 //null();
61}
62
64{
65#if 0
66 if (P) {
68 }
69 if (Gr) {
71 }
72#endif
73 if (dual_line_idx) {
75 }
76 if (self_dual_lines) {
78 }
79 if (spread_table) {
81 }
82 if (spread_iso_type) {
84 }
85 if (dual_spread_idx) {
87 }
88 if (schreier_table) {
90 }
91}
92
94 int f_load,
95 int nb_iso_types_of_spreads,
96 std::string &path_to_spread_tables,
97 int verbose_level)
98{
99 int f_v = (verbose_level >= 1);
101
102 if (f_v) {
103 cout << "spread_tables::init" << endl;
104 }
105
106 if (P->n != 3) {
107 cout << "spread_tables::init P->n != 3" << endl;
108 exit(1);
109 }
112 Gr = P->Grass_lines;
113 q = F->q;
114 d = 4;
115
116 nb_lines = Gr->nCkq->as_int();
117 spread_size = q * q + 1;
119
120 if (f_v) {
121 cout << "spread_tables::init nb_lines=" << nb_lines << endl;
122 cout << "spread_tables::init spread_size=" << spread_size << endl;
123 cout << "spread_tables::init nb_iso_types_of_spreads="
124 << nb_iso_types_of_spreads << endl;
125 }
126
127
128 prefix.assign(path_to_spread_tables);
129
130 char str[1000];
131 sprintf(str, "spread_%d", NT.i_power_j(q, 2));
132
133 prefix.append(str);
134
135 if (f_v) {
136 cout << "spread_tables::init prefix=" << spread_tables::prefix << endl;
137 }
138
139
140 create_file_names(verbose_level);
141
142 if (f_v) {
143 cout << "spread_tables::init before Gr->compute_dual_line_idx" << endl;
144 }
147 0 /*verbose_level*/);
148 if (f_v) {
149 cout << "spread_tables::init after Gr->compute_dual_line_idx" << endl;
150 }
151
152 if (f_load) {
153 if (f_v) {
154 cout << "spread_tables::init before load" << endl;
155 }
156 load(verbose_level);
157 if (f_v) {
158 cout << "spread_tables::init after load" << endl;
159 }
160 }
161
162
163 if (f_v) {
164 cout << "spread_tables::init done" << endl;
165 }
166}
167
168void spread_tables::create_file_names(int verbose_level)
169{
171 fname_dual_line_idx.append("_dual_line_idx.csv");
172
174 fname_self_dual_lines.append("_self_dual_line_idx.csv");
175
176 fname_spreads.assign(prefix);
177 fname_spreads.append("_spreads.csv");
178
180 fname_isomorphism_type_of_spreads.append("_spreads_iso.csv");
181
183 fname_dual_spread.append("_dual_spread_idx.csv");
184
186 fname_self_dual_spreads.append("_self_dual_spreads.csv");
187
189 fname_schreier_table.append("_schreier_table.csv");
190
191}
193 long int *spread_table, int *spread_iso_type,
194 int verbose_level)
195{
196 int f_v = (verbose_level >= 1);
197
198 if (f_v) {
199 cout << "spread_tables::init_spread_table" << endl;
200 }
204 if (f_v) {
205 cout << "spread_tables::init_spread_table done" << endl;
206 }
207}
208
209void spread_tables::init_tables(int nb_spreads,
210 long int *spread_table, int *spread_iso_type,
211 long int *dual_spread_idx,
212 long int *self_dual_spreads, int nb_self_dual_spreads,
213 int verbose_level)
214{
215 int f_v = (verbose_level >= 1);
216
217 if (f_v) {
218 cout << "spread_tables::init_tables" << endl;
219 }
226 if (f_v) {
227 cout << "spread_tables::init_tables done" << endl;
228 }
229}
230
231void spread_tables::init_schreier_table(int *schreier_table,
232 int verbose_level)
233{
234 int f_v = (verbose_level >= 1);
235
236 if (f_v) {
237 cout << "spread_tables::init_schreier_table" << endl;
238 }
240 if (f_v) {
241 cout << "spread_tables::init_schreier_table done" << endl;
242 }
243}
244
246 int nb_select, int *select,
247 spread_tables *old_spread_table,
248 std::string &path_to_spread_tables,
249 int verbose_level)
250{
251 int f_v = (verbose_level >= 1);
252 int i, a;
254
255 if (f_v) {
256 cout << "spread_tables::init_reduced, nb_select=" << nb_select << endl;
257 }
258
259 P = old_spread_table->P;
260 F = P->F;
261 Gr = P->Grass_lines;
262 q = F->q;
263 d = 4; // = 4
264
265
266 prefix.assign(path_to_spread_tables);
267
268 char str[1000];
269 sprintf(str, "reduced_spread_%d", NT.i_power_j(q, 2));
270
271 prefix.append(str);
272
273 create_file_names(verbose_level);
274
275
276 nb_lines = Gr->nCkq->as_int();
277 spread_size = old_spread_table->spread_size;
279
280
281 nb_spreads = nb_select;
282 if (f_v) {
283 cout << "spread_tables::init_reduced allocating spread_table" << endl;
284 }
286 if (f_v) {
287 cout << "spread_tables::init_reduced allocating spread_iso_type" << endl;
288 }
290 for (i = 0; i < nb_spreads; i++) {
291 a = select[i];
292 Lint_vec_copy(old_spread_table->spread_table + a * spread_size,
294 spread_iso_type[i] = old_spread_table->spread_iso_type[a];
295 }
296
298 int *select_sorted;
299 int *select_original_idx;
300
301 select_sorted = NEW_int(nb_select);
302 select_original_idx = NEW_int(nb_select);
303 Int_vec_copy(select, select_sorted, nb_select);
304
305 if (f_v) {
306 cout << "spread_tables::init_reduced "
307 "sorting good spreads" << endl;
308 }
309 Sorting.int_vec_heapsort_with_log(select_sorted, select_original_idx, nb_select);
310 for (i = 0; i < nb_spreads; i++) {
311 select_original_idx[i] = i;
312 }
313 if (f_v) {
314 cout << "spread_tables::init_reduced "
315 "sorting good spreads done" << endl;
316 }
317 int idx;
318
319 if (f_v) {
320 cout << "spread_tables::init_reduced computing dual_spread_idx" << endl;
321 }
323 for (i = 0; i < nb_spreads; i++) {
324 a = select[i];
325 if (!Sorting.int_vec_search(select_sorted, nb_spreads, old_spread_table->dual_spread_idx[a], idx)) {
326 //cout << "spread_tables::init_reduced unable to find the dual spread in the selection" << endl;
327 //exit(1);
328 idx = -1;
329 }
330 else {
331 idx = select_original_idx[idx];
332 }
333 dual_spread_idx[i] = idx;
334 }
335 if (f_v) {
336 cout << "spread_tables::init_reduced computing dual_spread_idx done" << endl;
337 }
338
339 FREE_int(select_sorted);
340 FREE_int(select_original_idx);
341
342 if (f_v) {
343 cout << "spread_tables::init_reduced computing self_dual_spreads" << endl;
344 }
347 for (i = 0; i < nb_spreads; i++) {
348 idx = dual_spread_idx[i];
349 if (idx == i) {
351 }
352 }
353 if (f_v) {
354 cout << "spread_tables::init_reduced computing self_dual_spreads done" << endl;
355 }
356
357
358
359 if (f_v) {
360 cout << "spread_tables::init_reduced done" << endl;
361 }
362}
363
364long int *spread_tables::get_spread(int spread_idx)
365{
366 return spread_table + spread_idx * spread_size;
367}
368
370 int line1, int line2, int verbose_level)
371{
372 int f_v = (verbose_level >= 1);
373
374 if (f_v) {
375 cout << "spread_tables::find_spreads_containing_two_lines" << endl;
376 cout << "spread_tables::find_spreads_containing_two_lines line1 = " << line1 << endl;
377 cout << "spread_tables::find_spreads_containing_two_lines line2 = " << line2 << endl;
378 }
379 int spread_idx;
380 long int *S;
381 int i;
382 int f_found_line1;
383 int f_found_line2;
384
385 for (spread_idx = 0; spread_idx < nb_spreads; spread_idx++) {
386 S = get_spread(spread_idx);
387 f_found_line1 = FALSE;
388 for (i = 0; i < spread_size; i++) {
389 if (S[i] == line1) {
390 f_found_line1 = TRUE;
391 break;
392 }
393 }
394 f_found_line2 = FALSE;
395 for (i = 0; i < spread_size; i++) {
396 if (S[i] == line2) {
397 f_found_line2 = TRUE;
398 break;
399 }
400 }
401 if (f_found_line1 && f_found_line2) {
402 v.push_back(spread_idx);
403 }
404 }
405 if (f_v) {
406 cout << "spread_tables::find_spreads_containing_two_lines done" << endl;
407 }
408}
409
412 int verbose_level)
413{
414 int f_v = (verbose_level >= 1);
415 int i, a;
416
417 if (f_v) {
418 cout << "spread_tables::classify_self_dual_spreads" << endl;
419 }
422 for (i = 0; i < nb_self_dual_spreads; i++) {
423 a = spread_iso_type[i];
424 type[a]++;
425 }
428 nb_self_dual_spreads /* underlying_set_size */,
429 nb_iso_types_of_spreads /* nb_sets */,
430 type, 0 /* verbose_level */);
431 for (a = 0; a < nb_iso_types_of_spreads; a++) {
432 SoS->Set_size[a] = 0;
433 }
434 for (i = 0; i < nb_self_dual_spreads; i++) {
435 a = spread_iso_type[i];
436 SoS->Sets[a][SoS->Set_size[a]++] = i;
437 }
438
439 if (f_v) {
440 cout << "spread_tables::classify_self_dual_spreads done" << endl;
441 }
442}
443
444int spread_tables::files_exist(int verbose_level)
445{
446 int f_v = (verbose_level >= 1);
448
449 if (f_v) {
450 cout << "spread_tables::files_exist testing whether file exists: " << fname_spreads << endl;
451 }
452 if (Fio.file_size(fname_spreads) > 0) {
453 return TRUE;
454 }
455 else {
456 return FALSE;
457 }
458}
459
460void spread_tables::save(int verbose_level)
461{
462 int f_v = (verbose_level >= 1);
464
465 if (f_v) {
466 cout << "spread_tables::save" << endl;
467 }
468
469 if (f_v) {
470 cout << "spread_tables::save "
471 "writing file " << fname_spreads << endl;
472 }
473
476 if (f_v) {
477 cout << "spread_tables::save "
478 "written file " << fname_spreads << endl;
479 }
480
481 if (f_v) {
482 cout << "spread_tables::save, "
483 "writing file " << fname_isomorphism_type_of_spreads
484 << endl;
485 }
489 "isomorphism_type_of_spread");
490 if (f_v) {
491 cout << "spread_tables::save, "
492 "written file " << fname_isomorphism_type_of_spreads
493 << endl;
494 }
495
496 if (f_v) {
497 cout << "spread_tables::save, "
498 "writing file " << fname_dual_spread
499 << endl;
500 }
504 "dual_spread_idx");
505 if (f_v) {
506 cout << "spread_tables::save, "
507 "written file " << fname_dual_spread
508 << endl;
509 }
510
511 if (f_v) {
512 cout << "spread_tables::save, "
513 "writing file " << fname_self_dual_spreads
514 << endl;
515 }
519 "self_dual_spreads");
520 if (f_v) {
521 cout << "spread_tables::save, "
522 "written file " << fname_self_dual_spreads
523 << endl;
524 }
525
526
527
528 if (schreier_table) {
529 if (f_v) {
530 cout << "spread_tables::save "
531 "writing file " << fname_schreier_table << endl;
532 }
533
536 if (f_v) {
537 cout << "spread_tables::save "
538 "written file " << fname_schreier_table << endl;
539 }
540 }
541 else {
542 cout << "spread_tables::save no schreier table" << endl;
543 }
544
545
546 if (f_v) {
547 cout << "spread_tables::save done" << endl;
548 }
549}
550
551void spread_tables::load(int verbose_level)
552{
553 int f_v = (verbose_level >= 1);
554 int a, b;
556
557 if (f_v) {
558 cout << "spread_tables::load" << endl;
559 }
560
561 if (f_v) {
562 cout << "spread_tables::load "
563 "reading file " << fname_spreads << endl;
564 }
565
568 0 /* verbose_level */);
569 if (b != spread_size) {
570 cout << "spread_tables::load b != spread_size" << endl;
571 exit(1);
572 }
573 if (f_v) {
574 cout << "spread_tables::load "
575 "read file " << fname_spreads << endl;
576 }
577
578 if (f_v) {
579 cout << "spread_tables::load, "
580 "reading file " << fname_isomorphism_type_of_spreads
581 << endl;
582 }
584 spread_iso_type, a, b,
585 0 /* verbose_level */);
586 if (a != nb_spreads) {
587 cout << "spread_tables::load a != nb_spreads" << endl;
588 exit(1);
589 }
590 if (f_v) {
591 cout << "spread_tables::load, "
593 << endl;
594 }
595
596 if (f_v) {
597 cout << "spread_tables::load, "
598 "reading file " << fname_dual_spread
599 << endl;
600 }
602 dual_spread_idx, a, b,
603 0 /* verbose_level */);
604 if (a != nb_spreads) {
605 cout << "spread_tables::load a != nb_spreads" << endl;
606 exit(1);
607 }
608 if (f_v) {
609 cout << "spread_tables::load, "
610 "read file " << fname_dual_spread
611 << endl;
612 }
613
614 if (f_v) {
615 cout << "spread_tables::load, "
616 "reading file " << fname_self_dual_spreads
617 << endl;
618 }
621 0 /* verbose_level */);
622 if (f_v) {
623 cout << "spread_tables::load, "
624 "read file " << fname_self_dual_spreads
625 << endl;
626 }
627
628
629 if (Fio.file_size(fname_schreier_table) > 0) {
630 if (f_v) {
631 cout << "spread_tables::load, "
632 "reading file " << fname_schreier_table
633 << endl;
634 }
636 schreier_table, a, b,
637 0 /* verbose_level */);
638 if (a != nb_spreads) {
639 cout << "spread_tables::load a != nb_spreads" << endl;
640 exit(1);
641 }
642 if (b != 4) {
643 cout << "spread_tables::load b != 4" << endl;
644 exit(1);
645 }
646 if (f_v) {
647 cout << "spread_tables::load, "
648 "read file " << fname_schreier_table
649 << endl;
650 }
651 }
652 else {
653 cout << "spread_tables::load no schreier tables" << endl;
654 exit(1);
655 }
656
657
658 if (f_v) {
659 cout << "spread_tables::load done" << endl;
660 }
661}
662
663
666 int verbose_level)
667{
668 int f_v = (verbose_level >= 1);
669 long int i, j, k, N2; //, cnt;
670
671 if (f_v) {
672 cout << "spread_tables::compute_adjacency_matrix" << endl;
673 }
674
675 N2 = ((long int) nb_spreads * (long int) nb_spreads) >> 1;
676
678 Bitvec->allocate(N2);
679
680 k = 0;
681 //cnt = 0;
682 for (i = 0; i < nb_spreads; i++) {
683
684 for (j = i + 1; j < nb_spreads; j++) {
685
686
688 Bitvec->m_i(k, 1);
689 //cnt++;
690 }
691 else {
692 Bitvec->m_i(k, 0);
693 }
694
695 k++;
696 if ((k & ((1 << 21) - 1)) == 0) {
697 cout << "i=" << i << " j=" << j << " k=" << k << " / " << N2 << endl;
698 }
699 }
700 }
701
702
703
704
705
706 {
708 std::string fname;
710 string label;
711 string label_tex;
712
714 int *color;
715
716 label.assign(prefix);
717 label_tex.assign(prefix);
718
719 color = NEW_int(nb_spreads);
720 Int_vec_zero(color, nb_spreads);
721
722 CG->init(nb_spreads, 1, 1,
723 color, Bitvec,
724 FALSE,
725 label, label_tex,
726 verbose_level);
727
728 fname.assign(prefix);
729 fname.append("_disjoint_spreads.colored_graph");
730
731 CG->save(fname, verbose_level);
732
733 cout << "Written file " << fname << " of size "
734 << Fio.file_size(fname) << endl;
735
736 FREE_int(color);
737 FREE_OBJECT(CG);
738 }
739
740
741 if (f_v) {
742 cout << "spread_tables::compute_adjacency_matrix done" << endl;
743 }
744}
745
747{
748 long int *p, *q;
750 int ret;
751
752 p = spread_table + a * spread_size;
753 q = spread_table + b * spread_size;
755 return ret;
756}
757
759 long int *&Dual_spread_idx,
760 long int *&self_dual_spread_idx,
761 int &nb_self_dual_spreads,
762 int verbose_level)
763{
764 int f_v = (verbose_level >= 1);
765 long int *dual_spread;
766 int i, j;
767 long int a, b;
768 int idx;
770
771 if (f_v) {
772 cout << "spread_tables::compute_dual_spreads" << endl;
773 }
774
775 dual_spread = NEW_lint(spread_size);
776 Dual_spread_idx = NEW_lint(nb_spreads);
777 self_dual_spread_idx = NEW_lint(nb_spreads);
778
780
781 for (i = 0; i < nb_spreads; i++) {
782
783 for (j = 0; j < spread_size; j++) {
784 a = spread_table[i * spread_size + j];
785 b = dual_line_idx[a];
786 dual_spread[j] = b;
787 }
788
789 if (FALSE) {
790 cout << "spread_tables::compute_dual_spreads spread "
791 << i << " / " << nb_spreads << endl;
792 Lint_vec_print(cout,
794 cout << endl;
795 Lint_vec_print(cout, dual_spread, spread_size);
796 cout << endl;
797 }
798 Sorting.lint_vec_heapsort(dual_spread, spread_size);
799 //dual_spread[0] = int_vec_hash(dual_spread + 1, spread_size);
800 if (FALSE) {
801 Lint_vec_print(cout, dual_spread, spread_size);
802 cout << endl;
803 }
804
805 long int v[1];
806
807 v[0] = spread_size /*+ 1*/;
808
809 if (Sorting.vec_search((void **)Sets,
810 spread_table_compare_func, (void *) v,
811 nb_spreads, dual_spread, idx,
812 0 /* verbose_level */)) {
813 if (FALSE) {
814 cout << "spread_tables::compute_dual_spreads Dual "
815 "spread of spread " << i
816 << " is spread no " << idx << endl;
817 }
818 Dual_spread_idx[i] = idx;
819 if (idx == i) {
820 self_dual_spread_idx[nb_self_dual_spreads++] = i;
821 }
822 }
823 else {
824 cout << "The dual spread is not in the list, error!" << endl;
825 cout << "dual_spread: ";
826 Lint_vec_print(cout, dual_spread, spread_size);
827 cout << endl;
828 exit(1);
829 }
830 }
831
832 FREE_lint(dual_spread);
833 if (f_v) {
834 cout << "spread_tables::compute_dual_spreads we found "
835 << nb_self_dual_spreads << " self dual spreads" << endl;
836 cout << "They are: ";
837 Lint_vec_print(cout, self_dual_spread_idx, nb_self_dual_spreads);
838 cout << endl;
839 }
840
841
842 if (f_v) {
843 cout << "spread_tables::compute_dual_spreads done" << endl;
844 }
845
846}
847
849 long int *set1, int sz1,
850 long int *set2, int sz2,
851 int verbose_level)
852{
853 int f_v = FALSE; // (verbose_level >= 1);
854 long int s1, s2;
855 int i, j;
856
857 if (f_v) {
858 cout << "spread_tables::test_if_pair_of_sets_are_adjacent" << endl;
859 }
860 for (i = 0; i < sz1; i++) {
861 s1 = set1[i];
862 for (j = 0; j < sz2; j++) {
863 s2 = set2[j];
864 if (!test_if_spreads_are_disjoint(s1, s2)) {
865 return FALSE;
866 }
867 }
868 }
869 return TRUE;
870}
871
873{
874 int i, j, ret;
875 long int a, b;
876
877 for (i = 0; i < len; i++) {
878 a = set[i];
879 for (j = i + 1; j < len; j++) {
880 b = set[j];
881 if (!test_if_spreads_are_disjoint(a, b)) {
882 break;
883 }
884 }
885 if (j < len) {
886 break;
887 }
888 }
889 if (i < len) {
890 //cout << "is NOT a partial packing" << endl;
891 ret = FALSE;
892 }
893 else {
894 ret = TRUE;
895 //cout << "IS a partial packing" << endl;
896 }
897 return ret;
898
899}
900
902{
903 int i, j, ret;
904 long int a, b;
905
906 for (i = 0; i < len; i++) {
907 a = set[i];
908 for (j = i + 1; j < len; j++) {
909 b = set[j];
910 if (!test_if_spreads_are_disjoint(a, b)) {
911 cout << "elements i=" << i << " j=" << j << " corresponding to spreads " << a << " and " << b << " are not line disjoint" << endl;
912 exit(1);
913 }
914 }
915 if (j < len) {
916 break;
917 }
918 }
919 if (i < len) {
920 //cout << "is NOT a partial packing" << endl;
921 ret = FALSE;
922 }
923 else {
924 ret = TRUE;
925 //cout << "IS a partial packing" << endl;
926 }
927 return ret;
928
929}
930
932 long int *live_point_index, int nb_live_points,
933 long int *live_blocks, int nb_live_blocks,
934 int nb_needed,
935 int verbose_level)
936// points are actually lines and lines are actually spreads
937{
938 int f_v = (verbose_level >= 1);
939
940 if (f_v) {
941 cout << "spread_tables::make_exact_cover_problem" << endl;
942 }
943
944 int s, u, i, j, a;
945 int nb_rows = nb_live_points;
946 int nb_cols = nb_live_blocks;
947
949 Dio->open(nb_rows, nb_cols);
950 Dio->f_has_sum = TRUE;
951 Dio->sum = nb_needed;
952
953 for (i = 0; i < nb_rows; i++) {
954 Dio->type[i] = t_EQ;
955 Dio->RHS[i] = 1;
956 Dio->RHS_low[i] = 1;
957 }
958
960
961
962 for (j = 0; j < nb_cols; j++) {
963 s = live_blocks[j];
964 for (a = 0; a < spread_size; a++) {
965 i = spread_table[s * spread_size + a];
966 u = live_point_index[i];
967 if (u == -1) {
968 cout << "spread_tables::make_exact_cover_problem "
969 "live_point_index[i] == -1" << endl;
970 exit(1);
971 }
972 Dio->Aij(u, j) = 1;
973 }
974 }
975 for (j = 0; j < nb_cols; j++) {
976 Dio->x_max[j] = 1;
977 Dio->x_min[j] = 0;
978 }
979
980
981 if (f_v) {
982 cout << "spread_tables::make_exact_cover_problem done" << endl;
983 }
984}
985
987 long int *list_of_lines, long int *packing, int sz_of_packing,
988 int verbose_level)
989// list_of_lines[sz_of_packing * spread_size]
990{
991 int f_v = (verbose_level >= 1);
992 int i, a;
993
994 if (f_v) {
995 cout << "spread_tables::compute_list_of_lines_from_packing" << endl;
996 }
997 for (i = 0; i < sz_of_packing; i++) {
998 a = packing[i];
1000 list_of_lines + i * spread_size, spread_size);
1001 }
1002 if (f_v) {
1003 cout << "spread_tables::compute_list_of_lines_from_packing done" << endl;
1004 }
1005}
1006
1008 int *Partial_packings, int nb_pp, int sz,
1009 int *&Iso_type_invariant,
1010 int verbose_level)
1011{
1012 int f_v = (verbose_level >= 1);
1013 int i, j, a, b;
1014
1015 if (f_v) {
1016 cout << "spread_tables::compute_iso_type_invariant" << endl;
1017 }
1018
1019 Iso_type_invariant = NEW_int(nb_pp * nb_iso_types_of_spreads);
1020 Int_vec_zero(Iso_type_invariant, nb_pp * nb_iso_types_of_spreads);
1021 for (i = 0; i < nb_pp; i++) {
1022 for (j = 0; j < sz; j++) {
1023 a = Partial_packings[i * sz + j];
1024 b = spread_iso_type[a];
1025 Iso_type_invariant[i * nb_iso_types_of_spreads + b]++;
1026 }
1027 }
1028
1029 if (f_v) {
1030 cout << "spread_tables::compute_iso_type_invariant done" << endl;
1031 }
1032}
1033
1034void spread_tables::report_one_spread(std::ostream &ost, int a)
1035{
1036 long int *p;
1037 long int b;
1038 int i;
1039
1040 p = spread_table + a * spread_size;
1041 for (i = 0; i < spread_size; i++) {
1042 ost << "$";
1043 b = p[i];
1045 ost << "_{" << b << "}";
1046 ost << "$";
1047 if (i < spread_size - 1) {
1048 ost << ", ";
1049 }
1050 }
1051}
1052
1053
1054static int spread_table_compare_func(void *a, void *b, void *data)
1055// used in spread_table
1056{
1057 int *A = (int *)a;
1058 int *B = (int *)b;
1059 int *p = (int *) data;
1060 int n = *p;
1061 int i;
1062
1063 for (i = 0; i < n; i++) {
1064 if (A[i] < B[i]) {
1065 return 1;
1066 }
1067 if (A[i] > B[i]) {
1068 return -1;
1069 }
1070 }
1071 return 0;
1072}
1073
1074
1075
1076
1077}}}
1078
1079
compact storage of 0/1-data as bitvectors
void init_basic_with_Sz_in_int(int underlying_set_size, int nb_sets, int *Sz, int verbose_level)
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
Definition: sorting.cpp:1094
int test_if_sets_are_disjoint(long int *set1, int sz1, long int *set2, int sz2)
Definition: sorting.cpp:519
void int_vec_heapsort_with_log(int *v, int *w, int len)
Definition: sorting.cpp:1967
int vec_search(void **v, int(*compare_func)(void *a, void *b, void *data), void *data_for_compare, int len, void *a, int &idx, int verbose_level)
Definition: sorting.cpp:945
ring_theory::longinteger_object * nCkq
Definition: geometry.h:895
void compute_dual_line_idx(int *&dual_line_idx, int *&self_dual_lines, int &nb_self_dual_lines, int verbose_level)
Definition: grassmann.cpp:1091
void print_single_generator_matrix_tex(std::ostream &ost, long int a)
Definition: grassmann.cpp:122
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
tables with line-spreads in PG(3,q)
Definition: geometry.h:2335
int test_if_set_of_spreads_is_line_disjoint(long int *set, int len)
void compute_list_of_lines_from_packing(long int *list_of_lines, long int *packing, int sz_of_packing, int verbose_level)
void compute_adjacency_matrix(data_structures::bitvector *&Bitvec, int verbose_level)
void classify_self_dual_spreads(int *&type, data_structures::set_of_sets *&SoS, int verbose_level)
void find_spreads_containing_two_lines(std::vector< int > &v, int line1, int line2, int verbose_level)
void init(projective_space *P, int f_load, int nb_iso_types_of_spreads, std::string &path_to_spread_tables, int verbose_level)
int test_if_set_of_spreads_is_line_disjoint_and_complain_if_not(long int *set, int len)
void compute_iso_type_invariant(int *Partial_packings, int nb_pp, int sz, int *&Iso_type_invariant, int verbose_level)
void init_tables(int nb_spreads, long int *spread_table, int *spread_iso_type, long int *dual_spread_idx, long int *self_dual_spreads, int nb_self_dual_spreads, int verbose_level)
void compute_dual_spreads(long int **Sets, long int *&Dual_spread_idx, long int *&self_dual_spread_idx, int &nb_self_dual_spreads, int verbose_level)
void init_reduced(int nb_select, int *select, spread_tables *old_spread_table, std::string &path_to_spread_tables, int verbose_level)
void init_schreier_table(int *schreier_table, int verbose_level)
int test_if_pair_of_sets_are_adjacent(long int *set1, int sz1, long int *set2, int sz2, int verbose_level)
void init_spread_table(int nb_spreads, long int *spread_table, int *spread_iso_type, int verbose_level)
void make_exact_cover_problem(solvers::diophant *&Dio, long int *live_point_index, int nb_live_points, long int *live_blocks, int nb_live_blocks, int nb_needed, int verbose_level)
void save(std::string &fname, int verbose_level)
void init(int nb_points, int nb_colors, int nb_colors_per_vertex, int *colors, data_structures::bitvector *Bitvec, int f_ownership_of_bitvec, std::string &label, std::string &label_tex, int verbose_level)
void int_matrix_write_csv(std::string &fname, int *M, int m, int n)
Definition: file_io.cpp:1300
void int_vec_write_csv(int *v, int len, std::string &fname, const char *label)
Definition: file_io.cpp:1175
void lint_matrix_write_csv(std::string &fname, long int *M, int m, int n)
Definition: file_io.cpp:1323
void int_matrix_read_csv(std::string &fname, int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1477
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1558
void lint_vec_write_csv(long int *v, int len, std::string &fname, const char *label)
Definition: file_io.cpp:1191
diophantine systems of equations (i.e., linear systems over the integers)
Definition: solvers.h:209
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
the orbiter library for the classification of combinatorial objects