Orbiter 2022
Combinatorial Objects
spread_classify.cpp
Go to the documentation of this file.
1// spread_classify.cpp
2//
3// Anton Betten
4// November 17, 2009
5//
6// moved to TOP_LEVEL: November 2, 2013
7// renamed to spread.cpp from translation_plane.cpp: March 25, 2018
8// renamed spread_classify.cpp from spread.cpp: Aug 4, 2019
9//
10
11#include "orbiter.h"
12
13using namespace std;
14
15namespace orbiter {
16namespace layer5_applications {
17namespace spreads {
18
19
20#if 0
21static void spread_lifting_early_test_function(long int *S, int len,
22 long int *candidates, int nb_candidates,
23 long int *good_candidates, int &nb_good_candidates,
24 void *data, int verbose_level);
25static void spread_lifting_prepare_function_new(exact_cover *EC, int starter_case,
26 long int *candidates, int nb_candidates,
27 groups::strong_generators *Strong_gens,
28 solvers::diophant *&Dio, long int *&col_labels,
29 int &f_ruled_out,
30 int verbose_level);
31#endif
32static int starter_canonize_callback(long int *Set, int len, int *Elt,
33 void *data, int verbose_level);
34static int callback_incremental_check_function(
35 int len, long int *S,
36 void *data, int verbose_level);
37static void spread_early_test_func_callback(long int *S, int len,
38 long int *candidates, int nb_candidates,
39 long int *good_candidates, int &nb_good_candidates,
40 void *data, int verbose_level);
41
42
43
44
46{
47 PA = NULL;
48
49 Mtx = NULL;
50
51 order = 0;
52 spread_size = 0;
53 n = 0;
54 k = 0;
55 kn = 0;
56 q = 0;
57 nCkq = 0;
58 r = 0;
59 nb_pts = 0;
61 block_size = 0;
62
63
64 starter_size = 0;
65
66
67 A = NULL;
68 A2 = NULL;
69 AG = NULL;
70 Grass = NULL;
71
73 R = NULL;
74 Base_case = NULL;
75
76 Starter = NULL;
77 Starter_size = 0;
79 tmp_M1 = NULL;
80 tmp_M2 = NULL;
81 tmp_M3 = NULL;
82 tmp_M4 = NULL;
83
84 Poset = NULL;
85 gen = NULL;
86 Sing = NULL;
87 Klein = NULL;
88 O = NULL;
89
90 Nb = 0;
91 Data1 = NULL;
92 Data2 = NULL;
93}
94
96{
97 freeself();
98}
99
101{
102}
103
105{
106#if 0
107 if (A) {
108 FREE_OBJECT(A);
109 }
110#endif
111 if (A2) {
113 }
114#if 0
115 if (AG) {
117 }
118#endif
119 if (Grass) {
121 }
122
123 if (R) {
124 FREE_OBJECT(R);
125 }
126 if (Base_case) {
128 }
129 if (Starter) {
131 }
134 }
135 if (tmp_M1) {
137 }
138 if (tmp_M2) {
140 }
141 if (tmp_M3) {
143 }
144 if (tmp_M4) {
146 }
147
148
149 if (Sing) {
151 }
152 if (O) {
153 FREE_OBJECT(O);
154 }
155 if (Klein) {
157 }
158 if (Data1) {
160 }
161 if (Data2) {
163 }
164#if 0
165 if (Data3) {
166 FREE_int(Data3);
167 }
168#endif
169 null();
170}
171
174 int k,
175 int f_recoordinatize,
176 int verbose_level)
177{
178 int f_v = (verbose_level >= 1);
179 int f_vv = (verbose_level >= 2);
182
183
184 if (f_v) {
185 cout << "spread_classify::init" << endl;
186 cout << "k=" << k << endl;
187 }
188
190 //spread_classify::Control = Control;
191
193 spread_classify::A = PA->A; //LG->A_linear;
196 q = Mtx->GFq->q;
197 spread_size = (NT.i_power_j(q, n) - 1) / (NT.i_power_j(q, k) - 1);
198 order = NT.i_power_j(q, k);
199 if (f_v) {
200 cout << "spread_classify::init" << endl;
201 cout << "q=" << q << endl;
202 cout << "n=" << n << endl;
203 cout << "k=" << k << endl;
204 cout << "order=" << order << endl;
205 cout << "spread_size=" << spread_size << endl;
206 }
207
208#if 0
209 Control->f_depth = TRUE;
210 Control->depth = spread_size;
211 if (f_v) {
212 cout << "spread_classify::init" << endl;
213 cout << "Control:" << endl;
214 Control->print();
215 }
216#endif
217
218
219 kn = k * n;
220
221#if 0
222 if (k == (n >> 1)) {
224 }
225 else {
227 }
228
229 if (f_v) {
230 cout << "spread_classify::init f_recoordinatize = " << f_recoordinatize << endl;
231 }
232#endif
233
234
235
236 tmp_M1 = NEW_int(n * n);
237 tmp_M2 = NEW_int(n * n);
238 tmp_M3 = NEW_int(n * n);
239 tmp_M4 = NEW_int(n * n);
240
242
243
244
247
248#if 0
249 longinteger_object go;
250 A->Sims->group_order(go);
251 if (f_v) {
252 cout << "spread_classify::init go = " << go << endl;
253 }
254#endif
255
256
257 if (f_vv) {
258 cout << "action A created: ";
259 A->print_info();
260 }
261
262
263
265 Grass->init(n, k, Mtx->GFq, 0 /*MINIMUM(verbose_level - 1, 1)*/);
266
267 nCkq = Combi.generalized_binomial(n, k, q);
268 block_size = r = Combi.generalized_binomial(k, 1, q);
270
271 if (f_v) {
272 cout << "spread_classify::init "
273 "nCkq = {n \\choose k}_q = " << nCkq << endl;
274 cout << "spread_classify::init "
275 "r = {k \\choose 1}_q = " << r << endl;
276 cout << "spread_classify::init "
277 "nb_pts = {n \\choose 1}_q = " << nb_pts << endl;
278 }
279
280
281
282 if (f_v) {
283 cout << "spread_classify::init before AG->init" << endl;
284 }
285
286 AG->init(*A, Grass, 0 /*verbose_level - 2*/);
287
288 if (f_v) {
289 cout << "spread_classify::init after AG->init" << endl;
290 }
291
293 FALSE /*f_induce_action*/, NULL /*sims *old_G */,
294 0 /*verbose_level - 2*/);
295
296 if (f_v) {
297 cout << "spread_classify::init after "
298 "A2->induced_action_on_grassmannian" << endl;
299 }
300
301 if (f_vv) {
302 cout << "action A2 created: ";
303 A2->print_info();
304 }
305
306#if 0
308 cout << "action does not have strong generators" << endl;
309 exit(1);
310 }
311#endif
312
313
314
315 if (FALSE) {
316 int f_print_as_permutation = TRUE;
317 int f_offset = FALSE;
318 int offset = 1;
319 int f_do_it_anyway_even_for_big_degree = TRUE;
320 int f_print_cycles_of_length_one = FALSE;
321
322 cout << "printing generators for the group:" << endl;
323 A->Strong_gens->gens->print(cout, f_print_as_permutation,
324 f_offset, offset,
325 f_do_it_anyway_even_for_big_degree,
326 f_print_cycles_of_length_one);
327 }
328
329
330#if 0
331 len = gens->len;
332 for (i = 0; i < len; i++) {
333 cout << "generator " << i << ":" << endl;
334 A->element_print(gens->ith(i), cout);
335 cout << endl;
336 if (A2->degree < 150) {
337 A2->element_print_as_permutation(gens->ith(i), cout);
338 cout << endl;
339 }
340 }
341#endif
342
343
344#if 0
345 if (nb_pts < 50) {
346 print_points();
347 }
348
349
350
351 if (A2->degree < 150) {
354 }
355#endif
356
357
358 if (TRUE /*f_v*/) {
360
362 cout << "spread_classify::init The order of PGGL(n,q) is " << go << endl;
363 }
364
365
366 if (f_recoordinatize) {
367 if (f_v) {
368 cout << "spread_classify::init before recoordinatize::init" << endl;
369 }
370 //char str[1000];
371 //string fname_live_points;
372
373 //sprintf(str, "live_points_q%d", q);
374 //fname_live_points.assign(str);
375
377 R->init(n, k, Mtx->GFq, Grass, A, A2,
378 TRUE /*f_projective*/, Mtx->f_semilinear,
379 callback_incremental_check_function, (void *) this,
380 //fname_live_points,
381 verbose_level);
382
383 if (f_v) {
384 cout << "spread_classify::init before "
385 "recoordinatize::compute_starter" << endl;
386 }
388 Starter_Strong_gens, verbose_level - 10);
389
392 if (TRUE /*f_v*/) {
393 cout << "spread_classify::init The stabilizer of the "
394 "first three components has order " << go << endl;
395 }
396
398 }
399 else {
400 if (f_v) {
401 cout << "spread_classify::init we are not using "
402 "recoordinatization" << endl;
403 //exit(1);
404 }
405 Nb = Combi.generalized_binomial(n, k, q); //R->nCkq; // this makes no sense
406 }
407
408 if (f_v) {
409 cout << "spread_classify::init Nb = " << Nb << endl;
410 cout << "spread_classify::init kn = " << kn << endl;
411 cout << "spread_classify::init n = " << n << endl;
412 cout << "spread_classify::init k = " << k << endl;
413 cout << "spread_classify::init allocating Data1 and Data2" << endl;
414 }
415
417 Data2 = NEW_int(n * n);
418 //Data3 = NEW_int(n * n);
419
420
421#if 0
422 if (k == 2 && is_prime(q)) {
423 Sing = NEW_OBJECT(singer_cycle);
424 if (f_v) {
425 cout << "spread_classify::init "
426 "before singer_cycle::init" << endl;
427 }
428 Sing->init(4, F, A, A2, 0 /*verbose_level*/);
429 Sing->init_lines(0 /*verbose_level*/);
430 }
431#endif
432
433 if (k == 2 && n == 4) {
434
435 if (f_v) {
436 cout << "spread_classify::init k == 2 and n == 4, "
437 "initializing klein correspondence" << endl;
438 }
441
442 O->init(1 /* epsilon */, 6, Mtx->GFq, 0 /* verbose_level*/);
443 Klein->init(Mtx->GFq, O, 0 /* verbose_level */);
444 }
445 else {
446 if (f_v) {
447 cout << "spread_classify::init we are not "
448 "initializing klein correspondence" << endl;
449 }
450 O = NULL;
451 Klein = NULL;
452 }
453
454#if 0
455 if (f_v) {
456 cout << "spread_classify::init before init2" << endl;
457 }
458 init2(verbose_level - 1);
459 if (f_v) {
460 cout << "spread_classify::init after init2" << endl;
461 }
462#endif
463
464 if (f_v) {
465 cout << "spread_classify::init done" << endl;
466 }
467}
468
471 int verbose_level)
472{
473 int f_v = (verbose_level >= 1);
474
475 if (f_v) {
476 cout << "spread_classify::init2" << endl;
477 }
478
481 A->Strong_gens,
482 verbose_level);
484 spread_early_test_func_callback,
485 this /* void *data */,
486 verbose_level);
487
488
489 if (f_recoordinatize) {
490 if (f_v) {
491 cout << "spread_classify::init2 "
492 "before gen->initialize_with_starter" << endl;
493 }
494
496
499 Starter,
500 R->live_points,
503 this,
504 starter_canonize_callback,
505 verbose_level);
506
507
510 Base_case,
511 verbose_level - 2);
512 if (f_v) {
513 cout << "spread_classify::init2 "
514 "after gen->initialize_with_starter" << endl;
515 }
516 }
517 else {
518 if (f_v) {
519 cout << "spread_classify::init2 "
520 "before gen->initialize" << endl;
521 }
524 verbose_level - 2);
525 if (f_v) {
526 cout << "spread_classify::init2 "
527 "after gen->initialize" << endl;
528 }
529 }
530
531 //gen->f_allowed_to_show_group_elements = TRUE;
532
533
534#if 0
535 gen->f_print_function = TRUE;
536 gen->print_function = callback_spread_print;
537 gen->print_function_data = this;
538#endif
539
540
541 if (f_v) {
542 cout << "spread_classify::init2 done" << endl;
543 }
544}
545
546void spread_classify::unrank_point(int *v, long int a)
547{
549}
550
552{
553 long int a;
554
556 return a;
557}
558
559void spread_classify::unrank_subspace(int *M, long int a)
560{
561 Grass->unrank_lint_here(M, a, 0/*verbose_level - 4*/);
562}
563
565{
566 long int a;
567
568 a = Grass->rank_lint_here(M, 0 /*verbose_level*/);
569 return a;
570}
571
573{
574 int *v;
575 int i;
576
577 cout << "spread_classify::print_points" << endl;
578 v = NEW_int(n);
579 for (i = 0; i < nb_pts; i++) {
580 unrank_point(v, i);
581 cout << "point " << i << " : ";
582 Int_vec_print(cout, v, n);
583 cout << endl;
584 }
585 FREE_int(v);
586}
587
588void spread_classify::print_points(long int *pts, int len)
589{
590 int *v;
591 int h;
592 long int a;
593
594 cout << "spread_classify::print_points" << endl;
595 v = NEW_int(n);
596 for (h = 0; h < len; h++) {
597 a = pts[h];
598 unrank_point(v, a);
599 cout << "point " << h << " : " << a << " : ";
600 Int_vec_print(cout, v, n);
601 cout << endl;
602 }
603 FREE_int(v);
604}
605
607{
608 int i, j;
609 int *M;
610
611 M = NEW_int(kn);
612 for (i = 0; i < nCkq; i++) {
613 if (FALSE) {
614 cout << i << ":" << endl;
615 }
616 unrank_subspace(M, i);
617 if (FALSE) {
619 k, n, n, Mtx->GFq->log10_of_q + 1);
620 }
621 j = rank_subspace(M);
622 if (j != i) {
623 cout << "rank yields " << j << " != " << i << endl;
624 exit(1);
625 }
626 }
627 FREE_int(M);
628}
629
631{
632 int i, a, b;
633 int *M, *v, *w;
634 int *Line;
635
636 cout << "spread_classify::print_elements_and_points" << endl;
637 M = NEW_int(kn);
638 v = NEW_int(k);
639 w = NEW_int(n);
640 Line = NEW_int(r);
641 for (i = 0; i < nCkq; i++) {
642 if (FALSE) {
643 cout << i << ":" << endl;
644 }
645 unrank_subspace(M, i);
646 for (a = 0; a < r; a++) {
648 Mtx->GFq->Linear_algebra->mult_matrix_matrix(v, M, w, 1, k, n,
649 0 /* verbose_level */);
650 b = rank_point(w);
651 Line[a] = b;
652 }
653 cout << "line " << i << ":" << endl;
655 k, n, n, Mtx->GFq->log10_of_q + 1);
656 cout << "points on subspace " << i << " : ";
657 Int_vec_print(cout, Line, r);
658 cout << endl;
659 }
660 FREE_int(M);
661 FREE_int(v);
662 FREE_int(w);
663 FREE_int(Line);
664}
665
666
667
668void spread_classify::compute(int verbose_level)
669{
670 int f_v = (verbose_level >= 1);
671 int schreier_depth;
672 int f_use_invariant_subset_if_available = TRUE;
673 int f_debug = FALSE;
674 int t0;
676
677
678 if (f_v) {
679 cout << "spread_classify::compute" << endl;
680 cout << "spread_classify::compute Control->max_depth=" << gen->get_control()->depth << endl;
681 }
682 schreier_depth = gen->get_control()->depth;
683
684 if (f_v) {
685 cout << "spread_classify::compute calling generator_main" << endl;
686 }
687
688 //gen->Control->f_max_depth = TRUE;
689 //gen->Control->max_depth = starter_size;
690
691 t0 = Os.os_ticks();
692 gen->main(t0,
693 schreier_depth,
694 f_use_invariant_subset_if_available,
695 f_debug,
696 verbose_level - 1);
697
698 int length;
699
700 if (f_v) {
701 cout << "spread_classify::compute done with generator_main" << endl;
702 }
704 if (f_v) {
705 cout << "spread_classify::compute We found " << length << " orbits on "
706 << gen->get_control()->depth << "-sets of " << k
707 << "-subspaces in PG(" << n - 1 << "," << q << ")"
708 << " satisfying the partial spread condition" << endl;
709 }
710
711
712
713 if (f_v) {
714 cout << "spread_classify::compute done" << endl;
715 }
716}
717
718
719void spread_classify::early_test_func(long int *S, int len,
720 long int *candidates, int nb_candidates,
721 long int *good_candidates, int &nb_good_candidates,
722 int verbose_level)
723// for poset classification
724{
725 int f_v = (verbose_level >= 1);
726 int f_vv = (verbose_level >= 2);
727 int i0, i, j, rk;
728 int *M;
729 int *MM;
730 int *B, *base_cols;
731
732 if (f_v) {
733 cout << "spread_classify::early_test_func checking set ";
734 Lint_vec_print(cout, S, len);
735 cout << endl;
736 cout << "candidate set of size " << nb_candidates << ":" << endl;
737 Lint_vec_print(cout, candidates, nb_candidates);
738 cout << endl;
739 if (f_vv) {
740 if (nb_candidates < 100) {
741 for (i = 0; i < nb_candidates; i++) {
742 Grass->unrank_lint(candidates[i], 0/*verbose_level - 4*/);
743 cout << "candidate " << i << "="
744 << candidates[i] << ":" << endl;
746 Grass->M, k, n, n, Mtx->GFq->log10_of_q + 1);
747 }
748 }
749 else {
750 cout << "too many to print" << endl;
751 f_vv = FALSE;
752 }
753 }
754 }
755
756 if (len + 1 > spread_size) {
757 cout << "spread_classify::early_test_func len + 1 > spread_size" << endl;
758 cout << "spread_classify::early_test_func len = " << len << endl;
759 cout << "spread_classify::early_test_func spread_size = " << spread_size << endl;
760 exit(1);
761 }
762 M = Data2; // [n * n]
763 MM = Data1; // [(len + 1) * kn]
764 B = tmp_M3;
765 base_cols = tmp_M4;
766
767 for (i = 0; i < len; i++) {
768 unrank_subspace(MM + i * kn, S[i]);
769 }
770 if (f_v) {
771 for (i = 0; i < len; i++) {
772 cout << "p_" << i << "=" << S[i] << ":" << endl;
774 MM + i * k * n, k, n, n, Mtx->GFq->log10_of_q + 1);
775 }
776 }
777
778 nb_good_candidates = 0;
779 for (j = 0; j < nb_candidates; j++) {
780 Grass->unrank_lint(candidates[j], 0/*verbose_level - 4*/);
781 if (len == 0) {
782 i0 = 0;
783 }
784 else {
785 i0 = len - 1;
786 }
787 for (i = i0; i < len; i++) {
788 Int_vec_copy(MM + i * kn, M, k * n);
789 Int_vec_copy(Grass->M, M + kn, k * n);
790
791 if (f_vv) {
792 cout << "testing (p_" << i << ",candidates[" << j << "])="
793 "(" << S[i] << "," << candidates[j] << ")" << endl;
795 2 * k, n, n, Mtx->GFq->log10_of_q + 1);
796 }
798 M, 2 * k, n, B, base_cols, 0 /* verbose_level */);
799
800 if (rk < 2 * k) {
801 if (f_vv) {
802 cout << "rank is " << rk << " which is bad" << endl;
803 }
804 break;
805 }
806 else {
807 if (f_vv) {
808 cout << "rank is " << rk << " which is OK" << endl;
809 }
810 }
811 } // next i
812 if (i == len) {
813 good_candidates[nb_good_candidates++] = candidates[j];
814 }
815 } // next j
816
817 if (f_v) {
818 cout << "spread_classify::early_test_func we found " << nb_good_candidates
819 << " good candidates" << endl;
820 }
821 if (f_v) {
822 cout << "spread_classify::early_test_func done" << endl;
823 }
824}
825
826int spread_classify::check_function(int len, long int *S, int verbose_level)
827// checks all {len \choose 2} pairs. This is very inefficient.
828// This function should not be used for poset classification!
829{
830 int f_OK = TRUE;
831 int f_v = (verbose_level >= 1);
832 int f_vv = (verbose_level >= 2);
833 int i, j, rk;
834 int *M, *M1;
835 int *B, *base_cols;
836
837 if (f_v) {
838 cout << "spread_classify::check_function checking set ";
839 Lint_vec_print(cout, S, len);
840 cout << endl;
841 }
842 M1 = tmp_M1; // [kn]
843 M = tmp_M2; // [n * n]
844 B = tmp_M3;
845 base_cols = tmp_M4;
846
847 if (f_v) {
848 for (i = 0; i < len; i++) {
849 cout << "p_" << i << "=" << S[i] << ":" << endl;
850 Grass->unrank_lint(S[i], 0/*verbose_level - 4*/);
852 k, n, n, Mtx->GFq->log10_of_q + 1);
853 }
854 }
855
856 for (i = 0; i < len; i++) {
857 unrank_subspace(M1, S[i]);
858 for (j = i + 1; j < len; j++) {
859 Int_vec_copy(M1, M, kn);
860 unrank_subspace(M + kn, S[j]);
861
862 if (f_vv) {
863 cout << "testing (p_" << i << ",p_" << j << ")"
864 "=(" << S[i] << "," << S[j] << ")" << endl;
866 2 * k, n, n, Mtx->GFq->log10_of_q + 1);
867 }
869 M, 2 * k, n, B, base_cols, 0 /* verbose_level */);
870 if (rk < 2 * k) {
871 if (f_vv) {
872 cout << "rank is " << rk << " which is bad" << endl;
873 }
874 f_OK = FALSE;
875 break;
876 }
877 else {
878 if (f_vv) {
879 cout << "rank is " << rk << " which is OK" << endl;
880 }
881 }
882 }
883 if (f_OK == FALSE) {
884 break;
885 }
886 }
887
888 if (f_OK) {
889 if (f_v) {
890 cout << "OK" << endl;
891 }
892 return TRUE;
893 }
894 else {
895 if (f_v) {
896 cout << "not OK" << endl;
897 }
898 return FALSE;
899 }
900
901}
902
903int spread_classify::incremental_check_function(int len, long int *S, int verbose_level)
904// checks the pairs (0,len-1),(1,len-1),\ldots,(len-2,len-1)
905// for recoordinatize
906{
907 int f_OK = TRUE;
908 int f_v = (verbose_level >= 1);
909 int f_vv = (verbose_level >= 2);
910 int i, j, rk;
911 int *M, *M1;
912 int *B, *base_cols;
913
914 if (f_v) {
915 cout << "spread_classify::incremental_check_function checking set ";
916 Lint_vec_print(cout, S, len);
917 cout << endl;
918 }
919 if (len <= 1) {
920 f_OK = TRUE;
921 goto finish;
922 }
923 M1 = tmp_M1; // [kn]
924 M = tmp_M2; // [n * n]
925 B = tmp_M3;
926 base_cols = tmp_M4;
927
928 if (f_v) {
929 for (i = 0; i < len; i++) {
930 cout << "p_" << i << "=" << S[i] << ":" << endl;
931 Grass->unrank_lint(S[i], 0/*verbose_level - 4*/);
933 Grass->M, k, n, n, Mtx->GFq->log10_of_q + 1);
934 }
935 }
936
937 j = len - 1;
938
939 unrank_subspace(M1, S[j]);
940 for (i = 0; i < len - 1; i++) {
941 unrank_subspace(M, S[i]);
942 Int_vec_copy(M1, M + kn, kn);
943
944 if (f_vv) {
945 cout << "testing (p_" << i << ",p_" << j << ")"
946 "=(" << S[i] << "," << S[j] << ")" << endl;
948 2 * k, n, n, Mtx->GFq->log10_of_q + 1);
949 }
951 M, 2 * k, n, B, base_cols, 0 /* verbose_level */);
952 if (rk < 2 * k) {
953 if (f_vv) {
954 cout << "rank is " << rk << " which is bad" << endl;
955 }
956 f_OK = FALSE;
957 break;
958 }
959 else {
960 if (f_vv) {
961 cout << "rank is " << rk << " which is OK" << endl;
962 }
963 }
964 }
965
966finish:
967 if (f_OK) {
968 if (f_v) {
969 cout << "OK" << endl;
970 }
971 return TRUE;
972 }
973 else {
974 if (f_v) {
975 cout << "not OK" << endl;
976 }
977 return FALSE;
978 }
979
980}
981
983 exact_cover *E, int starter_case,
984 long int *candidates, int nb_candidates,
985 groups::strong_generators *Strong_gens,
986 solvers::diophant *&Dio, long int *&col_labels,
987 int &f_ruled_out,
988 int verbose_level)
989{
990 int f_v = (verbose_level >= 1);
991 int f_v3 = (verbose_level >= 3);
992
993 if (f_v) {
994 cout << "spread_classify::lifting_prepare_function_new "
995 "nb_candidates=" << nb_candidates << endl;
996 }
997
998
999 spread_lifting *SL;
1000
1002
1003 if (f_v) {
1004 cout << "spread_classify::lifting_prepare_function_new "
1005 "before SL->init" << endl;
1006 }
1007 SL->init(this, E,
1008 E->starter, E->starter_size,
1009 starter_case, E->starter_nb_cases,
1010 candidates, nb_candidates, Strong_gens,
1011 E->f_lex,
1012 verbose_level);
1013 if (f_v) {
1014 cout << "spread_classify::lifting_prepare_function_new "
1015 "after SL->init" << endl;
1016 }
1017
1018
1019 if (f_v) {
1020 cout << "spread_classify::lifting_prepare_function_new "
1021 "before SL->create_system" << endl;
1022 }
1023
1024 Dio = SL->create_system(verbose_level - 2);
1025 if (f_v) {
1026 cout << "spread_classify::lifting_prepare_function_new "
1027 "after SL->create_system" << endl;
1028 }
1029
1030 int *col_color;
1031 int nb_colors;
1032
1033 if (f_v) {
1034 cout << "spread_classify::lifting_prepare_function_new "
1035 "before SL->find_coloring" << endl;
1036 }
1037 SL->find_coloring(Dio,
1038 col_color, nb_colors,
1039 verbose_level - 2);
1040 if (f_v) {
1041 cout << "spread_classify::lifting_prepare_function_new "
1042 "after SL->find_coloring" << endl;
1043 }
1044
1045 if (f_v3) {
1046 cout << "col_color=";
1047 Int_vec_print(cout, col_color, Dio->n);
1048 cout << endl;
1049 }
1050
1052
1053 if (f_v) {
1054 cout << "spread_classify::lifting_prepare_function_new "
1055 "before Dio->make_clique_graph_adjacency_matrix" << endl;
1056 }
1057 Dio->make_clique_graph_adjacency_matrix(Adj, verbose_level - 2);
1058 if (f_v) {
1059 cout << "spread_classify::lifting_prepare_function_new "
1060 "after Dio->make_clique_graph_adjacency_matrix" << endl;
1061 }
1062
1064
1066
1067 char str[1000];
1068 string label, label_tex;
1069 sprintf(str, "graph_%d", starter_case);
1070 label.assign(str);
1071 label_tex.assign(str);
1072
1073 if (f_v) {
1074 cout << "spread_classify::lifting_prepare_function_new "
1075 "before CG->init_with_point_labels" << endl;
1076 }
1077 CG->init_with_point_labels(SL->nb_cols, nb_colors, 1,
1078 col_color,
1079 Adj, TRUE /* f_ownership_of_bitvec */,
1080 SL->col_labels /* point_labels */,
1081 label, label_tex,
1082 verbose_level);
1083 if (f_v) {
1084 cout << "spread_classify::lifting_prepare_function_new "
1085 "after CG->init_with_point_labels" << endl;
1086 }
1087
1088 string fname_clique_graph;
1090
1091 fname_clique_graph.assign(E->output_prefix);
1092 fname_clique_graph.append(str);
1093 fname_clique_graph.append(".graph");
1094
1095 CG->save(fname_clique_graph, verbose_level - 1);
1096 if (f_v) {
1097 cout << "Written file " << fname_clique_graph
1098 << " of size " << Fio.file_size(fname_clique_graph) << endl;
1099 }
1100
1101 FREE_OBJECT(CG);
1102
1103 col_labels = SL->col_labels;
1104 SL->col_labels = NULL;
1105
1106 FREE_OBJECT(SL);
1107 //FREE_uchar(Adj);
1108 FREE_int(col_color);
1109
1110 if (f_v) {
1111 cout << "spread_classify::lifting_prepare_function_new "
1112 "after SL->create_system" << endl;
1113 }
1114
1115 if (f_v) {
1116 cout << "spread_classify::lifting_prepare_function_new "
1117 "done" << endl;
1118 }
1119}
1120
1121
1122
1124 int *dual_spread, int verbose_level)
1125{
1126 int f_v = (verbose_level >= 1);
1127
1128 if (f_v) {
1129 cout << "spread_classify::compute_dual_spread" << endl;
1130 }
1131
1132 Grass->compute_dual_spread(spread, dual_spread,
1133 spread_size, verbose_level - 1);
1134
1135 if (f_v) {
1136 cout << "spread_classify::compute_dual_spread done" << endl;
1137 }
1138}
1139
1140void spread_classify::print(ostream &ost, int len, long int *S)
1141{
1142 int i;
1143 int f_elements_exponential = FALSE;
1144 string symbol_for_print;
1145
1146 symbol_for_print.assign("\\alpha");
1147 if (len == 0) {
1148 return;
1149 }
1150 for (i = 0; i < len; i++) {
1151 ost << "$S_{" << i + 1 << "}$ has rank " << S[i]
1152 << " and is generated by\\\\" << endl;
1153 Grass->unrank_lint(S[i], 0);
1154 ost << "$$" << endl;
1155 ost << "\\left[" << endl;
1156 Mtx->GFq->latex_matrix(ost, f_elements_exponential, symbol_for_print,
1157 Grass->M, k, n);
1158 ost << "\\right]" << endl;
1159 ost << "$$" << endl << endl;
1160 }
1161
1162}
1163
1164
1165// #############################################################################
1166// global functions:
1167// #############################################################################
1168
1169#if 0
1170static void spread_lifting_early_test_function(long int *S, int len,
1171 long int *candidates, int nb_candidates,
1172 long int *good_candidates, int &nb_good_candidates,
1173 void *data, int verbose_level)
1174{
1175 spread_classify *Spread = (spread_classify *) data;
1176 int f_v = (verbose_level >= 1);
1177
1178 if (f_v) {
1179 cout << "spread_lifting_early_test_function for set ";
1180 Lint_vec_print(cout, S, len);
1181 cout << endl;
1182 }
1183 Spread->early_test_func(S, len,
1184 candidates, nb_candidates,
1185 good_candidates, nb_good_candidates,
1186 verbose_level - 2);
1187 if (f_v) {
1188 cout << "spread_lifting_early_test_function done" << endl;
1189 }
1190}
1191
1192static void spread_lifting_prepare_function_new(
1193 exact_cover *EC, int starter_case,
1194 long int *candidates, int nb_candidates,
1195 groups::strong_generators *Strong_gens,
1196 solvers::diophant *&Dio, long int *&col_labels,
1197 int &f_ruled_out,
1198 int verbose_level)
1199{
1200 int f_v = (verbose_level >= 1);
1201 spread_classify *Spread = (spread_classify *) EC->user_data;
1202
1203 if (f_v) {
1204 cout << "spread_lifting_prepare_function_new "
1205 "nb_candidates=" << nb_candidates << endl;
1206 }
1207
1208 Spread->lifting_prepare_function_new(EC, starter_case,
1209 candidates, nb_candidates, Strong_gens,
1210 Dio, col_labels, f_ruled_out,
1211 verbose_level);
1212
1213
1214 if (f_v) {
1215 cout << "spread_lifting_prepare_function_new "
1216 "after lifting_prepare_function_new" << endl;
1217 }
1218
1219 if (f_v) {
1220 cout << "spread_lifting_prepare_function_new "
1221 "nb_rows=" << Dio->m
1222 << " nb_cols=" << Dio->n << endl;
1223 }
1224
1225 if (f_v) {
1226 cout << "spread_lifting_prepare_function_new "
1227 "done" << endl;
1228 }
1229}
1230#endif
1231
1232
1233
1234
1235static int starter_canonize_callback(long int *Set, int len,
1236 int *Elt, void *data, int verbose_level)
1237// for starter, interface to recoordinatize,
1238// which uses callback_incremental_check_function
1239{
1240 spread_classify *Spread = (spread_classify *) data;
1241 int f_v = (verbose_level >= 1);
1242 int f_vv = (verbose_level >= 2);
1243
1244 if (f_v) {
1245 cout << "starter_canonize_callback" << endl;
1246 }
1247 Spread->R->do_recoordinatize(Set[0], Set[1], Set[2], verbose_level - 2);
1248 Spread->A->element_move(Spread->R->Elt, Elt, FALSE);
1249 if (f_v) {
1250 cout << "starter_canonize_callback done" << endl;
1251 }
1252 if (f_vv) {
1253 cout << "transporter:" << endl;
1254 Spread->A->element_print(Elt, cout);
1255 }
1256 return TRUE;
1257}
1258
1259static int callback_incremental_check_function(
1260 int len, long int *S, void *data, int verbose_level)
1261// for recoordinatize
1262{
1263 spread_classify *Spread = (spread_classify *) data;
1264 int ret;
1265
1266 ret = Spread->incremental_check_function(len, S, verbose_level);
1267 return ret;
1268}
1269
1270static void spread_early_test_func_callback(long int *S, int len,
1271 long int *candidates, int nb_candidates,
1272 long int *good_candidates, int &nb_good_candidates,
1273 void *data, int verbose_level)
1274{
1275 spread_classify *T = (spread_classify *) data;
1276 int f_v = (verbose_level >= 1);
1277
1278 if (f_v) {
1279 cout << "spread_early_test_func_callback for set ";
1280 Lint_vec_print(cout, S, len);
1281 cout << endl;
1282 }
1283 T->early_test_func(S, len,
1284 candidates, nb_candidates,
1285 good_candidates, nb_good_candidates,
1286 verbose_level - 2);
1287 if (f_v) {
1288 cout << "spread_early_test_func_callback done" << endl;
1289 }
1290}
1291
1292}}}
1293
1294
1295
1296
compact storage of 0/1-data as bitvectors
void PG_element_unrank_modified(int *v, int stride, int len, int a)
void PG_element_unrank_modified_lint(int *v, int stride, int len, long int a)
void latex_matrix(std::ostream &f, int f_elements_exponential, std::string &symbol_for_print, int *M, int m, int n)
void PG_element_rank_modified_lint(int *v, int stride, int len, long int &a)
to rank and unrank subspaces of a fixed dimension in F_q^n
Definition: geometry.h:892
void unrank_lint(long int rk, int verbose_level)
Definition: grassmann.cpp:343
long int rank_lint_here(int *Mtx, int verbose_level)
Definition: grassmann.cpp:275
void compute_dual_spread(int *spread, int *dual_spread, int spread_size, int verbose_level)
Definition: grassmann.cpp:1143
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
void init(int n, int k, field_theory::finite_field *F, int verbose_level)
Definition: grassmann.cpp:70
the Klein correspondence between lines in PG(3,q) and points on the Klein quadric
Definition: geometry.h:1353
void init(field_theory::finite_field *F, orthogonal_geometry::orthogonal *O, int verbose_level)
void init_with_point_labels(int nb_points, int nb_colors, int nb_colors_per_vertex, int *colors, data_structures::bitvector *Bitvec, int f_ownership_of_bitvec, long int *point_labels, std::string &label, std::string &label_tex, int verbose_level)
void save(std::string &fname, int verbose_level)
int rank_of_rectangular_matrix_memory_given(int *A, int m, int n, int *B, int *base_cols, int verbose_level)
void mult_matrix_matrix(int *A, int *B, int *C, int m, int n, int o, int verbose_level)
void init(int epsilon, int n, field_theory::finite_field *F, int verbose_level)
Definition: orthogonal.cpp:312
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
diophantine systems of equations (i.e., linear systems over the integers)
Definition: solvers.h:209
void make_clique_graph_adjacency_matrix(data_structures::bitvector *&Adj, int verbose_level)
Definition: diophant.cpp:4430
a permutation group in a fixed action.
Definition: actions.h:99
void element_print(void *elt, std::ostream &ost)
Definition: action_cb.cpp:347
groups::strong_generators * Strong_gens
Definition: actions.h:130
action * induced_action_on_grassmannian(int k, int verbose_level)
groups::matrix_group * get_matrix_group()
Definition: action.cpp:2986
void element_print_as_permutation(void *elt, std::ostream &ost)
Definition: action_cb.cpp:421
void group_order(ring_theory::longinteger_object &go)
Definition: sims.cpp:951
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)
induced action on the grassmannian (subspaces of a fixed dimension of a vectors space)
void init(actions::action &A, geometry::grassmann *G, int verbose_level)
exact cover problems arising with the lifting of combinatorial objects
Definition: solver.h:27
represents a known classification with constructive recognition, to be used as base case for poset_cl...
void init(poset_with_group_action *Poset, int size, long int *orbit_rep, long int *live_points, int nb_live_points, groups::strong_generators *Stab_gens, void *recognition_function_data, int(*recognition_function)(long int *Set, int len, int *Elt, void *data, int verbose_level), int verbose_level)
to control the behavior of the poset classification algorithm
void initialize_and_allocate_root_node(poset_classification_control *PC_control, poset_with_group_action *Poset, int depth, int verbose_level)
int main(int t0, int schreier_depth, int f_use_invariant_subset_if_available, int f_debug, int verbose_level)
void initialize_with_base_case(poset_classification_control *PC_control, poset_with_group_action *Poset, int depth, classification_base_case *Base_case, int verbose_level)
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void add_testing_without_group(void(*func)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level), void *data, int verbose_level)
void init(int n, field_theory::finite_field *F, actions::action *A, actions::action *A2, int verbose_level)
projective space PG(n,q) with automorphism group PGGL(n+1,q)
three skew lines in PG(3,q), used to classify spreads
Definition: spreads.h:24
void compute_starter(long int *&S, int &size, groups::strong_generators *&Strong_gens, int verbose_level)
void init(int n, int k, field_theory::finite_field *F, geometry::grassmann *Grass, actions::action *A, actions::action *A2, int f_projective, int f_semilinear, int(*check_function_incremental)(int len, long int *S, void *data, int verbose_level), void *check_function_incremental_data, int verbose_level)
to classify spreads of PG(k-1,q) in PG(n-1,q) where k divides n
Definition: spreads.h:106
poset_classification::poset_with_group_action * Poset
Definition: spreads.h:153
poset_classification::poset_classification * gen
Definition: spreads.h:154
groups::strong_generators * Starter_Strong_gens
Definition: spreads.h:145
void init(projective_geometry::projective_space_with_action *PA, int k, int f_recoordinatize, int verbose_level)
void print(std::ostream &ost, int len, long int *S)
void lifting_prepare_function_new(exact_cover *E, int starter_case, long int *candidates, int nb_candidates, groups::strong_generators *Strong_gens, solvers::diophant *&Dio, long int *&col_labels, int &f_ruled_out, int verbose_level)
int incremental_check_function(int len, long int *S, int verbose_level)
induced_actions::action_on_grassmannian * AG
Definition: spreads.h:133
void early_test_func(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, int verbose_level)
int check_function(int len, long int *S, int verbose_level)
void init2(poset_classification::poset_classification_control *Control, int verbose_level)
layer1_foundations::orthogonal_geometry::orthogonal * O
Definition: spreads.h:162
projective_geometry::projective_space_with_action * PA
Definition: spreads.h:109
geometry::klein_correspondence * Klein
Definition: spreads.h:161
poset_classification::classification_base_case * Base_case
Definition: spreads.h:140
void compute_dual_spread(int *spread, int *dual_spread, int verbose_level)
creates spreads from partial spreads using class exact_cover
Definition: spreads.h:342
solvers::diophant * create_system(int verbose_level)
void find_coloring(solvers::diophant *Dio, int *&col_color, int &nb_colors, int verbose_level)
void init(spread_classify *S, exact_cover *E, long int *starter, int starter_size, int starter_case_number, int starter_number_of_cases, long int *candidates, int nb_candidates, groups::strong_generators *Strong_gens, int f_lex, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#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 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_copy(A, B, C)
Definition: foundations.h:693
#define FREE_lint(p)
Definition: foundations.h:642
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects