Orbiter 2022
Combinatorial Objects
spread_table_with_selection.cpp
Go to the documentation of this file.
1/*
2 * spread_table_with_selection.cpp
3 *
4 * Created on: Jun 27, 2020
5 * Author: betten
6 */
7
8
9#include "orbiter.h"
10
11using namespace std;
12
13namespace orbiter {
14namespace layer5_applications {
15namespace spreads {
16
17
18static int spread_table_with_selection_compare_func(void *data, int i, int j, void *extra_data);
19static void spread_table_with_selection_swap_func(void *data, int i, int j, void *extra_data);
20
21
23{
24 T = NULL;
25 F = NULL;
26 q = 0;
27 spread_size = 0;
29 nb_lines = 0;
31 //select_spread_text = NULL;
32 select_spread = NULL;
34 //path_to_spread_tables = NULL;
35
36 spread_reps = NULL;
37 spread_reps_idx = NULL;
42 sorted_packing = NULL;
43 dual_packing = NULL;
44
45 Spread_tables = NULL;
47
48 Bitvec = NULL;
49 //bitvector_adjacency = NULL;
50 //bitvector_length = 0;
51
52 A_on_spreads = NULL;
53
54
55}
56
58{
59 if (select_spread) {
61 }
62 if (spread_reps) {
64 }
65 if (spread_reps_idx) {
67 }
70 }
71 if (sorted_packing) {
73 }
74 if (dual_packing) {
76 }
77 if (Spread_tables) {
79 }
80 if (Bitvec) {
82 }
83}
84
86 int f_select_spread,
87 std::string &select_spread_text,
88 std::string &path_to_spread_tables,
89 int verbose_level)
90{
91 int f_v = (verbose_level >= 1);
92
93 if (f_v) {
94 cout << "spread_table_with_selection::init" << endl;
95 }
96
97 if (f_select_spread) {
99 if (f_v) {
100 cout << "select_spread = ";
102 cout << endl;
103 }
104 }
105 else {
107 }
108
109
111 F = T->PA->F;
112 q = F->q;
113
115 size_of_packing = q * q + q + 1;
116 nb_lines = T->A2->degree;
117
121
122 if (f_v) {
123 cout << "spread_table_with_selection::init q=" << q << endl;
124 cout << "spread_table_with_selection::init nb_lines=" << nb_lines << endl;
125 cout << "spread_table_with_selection::init spread_size=" << spread_size << endl;
126 cout << "spread_table_with_selection::init size_of_packing=" << size_of_packing << endl;
127 }
128
129
130 if (f_select_spread) {
131 cout << "spread_table_with_selection::init selected spreads are "
132 "from the following orbits: ";
133 Int_vec_print(cout,
136 cout << endl;
137 }
138
139
141
142
143
144 if (f_v) {
145 cout << "spread_table_with_selection::init before predict_spread_table_length" << endl;
146 }
147 predict_spread_table_length(T->A, T->A->Strong_gens, verbose_level - 1);
148 if (f_v) {
149 cout << "spread_table_with_selection::init after predict_spread_table_length" << endl;
150 cout << "spread_table_with_selection::init total_nb_of_spreads = " << total_nb_of_spreads << endl;
151 }
152
154
155 if (f_v) {
156 cout << "spread_table_with_selection::init before Spread_tables->init" << endl;
157 }
158
160 FALSE /* f_load */,
163 verbose_level);
164
165 if (f_v) {
166 cout << "spread_table_with_selection::init after Spread_tables->init" << endl;
167 }
168
169 if (f_v) {
170 cout << "We will use " << nb_spread_reps << " isomorphism types of spreads, "
171 "this will give a total number of " << Spread_tables->nb_spreads
172 << " labeled spreads" << endl;
173 }
174
177
178
179 if (f_v) {
180 cout << "spread_table_with_selection::init done" << endl;
181 }
182}
183
185{
186 int f_v = (verbose_level >= 1);
187
188 if (f_v) {
189 cout << "spread_table_with_selection::compute_spread_table" << endl;
190 }
191
192
193
194
195 if (Spread_tables->files_exist(verbose_level)) {
196 if (f_v) {
197 cout << "spread_table_with_selection::compute_spread_table files exist, "
198 "reading" << endl;
199 }
200
201 Spread_tables->load(verbose_level);
202
203 if (f_v) {
204 cout << "spread_table_with_selection::compute_spread_table "
205 "after Spread_tables->load" << endl;
206 }
207 }
208 else {
209
210 if (f_v) {
211 cout << "spread_table_with_selection::compute_spread_table "
212 "files do not exist, computing the spread table" << endl;
213 }
214
215 if (f_v) {
216 cout << "spread_table_with_selection::compute_spread_table "
217 "before compute_spread_table_from_scratch" << endl;
218 }
219 compute_spread_table_from_scratch(verbose_level - 1);
220 if (f_v) {
221 cout << "spread_table_with_selection::compute_spread_table "
222 "after compute_spread_table_from_scratch" << endl;
223 }
224 }
225
226
227 if (f_v) {
228 cout << "spread_table_with_selection::compute_spread_table before create_action_on_spreads" << endl;
229 }
230 create_action_on_spreads(verbose_level);
231 if (f_v) {
232 cout << "spread_table_with_selection::compute_spread_table after create_action_on_spreads" << endl;
233 }
234
235 if (f_v) {
236 cout << "spread_table_with_selection::compute_spread_table done" << endl;
237 }
238}
239
241{
242 int f_v = (verbose_level >= 1);
243
244 if (f_v) {
245 cout << "spread_table_with_selection::compute_spread_table_from_scratch" << endl;
246 }
247
248 int i, j;
249 long int **Sets;
250 int nb_spreads;
251 int *Prev;
252 int *Label;
253 int *First;
254 int *Len;
255 int *isomorphism_type_of_spread;
256 long int *Spread_table;
258
259
260 nb_spreads = Spread_tables->nb_spreads;
261
262 if (f_v) {
263 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
264 "before make_spread_table" << endl;
265 }
266
267
269 T->A, T->A2, T->A->Strong_gens,
270 Sets,
271 Prev, Label, First, Len,
272 isomorphism_type_of_spread,
273 verbose_level);
274
275 // does not sort the spread table
276
277
278 if (f_v) {
279 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
280 "after make_spread_table" << endl;
281 }
282
283
284 if (f_v) {
285 cout << "spread_table_with_selection::compute_spread_table_from_scratch before "
286 "sorting spread table of size " << total_nb_of_spreads << endl;
287 }
288 tmp_isomorphism_type_of_spread = isomorphism_type_of_spread;
289
290 // for packing_swap_func
291
292 int *original_position;
293 int *original_position_inv;
294
295 if (f_v) {
296 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
297 "before NEW_int(total_nb_of_spreads)" << endl;
298 }
299
300
301 original_position = NEW_int(total_nb_of_spreads);
302 original_position_inv = NEW_int(total_nb_of_spreads);
303 for (i = 0; i < total_nb_of_spreads; i++) {
304 original_position[i] = i;
305 }
306
307 if (f_v) {
308 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
309 "before Sorting.Heapsort_general_with_log" << endl;
310 }
311 Sorting.Heapsort_general_with_log(Sets, original_position, total_nb_of_spreads,
312 spread_table_with_selection_compare_func,
313 spread_table_with_selection_swap_func,
314 this);
315 if (f_v) {
316 cout << "spread_table_with_selection::compute_spread_table_from_scratch after "
317 "sorting spread table of size " << total_nb_of_spreads << endl;
318 }
319 for (i = 0; i < total_nb_of_spreads; i++) {
320 j = original_position[i];
321 original_position_inv[j] = i;
322 }
323
324 Spread_table = NEW_lint(nb_spreads * spread_size);
325 for (i = 0; i < nb_spreads; i++) {
326 Lint_vec_copy(Sets[i], Spread_table + i * spread_size, spread_size);
327 }
328
329 if (f_v) {
330 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
331 "before Spread_tables->init" << endl;
332 }
333
336 verbose_level);
337
338 if (f_v) {
339 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
340 "after Spread_tables->init" << endl;
341 }
342
343
344 if (f_v) {
345 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
346 "before Spread_tables->init_spread_table" << endl;
347 }
348
350 Spread_table, isomorphism_type_of_spread,
351 verbose_level);
352
353 if (f_v) {
354 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
355 "after Spread_tables->init_spread_table" << endl;
356 }
357
358 long int *Dual_spread_idx;
359 long int *self_dual_spread_idx;
360 int nb_self_dual_spreads;
361
362 if (f_v) {
363 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
364 "before Spread_tables->compute_dual_spreads" << endl;
365 }
367 Dual_spread_idx,
368 self_dual_spread_idx,
369 nb_self_dual_spreads,
370 verbose_level);
371 if (f_v) {
372 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
373 "after Spread_tables->compute_dual_spreads" << endl;
374 }
375
376
377 if (f_v) {
378 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
379 "before Spread_tables->init_tables" << endl;
380 }
381
382 Spread_tables->init_tables(nb_spreads,
383 Spread_table, isomorphism_type_of_spread,
384 Dual_spread_idx,
385 self_dual_spread_idx, nb_self_dual_spreads,
386 verbose_level);
387
388 if (f_v) {
389 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
390 "after Spread_tables->init_tables" << endl;
391 }
392
393
394 if (f_v) {
395 cout << "spread_table_with_selection::compute_spread_table_from_scratch preparing schreier_table" << endl;
396 }
397
398 int *schreier_table;
399
400 schreier_table = NEW_int(nb_spreads * 4);
401 for (i = 0; i < nb_spreads; i++) {
402 schreier_table[i * 4 + 0] = original_position[i];
403 schreier_table[i * 4 + 1] = original_position_inv[i];
404 schreier_table[i * 4 + 2] = Prev[i];
405 schreier_table[i * 4 + 3] = Label[i];
406 }
407
408 FREE_int(Prev);
409 FREE_int(Label);
410 FREE_int(First);
411 FREE_int(Len);
412
413
414 if (f_v) {
415 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
416 "before Spread_tables->init_schreier_table" << endl;
417 }
418 Spread_tables->init_schreier_table(schreier_table, verbose_level);
419
420 if (f_v) {
421 cout << "spread_table_with_selection::compute_spread_table_from_scratch before Spread_tables->save" << endl;
422 }
423
424 Spread_tables->save(verbose_level);
425
426#if 1
427 if (nb_spreads < 10000) {
428 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
429 "We are computing the adjacency matrix" << endl;
430 compute_adjacency_matrix(verbose_level - 1);
431 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
432 "The adjacency matrix has been computed" << endl;
433 }
434 else {
435 cout << "spread_table_with_selection::compute_spread_table_from_scratch "
436 "We are NOT computing the adjacency matrix" << endl;
437 }
438#endif
439
440
441 for (i = 0; i < nb_spreads; i++) {
442 FREE_lint(Sets[i]);
443 }
444 FREE_plint(Sets);
445
446 if (f_v) {
447 cout << "spread_table_with_selection::compute_spread_table_from_scratch done" << endl;
448 }
449}
450
452{
453 int f_v = (verbose_level >= 1);
454
455 if (f_v) {
456 cout << "spread_table_with_selection::create_action_on_spreads" << endl;
457 }
458
459 if (f_v) {
460 cout << "spread_table_with_selection::create_action_on_spreads "
461 "creating action A_on_spreads" << endl;
462 }
466 0 /* verbose_level */);
467
468 cout << "created action on spreads" << endl;
469
470 if (f_v) {
471 cout << "spread_table_with_selection::create_action_on_spreads "
472 "creating action A_on_spreads done" << endl;
473 }
474}
475
476int spread_table_with_selection::find_spread(long int *set, int verbose_level)
477{
478 int f_v = (verbose_level >= 1);
479 int idx;
480
481 if (f_v) {
482 cout << "spread_table_with_selection::find_spread" << endl;
483 }
484 if (A_on_spreads == NULL) {
485 cout << "spread_table_with_selection::find_spread A_on_spreads == NULL" << endl;
486 exit(1);
487 }
488 idx = A_on_spreads->G.on_sets->find_set(set, verbose_level);
489 return idx;
490}
491
493{
494 return Spread_tables->get_spread(spread_idx);
495}
496
498 int line1, int line2, int verbose_level)
499{
501 line1, line2, verbose_level);
502}
503
505{
506 int f_v = (verbose_level >= 1);
507 int ret = FALSE;
508 int i, a, b;
510
511 if (f_v) {
512 cout << "spread_table_with_selection::test_if_packing_is_self_dual" << endl;
513 }
514 for (i = 0; i < size_of_packing; i++) {
515 a = packing[i];
516 sorted_packing[i] = a;
517 }
519
520 for (i = 0; i < size_of_packing; i++) {
521 a = packing[i];
523 dual_packing[i] = b;
524 }
527 ret = TRUE;
528 }
529
530 if (f_v) {
531 cout << "spread_table_with_selection::test_if_packing_is_self_dual done" << endl;
532 }
533 return ret;
534}
535
536#if 0
537void packing_classify::read_spread_table(int verbose_level)
538{
539 int f_v = (verbose_level >= 1);
540 int i;
541
542 if (f_v) {
543 cout << "packing_classify::read_spread_table" << endl;
544 }
545
546 Spread_tables = NEW_OBJECT(spread_tables);
547
548 if (f_v) {
549 cout << "packing_classify::read_spread_table "
550 "before Spread_tables->init" << endl;
551 }
552
553 Spread_tables->init(F,
554 TRUE /* f_load */, nb_iso_types_of_spreads,
555 spread_tables_prefix,
556 verbose_level);
557
558 {
559 int *type;
560 set_of_sets *SoS;
561 int a, b;
562
563 Spread_tables->classify_self_dual_spreads(type,
564 SoS,
565 verbose_level);
566 cout << "the self-dual spreads belong to the "
567 "following isomorphism types:" << endl;
568 for (i = 0; i < nb_iso_types_of_spreads; i++) {
569 cout << i << " : " << type[i] << endl;
570 }
571 SoS->print();
572 for (a = 0; a < SoS->nb_sets; a++) {
573 if (SoS->Set_size[a] < 10) {
574 cout << "iso type " << a << endl;
575 lint_vec_print(cout, SoS->Sets[a], SoS->Set_size[a]);
576 cout << endl;
577 for (i = 0; i < SoS->Set_size[a]; i++) {
578 b = SoS->Sets[a][i];
579 cout << i << " : " << b << " : ";
580 lint_vec_print(cout, Spread_tables->spread_table +
581 b * spread_size, spread_size);
582 cout << endl;
583 }
584 }
585 }
586 FREE_int(type);
587 }
588
589 if (f_v) {
590 cout << "packing_classify::read_spread_table "
591 "after Spread_tables->init" << endl;
592 }
593
594
595
596 if (f_v) {
597 cout << "packing_classify::read_spread_table done" << endl;
598 }
599}
600#endif
601
604 int verbose_level)
605{
606 int f_v = (verbose_level >= 1);
607 int f_do_it, idx, no;
612
613 if (f_v) {
614 cout << "spread_table_with_selection::predict_spread_table_length" << endl;
615 }
616
617
619
620 Strong_gens->group_order(go);
621 if (f_v) {
622 cout << "spread_table_with_selection::predict_spread_table_length go = " << go << endl;
623 }
624
625
626 nb_iso_types_of_spreads = K.Spread_nb_reps(q, T->k /* dimension_of_spread_elements */);
627 if (f_v) {
628 cout << "spread_table_with_selection::predict_spread_table_length "
629 "nb_iso_types_of_spreads = " << nb_iso_types_of_spreads << endl;
630 }
631
635 nb_spread_reps = 0;
636
637
638 for (no = 0; no < nb_iso_types_of_spreads; no++) {
639
641 string stab_order;
642
644 T->k /* dimension_of_spread_elements */, no, gens, stab_order,
645 0 /*verbose_level*/);
646
647
648 f_do_it = FALSE;
649 if (f_select_spread) {
651 select_spread_nb, no, idx)) {
652 f_do_it = TRUE;
653 }
654 }
655 else {
656 f_do_it = TRUE;
657 }
658 if (f_do_it) {
659 long int *rep;
660 int sz;
661
662 rep = K.Spread_representative(q, T->k /* dimension_of_spread_elements*/, no, sz);
663 Lint_vec_copy(rep,
666
667
669
670
671 stab_go.create_from_base_10_string(stab_order);
672 //Stab->group_order(stab_go);
673
675 if (f_v) {
676 cout << "spread orbit " << no
677 << " has group order "
678 << stab_go << " orbit_length = "
680 }
681
682
685
686
687 }
688
689
690 } // next no
691
692
693
694 if (f_v) {
695 cout << "spread_table_with_selection::predict_spread_table_length done, "
696 "total_nb_of_spreads = " << total_nb_of_spreads << endl;
697 }
698}
699
700
703 groups::strong_generators *Strong_gens,
704 long int **&Sets, int *&Prev, int *&Label, int *&First, int *&Len,
705 int *&isomorphism_type_of_spread,
706 int verbose_level)
707// does not sort the table
708{
709 int f_v = (verbose_level >= 1);
710 int i, j;
711 int nb_spreads1;
713
714 if (f_v) {
715 cout << "spread_table_with_selection::make_spread_table nb_spread_reps = " << nb_spread_reps << endl;
716 cout << "spread_table_with_selection::make_spread_table total_nb_of_spreads = " << total_nb_of_spreads << endl;
717 cout << "spread_table_with_selection::make_spread_table verbose_level = " << verbose_level << endl;
718 }
722 First = NEW_int(nb_spread_reps);
723 Len = NEW_int(nb_spread_reps);
724 isomorphism_type_of_spread = NEW_int(total_nb_of_spreads);
725
726 orbit_of_sets *SetOrb;
727
729
730 for (i = 0; i < nb_spread_reps; i++) {
731
732 if (f_v) {
733 cout << "spread_table_with_selection::make_spread_table "
734 "Spread " << i << " / "
735 << nb_spread_reps << " computing orbits" << endl;
736 }
737
738
739 SetOrb[i].init(A, A2,
741 spread_size, Strong_gens->gens,
742 verbose_level);
743
744
745 if (f_v) {
746 cout << "spread_table_with_selection::make_spread_table Spread "
747 << spread_reps_idx[i] << " = " << i << " / "
748 << nb_spread_reps << " has orbit length "
749 << SetOrb[i].used_length << endl;
750 }
751
752
753 } // next i
754
755 nb_spreads1 = 0;
756
757 for (i = 0; i < nb_spread_reps; i++) {
758
759 First[i] = nb_spreads1;
760 Len[i] = SetOrb[i].used_length;
761
762 for (j = 0; j < SetOrb[i].used_length; j++) {
763
764 Sets[nb_spreads1] = NEW_lint(spread_size);
765
766 Lint_vec_copy(SetOrb[i].Sets[j], Sets[nb_spreads1], spread_size);
767
768 Prev[nb_spreads1] = First[i] + SetOrb[i].Extra[j * 2 + 0];
769 Label[nb_spreads1] = SetOrb[i].Extra[j * 2 + 1];
770
771 isomorphism_type_of_spread[nb_spreads1] = i;
772
773
774 nb_spreads1++;
775
776 } // next j
777 } // next i
778
779 if (f_v) {
780 cout << "spread_table_with_selection::make_spread_table We found "
781 << nb_spreads1 << " spreads in total" << endl;
782 }
783
784 if (nb_spreads1 != total_nb_of_spreads) {
785 cout << "spread_table_with_selection::make_spread_table "
786 "nb_spreads1 != total_nb_of_spreads" << endl;
787 exit(1);
788 }
789
790 FREE_OBJECTS(SetOrb);
791
792#if 0
793 if (f_v) {
794 cout << "spread_table_with_selection::make_spread_table before "
795 "sorting spread table of size " << total_nb_of_spreads << endl;
796 }
797 tmp_isomorphism_type_of_spread = isomorphism_type_of_spread;
798 // for packing_swap_func
800 packing_spread_compare_func,
801 packing_swap_func,
802 this);
803 if (f_v) {
804 cout << "spread_table_with_selection::make_spread_table after "
805 "sorting spread table of size " << total_nb_of_spreads << endl;
806 }
807#endif
808
809
810 if (FALSE) {
811 cout << "spread_table_with_selection::make_spread_table "
812 "The labeled spreads are:" << endl;
813 for (i = 0; i < total_nb_of_spreads; i++) {
814 cout << i << " : ";
815 Lint_vec_print(cout, Sets[i], spread_size /* + 1*/);
816 cout << endl;
817 }
818 }
819
820 if (f_v) {
821 cout << "spread_table_with_selection::make_spread_table done" << endl;
822 }
823}
824
826 long int *&points_covered_by_starter,
827 int &nb_points_covered_by_starter,
828 long int *starter, int starter_size,
829 int verbose_level)
830// points_covered_by_starter are the lines that
831// are contained in the spreads chosen for the starter
832{
833 int f_v = (verbose_level >= 1);
834 int i, j;
835 long int a, s;
836
837 if (f_v) {
838 cout << "spread_table_with_selection::compute_covered_points" << endl;
839 }
840 points_covered_by_starter = NEW_lint(starter_size * spread_size);
841 for (i = 0; i < starter_size; i++) {
842 s = starter[i];
843 for (j = 0; j < spread_size; j++) {
845 points_covered_by_starter[i * spread_size + j] = a;
846 }
847 }
848#if 0
849 cout << "covered lines:" << endl;
850 int_vec_print(cout, covered_lines, starter_size * spread_size);
851 cout << endl;
852#endif
853 if (f_v) {
854 cout << "spread_table_with_selection::compute_covered_points done" << endl;
855 }
856}
857
859 long int *&free_points2, int &nb_free_points2, long int *&free_point_idx,
860 long int *points_covered_by_starter,
861 int nb_points_covered_by_starter,
862 long int *starter, int starter_size,
863 int verbose_level)
864// free_points2 are actually the free lines,
865// i.e., the lines that are not
866// yet part of the partial packing
867{
868 int f_v = (verbose_level >= 1);
869 int i, a;
870
871 if (f_v) {
872 cout << "spread_table_with_selection::compute_free_points2" << endl;
873 }
874 free_point_idx = NEW_lint(nb_lines);
875 free_points2 = NEW_lint(nb_lines);
876 for (i = 0; i < nb_lines; i++) {
877 free_point_idx[i] = 0;
878 }
879 for (i = 0; i < starter_size * spread_size; i++) {
880 a = points_covered_by_starter[i];
881 free_point_idx[a] = -1;
882 }
883 nb_free_points2 = 0;
884 for (i = 0; i < nb_lines; i++) {
885 if (free_point_idx[i] == 0) {
886 free_points2[nb_free_points2] = i;
887 free_point_idx[i] = nb_free_points2;
888 nb_free_points2++;
889 }
890 }
891#if 0
892 cout << "free points2:" << endl;
893 int_vec_print(cout, free_points2, nb_free_points2);
894 cout << endl;
895#endif
896 if (f_v) {
897 cout << "spread_table_with_selection::compute_free_points2 done" << endl;
898 }
899}
900
902 exact_cover *EC, int starter_case,
903 long int *&live_blocks2, int &nb_live_blocks2,
904 long int *points_covered_by_starter, int nb_points_covered_by_starter,
905 long int *starter, int starter_size,
906 int verbose_level)
907{
908 int f_v = (verbose_level >= 1);
909 int i, j;
910
911 if (f_v) {
912 cout << "spread_table_with_selection::compute_live_blocks2" << endl;
913 }
914 live_blocks2 = NEW_lint(Spread_tables->nb_spreads);
915 nb_live_blocks2 = 0;
916 for (i = 0; i < Spread_tables->nb_spreads; i++) {
917 for (j = 0; j < starter_size; j++) {
918 if (!is_adjacent(starter[j], i)) {
919 break;
920 }
921 }
922 if (j == starter_size) {
923 live_blocks2[nb_live_blocks2++] = i;
924 }
925 }
926 if (f_v) {
927 cout << "spread_table_with_selection::compute_live_blocks2 done" << endl;
928 }
929
930 if (f_v) {
931 cout << "spread_table_with_selection::compute_live_blocks2 STARTER_CASE "
932 << starter_case << " / " << EC->starter_nb_cases
933 << " : Found " << nb_live_blocks2 << " live spreads" << endl;
934 }
935}
936
938{
939 int f_v = (verbose_level >= 1);
940
941 if (f_v) {
942 cout << "spread_table_with_selection::compute_adjacency_matrix" << endl;
943 }
944
946 Bitvec,
947 verbose_level);
948
949
950 if (f_v) {
951 cout << "spread_table_with_selection::compute_adjacency_matrix done" << endl;
952 }
953}
954
955
956
958{
959 int k;
961
962 if (i == j) {
963 return FALSE;
964 }
965#if 1
966 if (Bitvec) {
967 k = Combi.ij2k(i, j, Spread_tables->nb_spreads);
968 if (Bitvec->s_i(k)) {
969 return TRUE;
970 }
971 else {
972 return FALSE;
973 }
974 }
975 else {
977 return TRUE;
978 }
979 else {
980 return FALSE;
981 }
982 }
983#else
985 return TRUE;
986 }
987 else {
988 return FALSE;
989 }
990#endif
991}
992
993
994// #############################################################################
995// global functions:
996// #############################################################################
997
998
999static int spread_table_with_selection_compare_func(void *data, int i, int j, void *extra_data)
1000{
1002 long int **Sets = (long int **) data;
1003 int ret;
1005
1006 ret = Sorting.lint_vec_compare(Sets[i], Sets[j], S->spread_size);
1007 return ret;
1008}
1009
1010static void spread_table_with_selection_swap_func(void *data, int i, int j, void *extra_data)
1011{
1012 spread_table_with_selection *S = (spread_table_with_selection *) extra_data;
1014 long int **Sets = (long int **) data;
1015 long int *p;
1016 int a;
1017
1018 p = Sets[i];
1019 Sets[i] = Sets[j];
1020 Sets[j] = p;
1021
1022 a = d[i];
1023 d[i] = d[j];
1024 d[j] = a;
1025}
1026
1027
1028
1029
1030}}}
1031
a collection of functions related to sorted vectors
int lint_vec_compare(long int *p, long int *q, int len)
Definition: sorting.cpp:2326
void Heapsort_general(void *data, int len, int(*compare_func)(void *data, int i, int j, void *extra_data), void(*swap_func)(void *data, int i, int j, void *extra_data), void *extra_data)
Definition: sorting.cpp:1806
void Heapsort_general_with_log(void *data, int *w, int len, int(*compare_func)(void *data, int i, int j, void *extra_data), void(*swap_func)(void *data, int i, int j, void *extra_data), void *extra_data)
Definition: sorting.cpp:1827
int int_vec_search_linear(int *v, int len, int a, int &idx)
Definition: sorting.cpp:686
tables with line-spreads in PG(3,q)
Definition: geometry.h:2335
void compute_adjacency_matrix(data_structures::bitvector *&Bitvec, 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)
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_schreier_table(int *schreier_table, int verbose_level)
void init_spread_table(int nb_spreads, long int *spread_table, int *spread_iso_type, int verbose_level)
provides access to pre-computed combinatorial data in encoded form
long int * Spread_representative(int q, int k, int i, int &sz)
domain to compute with objects of type longinteger
Definition: ring_theory.h:240
long int quotient_as_lint(longinteger_object &a, longinteger_object &b)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
void create_from_base_10_string(const char *str, int verbose_level)
a permutation group in a fixed action.
Definition: actions.h:99
action * create_induced_action_on_sets(int nb_sets, int set_size, long int *sets, int verbose_level)
groups::strong_generators * Strong_gens
Definition: actions.h:130
void stabilizer_of_spread_representative(int q, int k, int no, data_structures_groups::vector_ge *&gens, std::string &stab_order, int verbose_level)
Definition: action.cpp:2588
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
data_structures_groups::vector_ge * gens
Definition: groups.h:1708
void group_order(ring_theory::longinteger_object &go)
exact cover problems arising with the lifting of combinatorial objects
Definition: solver.h:27
orbit of sets using a Schreier tree, used in packing::make_spread_table
Definition: orbits.h:106
void init(actions::action *A, actions::action *A2, long int *set, int sz, data_structures_groups::vector_ge *gens, int verbose_level)
to classify spreads of PG(k-1,q) in PG(n-1,q) where k divides n
Definition: spreads.h:106
projective_geometry::projective_space_with_action * PA
Definition: spreads.h:109
spreads tables with a selection of isomorphism types
Definition: spreads.h:480
void compute_live_blocks2(exact_cover *EC, int starter_case, long int *&live_blocks2, int &nb_live_blocks2, long int *points_covered_by_starter, int nb_points_covered_by_starter, long int *starter, int starter_size, int verbose_level)
void find_spreads_containing_two_lines(std::vector< int > &v, int line1, int line2, int verbose_level)
void compute_covered_points(long int *&points_covered_by_starter, int &nb_points_covered_by_starter, long int *starter, int starter_size, int verbose_level)
void init(spread_classify *T, int f_select_spread, std::string &select_spread_text, std::string &path_to_spread_tables, int verbose_level)
void make_spread_table(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, long int **&Sets, int *&Prev, int *&Label, int *&first, int *&len, int *&isomorphism_type_of_spread, int verbose_level)
void predict_spread_table_length(actions::action *A, groups::strong_generators *Strong_gens, int verbose_level)
void compute_free_points2(long int *&free_points2, int &nb_free_points2, long int *&free_point_idx, long int *points_covered_by_starter, int nb_points_covered_by_starter, long int *starter, int starter_size, int verbose_level)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define FREE_OBJECTS(p)
Definition: foundations.h:652
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define NEW_plint(n)
Definition: foundations.h:629
#define FREE_int(p)
Definition: foundations.h:640
#define FREE_plint(p)
Definition: foundations.h:643
#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 NEW_OBJECTS(type, n)
Definition: foundations.h:639
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects
induced_actions::action_on_sets * on_sets