Orbiter 2022
Combinatorial Objects
action.cpp
Go to the documentation of this file.
1// action.cpp
2//
3// Anton Betten
4// July 8, 2003
5
7#include "group_actions.h"
8
9
10using namespace std;
11
12
13namespace orbiter {
14namespace layer3_group_actions {
15namespace actions {
16
17
18
20{
22
23 null();
24}
25
27{
28 freeself();
29}
30
32{
33 //label[0] = 0;
34 //label_tex[0] = 0;
35
36 //user_data_type = 0;
38
39 subaction = NULL;
41 Strong_gens = NULL;
42 //strong_generators = NULL;
43
44
45 //transversal_reps = NULL;
46
48
49 degree = 0;
51 dimension = 0;
52
54
55 Stabilizer_chain = NULL;
56
57
58
61 //group_prefix[0] = 0;
62 //f_has_transversal_reps = FALSE;
66
67 ptr = NULL;
68
74}
75
77{
78 //int i;
79 int f_v = FALSE;
80 int f_vv = FALSE;
81
82 if (f_v) {
83 cout << "action::freeself deleting action " << label << endl;
84 print_info();
85 }
86 if (f_allocated) {
87 if (f_vv) {
88 cout << "action::freeself freeing G of type ";
89
92 cout << endl;
93 }
94 if (type_G == matrix_group_t) {
95 if (f_vv) {
96 cout << "action::freeself freeing G.matrix_grp" << endl;
97 cout << "G.matrix_grp=" << G.matrix_grp << endl;
98 }
100 if (f_vv) {
101 cout << "action::~action freeing G.matrix_grp finished"
102 << endl;
103 }
104 G.matrix_grp = NULL;
105 }
106 else if (type_G == wreath_product_t) {
107 if (f_vv) {
108 cout << "action::freeself freeing "
109 "G.wreath_product_group" << endl;
110 cout << "G.wreath_product_group="
111 << G.wreath_product_group << endl;
112 }
114 if (f_vv) {
115 cout << "action::freeself freeing "
116 "G.wreath_product_group finished" << endl;
117 }
118 G.wreath_product_group = NULL;
119 }
120 else if (type_G == perm_group_t) {
121 if (f_vv) {
122 cout << "action::freeself freeing G.perm_group_t" << endl;
123 }
125 if (f_vv) {
126 cout << "action::freeself freeing G.perm_group_t finished"
127 << endl;
128 }
129 G.perm_grp = NULL;
130 }
131 else if (type_G == action_on_sets_t) {
132 if (f_vv) {
133 cout << "action::freeself freeing G.on_sets" << endl;
134 cout << "G.on_sets=" << G.on_sets << endl;
135 }
137 if (f_vv) {
138 cout << "action::freeself freeing G.on_sets finished" << endl;
139 }
140 G.on_sets = NULL;
141 }
143 if (f_vv) {
144 cout << "action::freeself freeing G.OnSetPartitions" << endl;
145 cout << "G.OnSetPartitions=" << G.OnSetPartitions << endl;
146 }
148 if (f_vv) {
149 cout << "action::freeself freeing G.OnSetPartitions finished" << endl;
150 }
151 G.OnSetPartitions = NULL;
152 }
153 else if (type_G == action_on_k_subsets_t) {
154 if (f_vv) {
155 cout << "action::freeself freeing G.on_sets" << endl;
156 cout << "G.on_k_subsets=" << G.on_k_subsets << endl;
157 }
159 if (f_vv) {
160 cout << "action::freeself freeing G.on_k_subsets finished"
161 << endl;
162 }
163 G.on_k_subsets = NULL;
164 }
165 else if (type_G == action_on_orbits_t) {
166 if (f_vv) {
167 cout << "action::freeself freeing G.OnOrbits" << endl;
168 cout << "G.OnOrbits=" << G.OnOrbits << endl;
169 }
171 if (f_vv) {
172 cout << "action::freeself freeing G.OnOrbits finished" << endl;
173 }
174 G.OnOrbits = NULL;
175 }
176 else if (type_G == action_on_bricks_t) {
177 if (f_vv) {
178 cout << "action::freeself freeing G.OnBricks" << endl;
179 cout << "G.OnBricks=" << G.OnBricks << endl;
180 }
182 if (f_vv) {
183 cout << "action::freeself freeing G.OnBricks finished" << endl;
184 }
185 G.OnBricks = NULL;
186 }
187 else if (type_G == action_on_andre_t) {
188 if (f_vv) {
189 cout << "action::freeself freeing G.OnAndre" << endl;
190 cout << "G.OnAndre=" << G.OnAndre << endl;
191 }
193 if (f_vv) {
194 cout << "action::freeself freeing G.OnAndre finished" << endl;
195 }
196 G.OnAndre = NULL;
197 }
199 if (f_vv) {
200 cout << "action::freeself freeing G.ABRM" << endl;
201 }
203 G.ABRM = NULL;
204 }
205 else if (type_G == action_by_restriction_t) {
206 if (f_vv) {
207 cout << "action::freeself freeing G.ABR" << endl;
208 }
210 G.ABR = NULL;
211 }
212 else if (type_G == action_by_conjugation_t) {
213 if (f_vv) {
214 cout << "action::freeself freeing G.ABC" << endl;
215 }
217 G.ABC = NULL;
218 }
220 if (f_vv) {
221 cout << "action::freeself freeing G.Rep" << endl;
222 }
224 G.Rep = NULL;
225 }
226 else if (type_G == action_on_determinant_t) {
227 if (f_vv) {
228 cout << "action::freeself freeing G.AD" << endl;
229 }
231 G.AD = NULL;
232 }
233 else if (type_G == action_on_galois_group_t) {
234 if (f_vv) {
235 cout << "action::freeself freeing G.on_Galois_group" << endl;
236 }
238 G.on_Galois_group = NULL;
239 }
240 else if (type_G == action_on_sign_t) {
241 if (f_vv) {
242 cout << "action::freeself freeing G.OnSign" << endl;
243 }
245 G.OnSign = NULL;
246 }
247 else if (type_G == action_on_grassmannian_t) {
248 if (f_vv) {
249 cout << "action::freeself freeing G.AG" << endl;
250 }
252 G.AG = NULL;
253 }
254 else if (type_G == action_on_factor_space_t) {
255 if (f_vv) {
256 cout << "action::freeself freeing G.AF" << endl;
257 }
259 G.AF = NULL;
260 }
261 else if (type_G == action_on_wedge_product_t) {
262 //FREE_OBJECT(G.AW);
263 G.AW = NULL;
264 }
266 if (f_vv) {
267 cout << "action::freeself freeing G.OnHP" << endl;
268 }
270 G.OnHP = NULL;
271 }
273 if (f_vv) {
274 cout << "action::freeself freeing G.SubfieldStructure" << endl;
275 }
277 G.SubfieldStructure = NULL;
278 }
279 else {
280 cout << "action::freeself don't know "
281 "how to free the object; action type is ";
283 cout << endl;
284 exit(1);
285 }
288 }
289 if (f_v) {
290 cout << "action::freeself after freeing G " << endl;
291 }
292
293 if (Stabilizer_chain) {
295 }
296
297 if (f_v) {
298 cout << "action::freeself after free_base_data" << endl;
299 }
300
301
302 if (f_v) {
303 cout << "action::freeself after freeing transversal reps" << endl;
304 }
305
307
308 if (f_v) {
309 cout << "action::freeself after free_element_data" << endl;
310 }
311
313 if (f_v) {
314 cout << "we are freeing strong generators" << endl;
315 }
317 Strong_gens = NULL;
318 //FREE_OBJECT(strong_generators); //delete strong_generators;
319 //FREE_int(tl);
320 //strong_generators = NULL;
321 //tl = NULL;
323 }
324
325 if (f_v) {
326 cout << "action::freeself after freeing strong generators" << endl;
327 }
328
330 if (f_v) {
331 cout << "subaction is allocated, so we free it" << endl;
333 }
335 subaction = NULL;
338 }
339
340 if (f_v) {
341 cout << "action::freeself after freeing subaction" << endl;
342 }
343
344 if (f_has_sims) {
345 if (f_v) {
346 cout << "action::freeself freeing Sims" << endl;
347 }
349 Sims = NULL;
351 if (f_v) {
352 cout << "action::freeself freeing Sims finished" << endl;
353 }
354 }
355
356 if (f_v) {
357 cout << "action::freeself after freeing sims" << endl;
358 }
359
360 if (f_has_kernel) {
361 if (f_v) {
362 cout << "action::freeself freeing Kernel" << endl;
363 }
365 Kernel = NULL;
367 if (f_v) {
368 cout << "action::freeself freeing Kernel finished" << endl;
369 }
370 }
371
372 if (ptr) {
374 }
375
376 if (f_v) {
377 cout << "action::freeself "
378 "deleting action " << label << " done" << endl;
379 }
380}
381
383{
384 if (Stabilizer_chain) {
386 }
387 else {
388 return FALSE;
389 }
390}
391
392
394{
395 if (Stabilizer_chain) {
397 }
398 else {
399 cout << "action::base_len Stabilizer_chain == NULL" << endl;
400 exit(1);
401 //return 0;
402 }
403}
404
405void action::set_base_len(int base_len)
406{
407 if (Stabilizer_chain) {
409 }
410 else {
411 cout << "action::set_base_len no stabilizer chain" << endl;
412 }
413
414}
415
416long int &action::base_i(int i)
417{
418 if (Stabilizer_chain) {
419 return Stabilizer_chain->base_i(i);
420 }
421 else {
422 cout << "action::base_i no Stabilizer_chain" << endl;
423 exit(1);
424 }
425}
426
428{
429 if (Stabilizer_chain) {
430 return Stabilizer_chain->get_base();
431 }
432 else {
433 cout << "action::get_base no Stabilizer_chain" << endl;
434 exit(1);
435 }
436}
437
439{
440 if (Stabilizer_chain) {
442 }
443 else {
444 cout << "action::transversal_length_i no Stabilizer_chain" << endl;
445 exit(1);
446 }
447}
448
450{
451 if (Stabilizer_chain) {
453 }
454 else {
455 cout << "action::transversal_length no Stabilizer_chain" << endl;
456 exit(1);
457 }
458}
459
460long int &action::orbit_ij(int i, int j)
461{
462 if (Stabilizer_chain) {
463 return Stabilizer_chain->orbit_ij(i, j);
464 }
465 else {
466 cout << "action::orbit_ij no Stabilizer_chain" << endl;
467 exit(1);
468 }
469}
470
471long int &action::orbit_inv_ij(int i, int j)
472{
473 if (Stabilizer_chain) {
474 return Stabilizer_chain->orbit_inv_ij(i, j);
475 }
476 else {
477 cout << "action::orbit_inv_ij no Stabilizer_chain" << endl;
478 exit(1);
479 }
480}
481
482
483
485{
486 Elt1 = Elt2 = Elt3 = Elt4 = Elt5 = NULL;
487 eltrk1 = eltrk2 = eltrk3 = NULL;
488 elt_mult_apply = NULL;
489 elt1 = NULL;
491}
492
494{
495 Elt1 = Elt2 = Elt3 = Elt4 = Elt5 = NULL;
496 eltrk1 = eltrk2 = eltrk3 = NULL;
497 elt_mult_apply = NULL;
498 elt1 = NULL;
510}
511
513{
514 if (Elt1) {
515 FREE_int(Elt1);
516 }
517 if (Elt2) {
518 FREE_int(Elt2);
519 }
520 if (Elt3) {
521 FREE_int(Elt3);
522 }
523 if (Elt4) {
524 FREE_int(Elt4);
525 }
526 if (Elt5) {
527 FREE_int(Elt5);
528 }
529 if (eltrk1) {
531 }
532 if (eltrk2) {
534 }
535 if (eltrk3) {
537 }
538 if (elt_mult_apply) {
540 }
541 if (elt1) {
543 }
546 }
548}
549
550
551
552// #############################################################################
553
554
555int action::find_non_fixed_point(void *elt, int verbose_level)
556{
557 int f_v = (verbose_level >= 1);
558 int i, j;
559
560 if (f_v) {
561 cout << "action::find_non_fixed_point" << endl;
562 cout << "degree=" << degree << endl;
563 }
564 for (i = 0; i < degree; i++) {
565 j = element_image_of(i, elt, verbose_level - 1);
566 if (j != i) {
567 if (f_v) {
568 cout << "moves " << i << " to " << j << endl;
569 }
570 return i;
571 }
572 }
573 if (f_v) {
574 cout << "cannot find non fixed point" << endl;
575 }
576 return -1;
577}
578
580 int *fixed_points, int verbose_level)
581{
582 int f_v = (verbose_level >= 1);
583 int i, j, n = 0;
584
585 if (f_v) {
586 cout << "computing fixed points in action "
587 << label << " of degree " << degree << endl;
588 }
589 for (i = 0; i < degree; i++) {
590 j = element_image_of(i, elt, 0);
591 if (j == i) {
592 fixed_points[n++] = i;
593 }
594 }
595 if (f_v) {
596 cout << "found " << n << " fixed points" << endl;
597 }
598 return n;
599}
600
601int action::count_fixed_points(void *elt, int verbose_level)
602{
603 int f_v = (verbose_level >= 1);
604 int i, j, cnt = 0;
605
606 if (f_v) {
607 cout << "action::count_fixed_points counting fixed points in action "
608 << label << " of degree " << degree << endl;
609 }
610 for (i = 0; i < degree; i++) {
611 j = element_image_of(i, elt, 0);
612 if (j == i) {
613 cnt++;
614 }
615 }
616 if (f_v) {
617 cout << "action::count_fixed_points done, found " << cnt << " fixed points" << endl;
618 }
619 return cnt;
620}
621
623 int size, long int *set, int verbose_level)
624{
625 long int *set1, *set2;
626 int i, cmp;
627 int f_v = (verbose_level >= 1);
629
630 if (f_v) {
631 cout << "action::test_if_set_stabilizes" << endl;
632 }
633 set1 = NEW_lint(size);
634 set2 = NEW_lint(size);
635 for (i = 0; i < size; i++) {
636 set1[i] = set[i];
637 }
638 Sorting.lint_vec_quicksort_increasingly(set1, size);
639 map_a_set(set1, set2, size, Elt, 0);
640 Sorting.lint_vec_quicksort_increasingly(set2, size);
641 cmp = Sorting.lint_vec_compare(set1, set2, size);
642 if (f_v) {
643 cout << "the elements takes " << endl;
644 Lint_vec_print(cout, set1, size);
645 cout << endl << "to" << endl;
646 Lint_vec_print(cout, set2, size);
647 cout << endl;
648 cout << "cmp = " << cmp << endl;
649 }
650 FREE_lint(set1);
651 FREE_lint(set2);
652 if (cmp == 0) {
653 if (f_v) {
654 cout << "action::test_if_set_stabilizes "
655 "done, returning TRUE" << endl;
656 }
657 return TRUE;
658 }
659 else {
660 if (f_v) {
661 cout << "action::test_if_set_stabilizes "
662 "done, returning FALSE" << endl;
663 }
664 return FALSE;
665 }
666}
667
668void action::map_a_set(long int *set,
669 long int *image_set, int n, int *Elt, int verbose_level)
670{
671 int f_v = (verbose_level >= 1);
672 int f_vv = (verbose_level >= 2);
673 int i;
674
675 if (f_v) {
676 cout << "action::map_a_set" << endl;
677 }
678 if (f_vv) {
679 cout << "group element:" << endl;
680 element_print_quick(Elt, cout);
681 cout << endl;
682 cout << "set: " << endl;
683 Lint_vec_print(cout, set, n);
684 cout << endl;
685 }
686 for (i = 0; i < n; i++) {
687 if (f_vv) {
688 cout << "i=" << i << " computing image of " << set[i] << endl;
689 }
690 image_set[i] = element_image_of(set[i], Elt, verbose_level - 2);
691 if (f_vv) {
692 cout << "i=" << i << " image of "
693 << set[i] << " is " << image_set[i] << endl;
694 }
695 }
696}
697
699 long int *image_set, int n, int *Elt, int verbose_level)
700{
702
703 map_a_set(set, image_set, n, Elt, verbose_level);
704 Sorting.lint_vec_heapsort(image_set, n);
705}
706
707
708
709void action::init_sims_only(groups::sims *G, int verbose_level)
710{
711 int f_v = (verbose_level >= 1);
712 //int i, k;
713
714 if (f_v) {
715 cout << "action::init_sims_only action " << label
716 << " base_len = " << base_len() << endl;
717 }
718 if (f_has_sims) {
720 Sims = NULL;
722 }
723 if (G->A != this) {
724 cout << "action::init_sims_only action " << label
725 << " sims object has different action "
726 << G->A->label << endl;
727 exit(1);
728 }
729 Sims = G;
731 Stabilizer_chain->init_base_from_sims(G, verbose_level);
732
733#if 0
734 if (f_v) {
735 cout << "action::init_sims_only action " << label
736 << " before compute_strong_generators_from_sims" << endl;
737 }
738 compute_strong_generators_from_sims(0/*verbose_level - 2*/);
739 if (f_v) {
740 cout << "action::init_sims_only action " << label
741 << " after compute_strong_generators_from_sims" << endl;
742 }
743#endif
744
745 if (f_v) {
746 cout << "action::init_sims_only done" << endl;
747 }
748}
749
751{
752 int f_v = (verbose_level >= 1);
753
754 if (f_v) {
755 cout << "action::compute_strong_generators_from_sims" << endl;
756 }
757 if (!f_has_sims) {
758 cout << "action::compute_strong_generators_from_sims need sims" << endl;
759 exit(1);
760 }
763 Strong_gens = NULL;
765 }
767 Strong_gens->init_from_sims(Sims, verbose_level - 2);
769 if (f_v) {
770 cout << "action::compute_strong_generators_from_sims done" << endl;
771 }
772}
773
774int action::element_has_order_two(int *E1, int verbose_level)
775{
776 int f_v = (verbose_level >= 1);
777 int ret;
778
779 if (f_v) {
780 cout << "action::element_has_order_two" << endl;
781 }
782
783 element_mult(E1, E1, Elt1, 0);
784 if (is_one(Elt1)) {
785 ret = TRUE;
786 }
787 else {
788 ret = FALSE;
789 }
790
791 if (f_v) {
792 cout << "action::element_has_order_two done" << endl;
793 }
794 return ret;
795}
796
798 int *E2, int verbose_level)
799{
800 int f_v = (verbose_level >= 1);
801 int ret;
802
803 if (f_v) {
804 cout << "action::product_has_order_two" << endl;
805 }
806
807 element_mult(E1, E2, Elt1, 0);
809 if (is_one(Elt2)) {
810 ret = TRUE;
811 }
812 else {
813 ret = FALSE;
814 }
815
816 if (f_v) {
817 cout << "action::product_has_order_two done" << endl;
818 }
819 return ret;
820}
821
823 int *E2, int verbose_level)
824{
825 int f_v = (verbose_level >= 1);
826 int ret;
827
828 if (f_v) {
829 cout << "action::product_has_order_three" << endl;
830 }
831
832 element_mult(E1, E2, Elt1, 0);
835 if (is_one(Elt3)) {
836 ret = TRUE;
837 }
838 else {
839 ret = FALSE;
840 }
841
842 if (f_v) {
843 cout << "action::product_has_order_three done" << endl;
844 }
845 return ret;
846}
847
849{
850 int *cycle_type;
851 int order;
852
853 cycle_type = NEW_int(degree);
855 elt, cycle_type, 0);
856 FREE_int(cycle_type);
857 return order;
858}
859
861 void *elt, int *cycle_type)
862{
864 elt, cycle_type, 0);
865}
866
868 void *elt, int *cycle_type, int verbose_level)
869// cycle_type[i - 1] is the number of cycle of length i for 1 le i le n
870{
871 int f_v = (verbose_level >= 1);
872 int f_vv = (verbose_level >= 2);
873 int *have_seen;
874 long int l, l1, first, next, len, g, n, order = 1;
876
877 if (f_v) {
878 cout << "action::element_order_verbose" << endl;
879 }
880 if (f_vv) {
881 cout << "The element is:" << endl;
882 element_print_quick(elt, cout);
883 cout << "as permutation:" << endl;
885 }
886 n = degree;
887 Int_vec_zero(cycle_type, degree);
888 have_seen = NEW_int(n);
889 for (l = 0; l < n; l++) {
890 have_seen[l] = FALSE;
891 }
892 l = 0;
893 while (l < n) {
894 if (have_seen[l]) {
895 l++;
896 continue;
897 }
898 // work on cycle, starting with l:
899 first = l;
900 l1 = l;
901 len = 1;
902 while (TRUE) {
903 have_seen[l1] = TRUE;
904 next = element_image_of(l1, elt, 0);
905 if (next > n) {
906 cout << "action::element_order_verbose: next = "
907 << next << " > n = " << n << endl;
908 // print_list(ost);
909 exit(1);
910 }
911 if (next == first) {
912 break;
913 }
914 if (have_seen[next]) {
915 cout << "action::element_order_verbose "
916 "have_seen[next]" << endl;
917 exit(1);
918 }
919 l1 = next;
920 len++;
921 }
922 cycle_type[len - 1]++;
923 if (len == 1) {
924 continue;
925 }
926 g = NT.gcd_lint(len, order);
927 order *= len / g;
928 }
929 FREE_int(have_seen);
930 if (f_v) {
931 cout << "action::element_order_verbose "
932 "done order=" << order << endl;
933 }
934 return order;
935}
936
938// returns the order of the element if o == 0
939// if o != 0, returns the order of the element provided it divides o,
940// 0 otherwise.
941{
942 int *have_seen;
943 long int l, l1, first, next, len, g, n, order = 1;
945
946 n = degree;
947 have_seen = NEW_int(n);
948 for (l = 0; l < n; l++) {
949 have_seen[l] = FALSE;
950 }
951 l = 0;
952 while (l < n) {
953 if (have_seen[l]) {
954 l++;
955 continue;
956 }
957 // work on cycle, starting with l:
958 first = l;
959 l1 = l;
960 len = 1;
961 while (TRUE) {
962 have_seen[l1] = TRUE;
963 next = element_image_of(l1, elt, 0);
964 if (next > n) {
965 cout << "perm_print(): next = "
966 << next << " > n = " << n << endl;
967 // print_list(ost);
968 exit(1);
969 }
970 if (next == first) {
971 break;
972 }
973 if (have_seen[next]) {
974 cout << "action::element_order_if_divisor_of(): "
975 "have_seen[next]" << endl;
976 exit(1);
977 }
978 l1 = next;
979 len++;
980 }
981 if (len == 1) {
982 continue;
983 }
984 if (o && (o % len)) {
985 FREE_int(have_seen);
986 return 0;
987 }
988 g = NT.gcd_lint(len, order);
989 order *= len / g;
990 }
991 FREE_int(have_seen);
992 return order;
993}
994
996 data_structures_groups::vector_ge &gens, int verbose_level)
997{
998 int f_v = (verbose_level >= 1);
999
1000 if (f_v) {
1001 cout << "action::compute_all_point_orbits" << endl;
1002 }
1003 S.init(this, verbose_level - 2);
1004 S.init_generators(gens, verbose_level - 2);
1005 S.compute_all_point_orbits(verbose_level - 1);
1006 if (f_v) {
1007 cout << "action::compute_all_point_orbits done" << endl;
1008 }
1009}
1010
1012// the index of the first moved base point
1013{
1014 int i, j, b;
1015
1016 for (i = 0; i < base_len(); i++) {
1017 b = base_i(i);
1018 j = element_image_of(b, Elt, 0);
1019 if (j != b) {
1020 return i;
1021 }
1022 }
1023 return base_len();
1024}
1025
1027 data_structures_groups::vector_ge &gen, int verbose_level)
1028// all strong generators that leave base points 0,..., depth - 1 fix
1029{
1030 int i, j, l, n;
1031
1032 l = Strong_gens->gens->len;
1033 gen.init(this, verbose_level - 2);
1034 gen.allocate(l, verbose_level - 2);
1035 n = 0;
1036 for (i = 0; i < l; i++) {
1038 if (j >= depth) {
1039 gen.copy_in(n, Strong_gens->gens->ith(i));
1040 n++;
1041 }
1042 }
1043 gen.len = n;
1044}
1045
1048 groups::sims *S, int *sequence, int len, int verbose_level)
1049// S points to len + 1 many sims objects
1050{
1051 int f_v = (verbose_level >= 1);
1052 int f_vv = (verbose_level >= 2);
1053 int f_vvv = (verbose_level >= 3);
1054 int i;
1055
1056 if (f_v) {
1057 cout << "action::compute_point_stabilizer_chain for sequence ";
1058 Int_vec_print(cout, sequence, len);
1059 cout << endl;
1060 }
1061 for (i = 0; i <= len; i++) {
1062 S[i].init(this, verbose_level - 2);
1063 }
1064 S[0].init_generators(gen, 0);
1065 S[0].compute_base_orbits(0 /*verbose_level - 1*/);
1066 if (f_vv) {
1067 cout << "automorphism group has order ";
1068 S[0].print_group_order(cout);
1069 cout << endl;
1070 if (f_vvv) {
1071 cout << "generators:" << endl;
1072 S[0].print_generators();
1073 }
1074 }
1075
1076 for (i = 0; i < len; i++) {
1077 if (f_vv) {
1078 cout << "computing stabilizer of " << i
1079 << "-th point in the sequence" << endl;
1080 }
1082 S[i + 1], sequence[i], 0 /*verbose_level - 2*/);
1083 if (f_vv) {
1084 cout << "stabilizer of " << i << "-th point "
1085 << sequence[i] << " has order ";
1086 S[i + 1].print_group_order(cout);
1087 cout << endl;
1088 if (f_vvv) {
1089 cout << "generators:" << endl;
1090 S[i + 1].print_generators();
1091 }
1092 }
1093 }
1094 if (f_v) {
1095 cout << "action::compute_point_stabilizer_chain for sequence ";
1096 Int_vec_print(cout, sequence, len);
1097 cout << " finished" << endl;
1098 cout << "i : order of i-th stabilizer" << endl;
1099 for (i = 0; i <= len; i++) {
1100 cout << i << " : ";
1101 S[i].print_group_order(cout);
1102 cout << endl;
1103 }
1104 if (f_vv) {
1105 for (i = 0; i <= len; i++) {
1106 cout << i << " : ";
1107 cout << "generators:" << endl;
1108 S[i].print_generators();
1109 }
1110 }
1111 }
1112}
1113
1115 data_structures_groups::vector_ge &strong_generators,
1116 int pt, int *orbit, int verbose_level)
1117{
1118 int f_v = (verbose_level >= 1);
1119 groups::schreier Schreier;
1120 int len, i, f;
1121
1122 if (f_v) {
1123 cout << "action::compute_orbit_of_point: "
1124 "computing orbit of point " << pt << endl;
1125 }
1126 Schreier.init(this, verbose_level - 2);
1127 Schreier.init_generators(strong_generators, verbose_level - 2);
1128 Schreier.compute_point_orbit(pt, 0);
1129 f = Schreier.orbit_first[0];
1130 len = Schreier.orbit_len[0];
1131 for (i = 0; i < len; i++) {
1132 orbit[i] = Schreier.orbit[f + i];
1133 }
1134 return len;
1135}
1136
1138 int *gen_handle, int pt, int *orbit, int verbose_level)
1139{
1140 //int f_v = (verbose_level >= 1);
1142 int i;
1143
1144 gens.init(this, verbose_level - 2);
1145 gens.allocate(nb_gen, verbose_level - 2);
1146 for (i = 0; i < nb_gen; i++) {
1147 element_retrieve(gen_handle[i], gens.ith(i), 0);
1148 }
1149 return compute_orbit_of_point(gens, pt, orbit, verbose_level);
1150}
1151
1152
1154 data_structures_groups::vector_ge &strong_generators,
1155 int pt, int *transporter, int verbose_level)
1156{
1157 int f_v = (verbose_level >= 1);
1158 groups::schreier Schreier;
1159 int len, image, pos, i;
1160
1161 if (f_v) {
1162 cout << "action::least_image_of_point: "
1163 "computing least image of " << pt << endl;
1164 }
1165 Schreier.init(this, verbose_level - 2);
1166 Schreier.init_generators(strong_generators, verbose_level - 2);
1167 Schreier.compute_point_orbit(pt, 0);
1168 len = Schreier.orbit_len[0];
1169 image = orbiter_kernel_system::Orbiter->Int_vec->minimum(Schreier.orbit, len);
1170 pos = Schreier.orbit_inv[image];
1171 Schreier.coset_rep(pos, 0 /* verbose_level */);
1172 element_move(Schreier.cosetrep, transporter, 0);
1173 // we check it:
1174 i = element_image_of(pt, transporter, 0);
1175 if (i != image) {
1176 cout << "action::least_image_of_point i != image" << endl;
1177 exit(1);
1178 }
1179 if (f_v) {
1180 cout << "action::least_image_of_point: "
1181 "least image of " << pt << " is " << image << endl;
1182 }
1183 return image;
1184}
1185
1187 std::vector<int> &gen_handle,
1188 int pt, int *transporter, int verbose_level)
1189{
1190 //int f_v = (verbose_level >= 1);
1192 int i;
1193 int nb_gen;
1194
1195 nb_gen = gen_handle.size();
1196
1197 if (nb_gen == 0) {
1198 element_one(transporter, 0);
1199 return pt;
1200 }
1201 gens.init(this, verbose_level - 2);
1202 gens.allocate(nb_gen, verbose_level - 2);
1203 for (i = 0; i < nb_gen; i++) {
1204 element_retrieve(gen_handle[i], gens.ith(i), 0);
1205 }
1206 return least_image_of_point(gens, pt, transporter, verbose_level);
1207}
1208
1210 int nb_gen, int *gen_handle,
1211 int pt, int *transporter, int verbose_level)
1212{
1213 //int f_v = (verbose_level >= 1);
1215 int i;
1216
1217 if (nb_gen == 0) {
1218 element_one(transporter, 0);
1219 return pt;
1220 }
1221 gens.init(this, verbose_level - 2);
1222 gens.allocate(nb_gen, verbose_level - 2);
1223 for (i = 0; i < nb_gen; i++) {
1224 element_retrieve(gen_handle[i], gens.ith(i), 0);
1225 }
1226 return least_image_of_point(gens, pt, transporter, verbose_level);
1227}
1228
1229void action::all_point_orbits(groups::schreier &Schreier, int verbose_level)
1230{
1231 int f_v = (verbose_level >= 1);
1232
1233 if (f_v) {
1234 cout << "action::all_point_orbits" << endl;
1235 }
1236 Schreier.init(this, verbose_level - 2);
1238 cout << "action::all_point_orbits !f_has_strong_generators" << endl;
1239 exit(1);
1240 }
1241 Schreier.init_generators(*Strong_gens->gens /* *strong_generators */, verbose_level - 2);
1242 if (f_v) {
1243 cout << "action::all_point_orbits before Schreier.compute_all_point_orbits" << endl;
1244 }
1245 Schreier.compute_all_point_orbits(verbose_level);
1246 if (f_v) {
1247 cout << "action::all_point_orbits after Schreier.compute_all_point_orbits" << endl;
1248 }
1249 if (f_v) {
1250 cout << "action::all_point_orbits done" << endl;
1251 }
1252}
1253
1256 int verbose_level)
1257{
1258 int f_v = (verbose_level >= 1);
1259
1260 if (f_v) {
1261 cout << "action::all_point_orbits_from_generators" << endl;
1262 }
1263 Schreier.init(this, verbose_level - 2);
1264 Schreier.init_generators(*SG->gens /* *strong_generators */, verbose_level - 2);
1265 Schreier.compute_all_point_orbits(verbose_level);
1266}
1267
1269 int *Elt,
1270 int verbose_level)
1271{
1272 int f_v = (verbose_level >= 1);
1273
1274 if (f_v) {
1275 cout << "action::all_point_orbits_from_single_generator" << endl;
1276 }
1278
1279 gens.init(this, verbose_level - 2);
1280 gens.allocate(1, verbose_level - 2);
1281 element_move(Elt, gens.ith(0), 0);
1282
1283 Schreier.init(this, verbose_level - 2);
1284 Schreier.init_generators(gens, verbose_level - 2);
1285 if (f_v) {
1286 cout << "action::all_point_orbits_from_single_generator before Schreier.compute_all_point_orbits" << endl;
1287 }
1288 Schreier.compute_all_point_orbits(verbose_level);
1289 if (f_v) {
1290 cout << "action::all_point_orbits_from_single_generator after Schreier.compute_all_point_orbits" << endl;
1291 }
1292 if (f_v) {
1293 cout << "action::all_point_orbits_from_single_generator done" << endl;
1294 }
1295}
1296
1298 int verbose_level)
1299{
1300 int f_v = (verbose_level >= 1);
1301 int f_vv = (verbose_level >= 2);
1302 //int f_vvv = (verbose_level >= 3);
1303 int i;
1305
1306 if (f_v) {
1307 cout << "action::compute_stabilizer_orbits" << endl;
1308 cout << "base_len = " << base_len() << endl;
1309 for (i = 0; i < base_len(); i++) {
1310 cout << i << " : " << base_i(i) << " : " << transversal_length_i(i);
1311 //int_vec_print(cout, Stabilizer_chain->orbit[i], Stabilizer_chain->transversal_length[i]);
1312 cout << endl;
1313 }
1314 cout << "degree = " << degree << endl;
1315 }
1317 // where is this freed??? in backtrack.cpp
1318
1319 for (i = 0; i < base_len(); i++) {
1320 strong_generators_at_depth(i, gen, verbose_level - 2);
1321 if (FALSE) {
1322 cout << "level " << i << " found "
1323 << gen.len << " strong generators" << endl;
1324 }
1325 if (FALSE) {
1326 gen.print(cout);
1327 }
1328
1330 groups::schreier Schreier;
1331
1332
1333 S = &Staborbits[i];
1334 S->allocate(degree, FALSE);
1335
1336 if (FALSE) {
1337 cout << "computing point orbits" << endl;
1338 }
1339
1340 compute_all_point_orbits(Schreier, gen, 0 /*verbose_level - 2*/);
1341
1342 if (FALSE) {
1343 Schreier.print(cout);
1344 }
1345
1346 Schreier.get_orbit_partition(*S, 0 /*verbose_level - 2*/);
1347 if (FALSE) {
1348 cout << "found " << S->ht << " orbits" << endl;
1349 }
1350 if (f_vv) {
1351 cout << "level " << i << " with "
1352 << gen.len << " strong generators : ";
1353 //cout << "orbit partition at level " << i << ":" << endl;
1354 S->print(cout);
1355 }
1356
1357 }
1358 if (f_v) {
1359 cout << "action::compute_stabilizer_orbits finished" << endl;
1360 }
1361}
1362
1363
1365 int size, long int *set, int verbose_level)
1366{
1367 int i, a, b, idx;
1368 long int *ordered_set;
1369 int f_v = (verbose_level >= 1);
1371
1372 ordered_set = NEW_lint(size);
1373 for (i = 0; i < size; i++) {
1374 ordered_set[i] = set[i];
1375 }
1376 Sorting.lint_vec_heapsort(ordered_set, size);
1377 for (i = 0; i < size; i++) {
1378 a = ordered_set[i];
1379 b = element_image_of(a, Elt, 0);
1380 if (!Sorting.lint_vec_search(ordered_set, size, b, idx, 0)) {
1381 if (f_v) {
1382 cout << "action::check_if_in_set_stabilizer fails" << endl;
1383 cout << "set: ";
1384 Lint_vec_print(cout, set, size);
1385 cout << endl;
1386 cout << "ordered_set: ";
1387 Lint_vec_print(cout, ordered_set, size);
1388 cout << endl;
1389 cout << "image of " << i << "-th element "
1390 << a << " is " << b
1391 << " is not found" << endl;
1392 }
1393 FREE_lint(ordered_set);
1394 return FALSE;
1395 }
1396 }
1397 FREE_lint(ordered_set);
1398 return TRUE;
1399
1400}
1401
1403 int size, long int *set1, long int *set2, int verbose_level)
1404{
1405 int i, a, b, idx;
1406 long int *ordered_set2;
1407 int f_v = (verbose_level >= 1);
1408 int f_vv = (verbose_level >= 4);
1410
1411 if (f_vv) {
1412 cout << "action::check_if_transporter_for_set "
1413 "size=" << size << endl;
1414 Lint_vec_print(cout, set1, size);
1415 cout << endl;
1416 Lint_vec_print(cout, set2, size);
1417 cout << endl;
1418 element_print(Elt, cout);
1419 cout << endl;
1420 }
1421 ordered_set2 = NEW_lint(size);
1422 for (i = 0; i < size; i++) {
1423 ordered_set2[i] = set2[i];
1424 }
1425 Sorting.lint_vec_heapsort(ordered_set2, size);
1426 if (f_vv) {
1427 cout << "sorted target set:" << endl;
1428 Lint_vec_print(cout, ordered_set2, size);
1429 cout << endl;
1430 }
1431 for (i = 0; i < size; i++) {
1432 a = set1[i];
1433 if (FALSE) {
1434 cout << "i=" << i << " a=" << a << endl;
1435 }
1436 b = element_image_of(a, Elt, 0);
1437 if (FALSE) {
1438 cout << "i=" << i << " a=" << a << " b=" << b << endl;
1439 }
1440 if (!Sorting.lint_vec_search(ordered_set2, size, b, idx, 0)) {
1441 if (f_v) {
1442 cout << "action::check_if_transporter_for_set fails" << endl;
1443 cout << "set1 : ";
1444 Lint_vec_print(cout, set1, size);
1445 cout << endl;
1446 cout << "set2 : ";
1447 Lint_vec_print(cout, set2, size);
1448 cout << endl;
1449 cout << "ordered: ";
1450 Lint_vec_print(cout, ordered_set2, size);
1451 cout << endl;
1452 cout << "image of " << i << "-th element "
1453 << a << " is " << b
1454 << " is not found" << endl;
1455 }
1456 FREE_lint(ordered_set2);
1457 return FALSE;
1458 }
1459 }
1460 FREE_lint(ordered_set2);
1461 return TRUE;
1462
1463}
1464
1467 int size, long int *set,
1468 int &nb_sets, long int **&Sets, int **&Transporter,
1469 int verbose_level)
1470{
1471 int f_v = (verbose_level >= 1);
1472 long int *image_set;
1473 long int **New_Sets;
1474 int **New_Transporter;
1475 int nb_finished, allocated_nb_sets;
1476 int new_allocated_nb_sets, nb_gens, i, j, h;
1478
1479 if (f_v) {
1480 cout << "action::compute_set_orbit: ";
1481 Lint_vec_print(cout, set, size);
1482 cout << endl;
1483 }
1484 nb_gens = gens.len;
1485
1486 allocated_nb_sets = 100;
1487 Sets = NEW_plint(allocated_nb_sets);
1488 Transporter = NEW_pint(allocated_nb_sets);
1489 nb_sets = 0;
1490
1491 image_set = NEW_lint(size);
1492 Sets[0] = NEW_lint(size);
1493 for (i = 0; i < size; i++) {
1494 Sets[0][i] = set[i];
1495 }
1496 Sorting.lint_vec_heapsort(Sets[0], size);
1497
1498 Transporter[0] = NEW_int(elt_size_in_int);
1499 element_one(Transporter[0], FALSE);
1500
1501 nb_sets = 1;
1502 nb_finished = 0;
1503
1504 while (nb_finished < nb_sets) {
1505 if (f_v) {
1506 cout << "nb_finished=" << nb_finished
1507 << " nb_sets=" << nb_sets << endl;
1508 }
1509 for (i = 0; i < nb_gens; i++) {
1510 map_a_set_and_reorder(Sets[nb_finished], image_set, size,
1511 gens.ith(i), 0);
1512 if (FALSE) {
1513 cout << "image under generator " << i << ":";
1514 Lint_vec_print(cout, image_set, size);
1515 cout << endl;
1516 }
1517 for (j = 0; j < nb_sets; j++) {
1518 if (Sorting.lint_vec_compare(Sets[j], image_set, size) == 0) {
1519 break;
1520 }
1521 }
1522 if (j < nb_sets) {
1523 continue;
1524 }
1525 // n e w set found:
1526 if (f_v) {
1527 cout << "n e w set " << nb_sets << ":";
1528 Lint_vec_print(cout, image_set, size);
1529 cout << endl;
1530 }
1531 Sets[nb_sets] = image_set;
1532 image_set = NEW_lint(size);
1533 Transporter[nb_sets] = NEW_int(elt_size_in_int);
1534 element_mult(Transporter[nb_finished],
1535 gens.ith(i), Transporter[nb_sets], 0);
1536 nb_sets++;
1537 if (nb_sets == allocated_nb_sets) {
1538 new_allocated_nb_sets = allocated_nb_sets + 100;
1539 cout << "reallocating to size "
1540 << new_allocated_nb_sets << endl;
1541 New_Sets = NEW_plint(new_allocated_nb_sets);
1542 New_Transporter = NEW_pint(new_allocated_nb_sets);
1543 for (h = 0; h < nb_sets; h++) {
1544 New_Sets[h] = Sets[h];
1545 New_Transporter[h] = Transporter[h];
1546 }
1547 FREE_plint(Sets);
1548 FREE_pint(Transporter);
1549 Sets = New_Sets;
1550 Transporter = New_Transporter;
1551 allocated_nb_sets = new_allocated_nb_sets;
1552 }
1553 } // next i
1554 nb_finished++;
1555 }
1556 FREE_lint(image_set);
1557 if (f_v) {
1558 cout << "action::compute_set_orbit "
1559 "found an orbit of size " << nb_sets << endl;
1560 for (i = 0; i < nb_sets; i++) {
1561 cout << i << " : ";
1562 Lint_vec_print(cout, Sets[i], size);
1563 cout << endl;
1564 element_print(Transporter[i], cout);
1565 }
1566 }
1567}
1568
1569void action::delete_set_orbit(int nb_sets, long int **Sets, int **Transporter)
1570{
1571 int i;
1572
1573 for (i = 0; i < nb_sets; i++) {
1574 FREE_lint(Sets[i]);
1575 FREE_int(Transporter[i]);
1576 }
1577 FREE_plint(Sets);
1578 FREE_pint(Transporter);
1579}
1580
1582 long int *minimal_set, int *transporter, int verbose_level)
1583{
1584 int f_v = (verbose_level >= 1);
1585 long int **Sets;
1586 int **Transporter;
1587 int nb_sets, i;
1588 int min_set;
1590
1591 if (f_v) {
1592 cout << "action::compute_minimal_set" << endl;
1593 }
1594
1595
1596 compute_set_orbit(gens, size, set,
1597 nb_sets, Sets, Transporter, verbose_level);
1598
1599 min_set = 0;
1600 for (i = 1; i < nb_sets; i++) {
1601 if (Sorting.lint_vec_compare(Sets[i], Sets[min_set], size) < 0) {
1602 min_set = i;
1603 }
1604 }
1605 for (i = 0; i < size; i++) {
1606 minimal_set[i] = Sets[min_set][i];
1607 }
1608 element_move(Transporter[min_set], transporter, 0);
1609 delete_set_orbit(nb_sets, Sets, Transporter);
1610}
1611
1613 int base_len, long int *the_base, int level,
1615 data_structures_groups::vector_ge &subset_of_gens,
1616 int verbose_level)
1617{
1618 int nb_generators_found;
1619 int *gen_idx;
1620 int nb_gens, i, j, bj, bj_image;
1621 int f_v = (verbose_level >= 1);
1622 int f_vv = (verbose_level >= 2);
1623
1624 if (f_v) {
1625 cout << "action::find_strong_generators_at_level "
1626 "level=" << level << " base: ";
1627 Lint_vec_print(cout, the_base, base_len);
1628 cout << endl;
1629 }
1630 nb_gens = gens.len;
1631 gen_idx = NEW_int(gens.len);
1632
1633 nb_generators_found = 0;
1634 for (i = 0; i < nb_gens; i++) {
1635 for (j = 0; j < level; j++) {
1636 bj = the_base[j];
1637 bj_image = element_image_of(bj, gens.ith(i), 0);
1638 if (bj_image != bj) {
1639 break;
1640 }
1641 }
1642 if (j == level) {
1643 gen_idx[nb_generators_found++] = i;
1644 }
1645 }
1646 subset_of_gens.init(this, verbose_level - 2);
1647 subset_of_gens.allocate(nb_generators_found, verbose_level - 2);
1648 for (i = 0; i < nb_generators_found; i++) {
1649 j = gen_idx[i];
1650 element_move(gens.ith(j), subset_of_gens.ith(i), 0);
1651 }
1652 FREE_int(gen_idx);
1653 if (f_v) {
1654 cout << "action::find_strong_generators_at_level found "
1655 << nb_generators_found << " strong generators" << endl;
1656 if (f_vv) {
1657 subset_of_gens.print(cout);
1658 cout << endl;
1659 }
1660 }
1661}
1662
1663
1665 int *Elt, groups::sims *S, int *data, int verbose_level)
1666{
1667 int f_v = (verbose_level >= 1);
1668 int *base_image;
1669 int i, a;
1670
1671 if (f_v) {
1672 cout << "action::make_element_from_permutation_representation" << endl;
1673 }
1674 base_image = NEW_int(base_len());
1675 for (i = 0; i < base_len(); i++) {
1676 a = base_i(i);
1677 base_image[i] = data[a];
1678 if (base_image[i] >= degree) {
1679 cout << "action::make_element_from_permutation_representation "
1680 "base_image[i] >= degree" << endl;
1681 cout << "i=" << i << " base[i] = " << a
1682 << " base_image[i]=" << base_image[i] << endl;
1683 exit(1);
1684 }
1685 }
1686 make_element_from_base_image(Elt, S, base_image, verbose_level);
1687
1688 FREE_int(base_image);
1689 if (f_v) {
1690 cout << "action::make_element_from_permutation_representation done"
1691 << endl;
1692 }
1693}
1694
1696 int *data, int verbose_level)
1697{
1698 int f_v = (verbose_level >= 1);
1699 int f_vv = FALSE; //(verbose_level >= 2);
1700 int *base_image;
1701 int *Elt1;
1702 int *Elt2;
1703 int *Elt3;
1704 int *Elt4;
1705 int *Elt5;
1706 //sims *S;
1707#if 1
1708 int offset = 0;
1709 int f_do_it_anyway_even_for_big_degree = TRUE;
1710 int f_print_cycles_of_length_one = FALSE;
1711#endif
1712
1713 int i, j, yi, z, b, c, b_pt;
1714
1715 if (f_v) {
1716 cout << "action::make_element_from_base_image" << endl;
1717 }
1718
1719 if (f_v) {
1720 cout << "action::make_element_from_base_image" << endl;
1721 cout << "base images: ";
1722 Int_vec_print(cout, data, base_len());
1723 cout << endl;
1724 print_info();
1725 }
1726#if 0
1727 if (!f_has_sims) {
1728 cout << "action::make_element_from_base_image "
1729 "fatal: does not have sims" << endl;
1730 exit(1);
1731 }
1732 S = Sims;
1733#endif
1734 if (f_v) {
1735 cout << "action in Sims:" << endl;
1736 S->A->print_info();
1737 }
1738 base_image = NEW_int(base_len());
1744 for (j = 0; j < base_len(); j++) {
1745 base_image[j] = data[j];
1746 }
1747 element_one(Elt3, 0);
1748
1749 for (i = 0; i < base_len(); i++) {
1751 b_pt = base_i(i);
1752 yi = base_image[i];
1753 z = element_image_of(yi, Elt4, 0);
1754 j = S->get_orbit_inv(i, z);
1755 //j = S->orbit_inv[i][z];
1756 if (f_vv) {
1757 cout << "i=" << i << endl;
1758 cout << "Elt3=" << endl;
1761 offset, f_do_it_anyway_even_for_big_degree,
1762 f_print_cycles_of_length_one, 0/*verbose_level*/);
1763 cout << "i=" << i << " b_pt=" << b_pt
1764 << " yi=" << yi << " z="
1765 << z << " j=" << j << endl;
1766 }
1767 S->coset_rep(Elt5, i, j, 0);
1768 if (f_vv) {
1769 cout << "cosetrep=" << endl;
1773 offset, f_do_it_anyway_even_for_big_degree,
1774 f_print_cycles_of_length_one, 0/*verbose_level*/);
1775 }
1776 element_mult(Elt5, Elt3, Elt4, 0);
1777 element_move(Elt4, Elt3, 0);
1778
1779 if (f_vv) {
1780 cout << "after left multiplying, Elt3=" << endl;
1783 offset, f_do_it_anyway_even_for_big_degree,
1784 f_print_cycles_of_length_one, 0/*verbose_level*/);
1785
1786 cout << "computing image of b_pt=" << b_pt << endl;
1787 }
1788
1789 c = element_image_of(b_pt, Elt3, 0);
1790 if (f_vv) {
1791 cout << "b_pt=" << b_pt << " -> " << c << endl;
1792 }
1793 if (c != yi) {
1794 cout << "action::make_element_from_base_image "
1795 "fatal: element_image_of(b_pt, Elt3, 0) "
1796 "!= yi" << endl;
1797 exit(1);
1798 }
1799 }
1800 element_move(Elt3, Elt, 0);
1801 for (i = 0; i < base_len(); i++) {
1802 yi = data[i];
1803 b = element_image_of(base_i(i), Elt, 0);
1804 if (yi != b) {
1805 cout << "action::make_element_from_base_image "
1806 "fatal: yi != b"
1807 << endl;
1808 cout << "i=" << i << endl;
1809 cout << "base[i]=" << base_i(i) << endl;
1810 cout << "yi=" << yi << endl;
1811 cout << "b=" << b << endl;
1812 exit(1);
1813 }
1814 }
1815 if (f_v) {
1816 cout << "action::make_element_from_base_image "
1817 "created element:" << endl;
1818 element_print_quick(Elt, cout);
1819 }
1820 FREE_int(base_image);
1821 FREE_int(Elt1);
1822 FREE_int(Elt2);
1823 FREE_int(Elt3);
1824 FREE_int(Elt4);
1825 FREE_int(Elt5);
1826 if (f_v) {
1827 cout << "action::make_element_from_base_image done" << endl;
1828 }
1829}
1830
1831void action::make_element_2x2(int *Elt, int a0, int a1, int a2, int a3)
1832{
1833 int data[4];
1834
1835 data[0] = a0;
1836 data[1] = a1;
1837 data[2] = a2;
1838 data[3] = a3;
1839 make_element(Elt, data, 0);
1840}
1841
1843 std::string &data_string, int verbose_level)
1844{
1845 int f_v = (verbose_level >= 1);
1846
1847 if (f_v) {
1848 cout << "action::make_element_from_string" << endl;
1849 }
1850 int *data;
1851 int data_len;
1852
1853 Int_vec_scan(data_string, data, data_len);
1854
1855 if (f_v) {
1856 cout << "action::make_element_from_string data = ";
1857 Int_vec_print(cout, data, data_len);
1858 cout << endl;
1859 }
1860
1861 make_element(Elt, data, verbose_level);
1862
1863 FREE_int(data);
1864
1865 if (f_v) {
1866 cout << "action::make_element_from_string Elt = " << endl;
1867 element_print_quick(Elt, cout);
1868 }
1869
1870 if (f_v) {
1871 cout << "action::make_element_from_string done" << endl;
1872 }
1873}
1874
1875void action::make_element(int *Elt, int *data, int verbose_level)
1876{
1877 int f_v = (verbose_level >= 1);
1878
1879 if (f_v) {
1880 cout << "action::make_element" << endl;
1881 }
1882 if (type_G == product_action_t) {
1883
1884 if (f_v) {
1885 cout << "action::make_element product_action_t" << endl;
1886 }
1887
1889
1891 PA->make_element(Elt, data, verbose_level);
1892 //PA->A1->make_element(Elt, data, verbose_level);
1893 //PA->A2->make_element(Elt + PA->A1->elt_size_in_int,
1894 // data + PA->A1->make_element_size, verbose_level);
1895 }
1896 else if (type_G == action_on_sets_t) {
1897 if (f_v) {
1898 cout << "action::make_element action_on_sets_t" << endl;
1899 }
1900 subaction->make_element(Elt, data, verbose_level);
1901 }
1902 else if (type_G == action_on_pairs_t) {
1903 if (f_v) {
1904 cout << "action::make_element action_on_pairs_t" << endl;
1905 }
1906 subaction->make_element(Elt, data, verbose_level);
1907 }
1908 else if (type_G == matrix_group_t) {
1909 if (f_v) {
1910 cout << "action::make_element matrix_group_t" << endl;
1911 }
1912 G.matrix_grp->make_element(Elt, data, verbose_level);
1913 }
1914 else if (type_G == wreath_product_t) {
1915 if (f_v) {
1916 cout << "action::make_element wreath_product_t" << endl;
1917 }
1918 G.wreath_product_group->make_element(Elt, data, verbose_level);
1919 }
1920 else if (type_G == direct_product_t) {
1921 if (f_v) {
1922 cout << "action::make_element direct_product_t" << endl;
1923 }
1924 G.direct_product_group->make_element(Elt, data, verbose_level);
1925 }
1926 else if (f_has_subaction) {
1927 if (f_v) {
1928 cout << "action::make_element subaction" << endl;
1929 }
1930 subaction->make_element(Elt, data, verbose_level);
1931 }
1932 else if (type_G == perm_group_t) {
1933 if (f_v) {
1934 cout << "action::make_element perm_group_t" << endl;
1935 }
1936 G.perm_grp->make_element(Elt, data, verbose_level);
1937 }
1938 else {
1939 cout << "action::make_element unknown type_G: ";
1941 cout << endl;
1942 exit(1);
1943 }
1944}
1945
1947 int nb_auts, int *aut_data,
1948 groups::sims &S, int verbose_level)
1949{
1950 int f_v = (verbose_level >= 1);
1951 int h, i, coset;
1952 int *Elt1, *Elt2;
1954
1955 if (f_v) {
1956 cout << "action::build_up_automorphism_group_from_aut_data "
1957 "action=" << label << " nb_auts=" << nb_auts << endl;
1958 }
1961 S.init(this, verbose_level - 2);
1962 S.init_trivial_group(verbose_level - 1);
1963 for (h = 0; h < nb_auts; h++) {
1964 if (f_v) {
1965 cout << "aut_data[" << h << "]=";
1966 Int_vec_print(cout, aut_data + h * base_len(), base_len());
1967 cout << endl;
1968 }
1969 for (i = 0; i < base_len(); i++) {
1970 coset = aut_data[h * base_len() + i];
1971 //image_point = Sims->orbit[i][coset];
1972 Sims->path[i] = coset;
1973 //Sims->orbit_inv[i][aut_data[h * base_len + i]];
1974 }
1975 if (f_v) {
1976 cout << "path=";
1977 Int_vec_print(cout, Sims->path, base_len());
1978 cout << endl;
1979 }
1981 if (S.strip_and_add(Elt1, Elt2, 0/*verbose_level*/)) {
1982 S.group_order(go);
1983 if (f_v) {
1984 cout << "generator " << h
1985 << " added, n e w group order " << go << endl;
1988 }
1989 }
1990 else {
1991 if (f_v) {
1992 cout << "generator " << h << " strips through" << endl;
1993 }
1994 }
1995 }
1996 FREE_int(Elt1);
1997 FREE_int(Elt2);
1998}
1999
2001 int n, int verbose_level)
2002{
2003 int *Elt2;
2004 int *Elt3;
2005 int *Elt4;
2006
2010 move(Elt, Elt2);
2011 one(Elt3);
2012 while (n) {
2013 if (ODD(n)) {
2014 mult(Elt2, Elt3, Elt4);
2015 move(Elt4, Elt3);
2016 }
2017 mult(Elt2, Elt2, Elt4);
2018 move(Elt4, Elt2);
2019 n >>= 1;
2020 }
2021 move(Elt3, Elt);
2022 FREE_int(Elt2);
2023 FREE_int(Elt3);
2024 FREE_int(Elt4);
2025}
2026
2027void action::word_in_ab(int *Elt1, int *Elt2, int *Elt3,
2028 const char *word, int verbose_level)
2029{
2030 int *Elt4;
2031 int *Elt5;
2032 int l, i;
2033
2034
2037 one(Elt4);
2038 l = strlen(word);
2039 for (i = 0; i < l; i++) {
2040 if (word[i] == 'a') {
2041 mult(Elt4, Elt1, Elt5);
2042 move(Elt5, Elt4);
2043 }
2044 else if (word[i] == 'b') {
2045 mult(Elt4, Elt2, Elt5);
2046 move(Elt5, Elt4);
2047 }
2048 else {
2049 cout << "word must consist of a and b" << endl;
2050 exit(1);
2051 }
2052 }
2053 move(Elt4, Elt3);
2054
2055 FREE_int(Elt4);
2056 FREE_int(Elt5);
2057}
2058
2060 int *group_generator_data, int group_generator_size,
2061 int f_group_order_target, const char *group_order_target,
2063 groups::strong_generators *&Strong_gens,
2064 int verbose_level)
2065{
2066 int f_v = (verbose_level >= 1);
2069 groups::sims S;
2070 int *Elt;
2071 int nb_gens, i;
2072 int nb_times = 200;
2073
2074 if (f_v) {
2075 cout << "action::init_group_from_generators" << endl;
2076 cout << "group_generator_size=" << group_generator_size << endl;
2077 }
2078 if (f_group_order_target) {
2079 cout << "group_order_target=" << group_order_target << endl;
2080 }
2081 go.create_from_base_10_string(group_order_target, 0);
2082 if (f_group_order_target) {
2083 cout << "group_order_target=" << go << endl;
2084 }
2085 S.init(this, verbose_level - 2);
2086 Elt = NEW_int(elt_size_in_int);
2087 nb_gens = group_generator_size / make_element_size;
2088 if (nb_gens * make_element_size != group_generator_size) {
2089 cout << "action::init_group_from_generators fatal: "
2090 "group_generator_size is not "
2091 "divisible by make_element_size"
2092 << endl;
2093 cout << "make_element_size=" << make_element_size << endl;
2094 cout << "group_generator_size=" << group_generator_size << endl;
2095 exit(1);
2096 }
2097 gens->init(this, verbose_level - 2);
2098 gens->allocate(nb_gens, verbose_level - 2);
2099 for (i = 0; i < nb_gens; i++) {
2100 if (f_v) {
2101 cout << "parsing generator " << i << ":" << endl;
2102 }
2103 Int_vec_print(cout, group_generator_data +
2105 cout << endl;
2106 make_element(Elt,
2107 group_generator_data + i * make_element_size, verbose_level - 2);
2108 element_move(Elt, gens->ith(i), 0);
2109 }
2110 if (f_v) {
2111 cout << "done parsing generators" << endl;
2112 }
2113 S.init_trivial_group(verbose_level);
2114 S.init_generators(*gens, verbose_level);
2115 S.compute_base_orbits(verbose_level);
2116 while (TRUE) {
2117 S.closure_group(nb_times, 0/*verbose_level*/);
2118 S.group_order(cur_go);
2119 cout << "cur_go=" << cur_go << endl;
2120 if (!f_group_order_target) {
2121 break;
2122 }
2123 if (D.compare(cur_go, go) == 0) {
2124 cout << "reached target group order" << endl;
2125 break;
2126 }
2127 cout << "did not reach target group order, continuing" << endl;
2128 }
2129
2131 Strong_gens->init_from_sims(&S, verbose_level - 1);
2132
2133 FREE_int(Elt);
2134}
2135
2137 groups::sims *parent_group_S,
2138 int *group_generator_data, int group_generator_size,
2139 int f_group_order_target, const char *group_order_target,
2141 groups::strong_generators *&Strong_gens_out,
2142 int verbose_level)
2143{
2144 int f_v = (verbose_level >= 1);
2147 groups::sims S;
2148 int *Elt;
2149 int nb_gens, i;
2150 int nb_times = 200;
2151
2152 if (f_v) {
2153 cout << "action::init_group_from_generators_by_base_images" << endl;
2154 }
2155 if (f_v) {
2156 cout << "group_generator_size=" << group_generator_size << endl;
2157 }
2158 if (f_group_order_target) {
2159 cout << "group_order_target=" << group_order_target << endl;
2160 go.create_from_base_10_string(group_order_target, 0);
2161 }
2162 if (f_group_order_target) {
2163 cout << "group_order_target=" << go << endl;
2164 }
2165 S.init(this, verbose_level - 2);
2166 Elt = NEW_int(elt_size_in_int);
2167 nb_gens = group_generator_size / base_len();
2168 if (f_v) {
2169 cout << "nb_gens=" << nb_gens << endl;
2170 cout << "base_len=" << base_len() << endl;
2171 }
2172 if (nb_gens * base_len() != group_generator_size) {
2173 cout << "action::init_group_from_generators_by_base_images fatal: "
2174 "group_generator_size is not divisible by base_len" << endl;
2175 cout << "base_len=" << base_len() << endl;
2176 cout << "group_generator_size=" << group_generator_size << endl;
2177 exit(1);
2178 }
2179 gens->init(this, verbose_level - 2);
2180 gens->allocate(nb_gens, verbose_level - 2);
2181 for (i = 0; i < nb_gens; i++) {
2182 if (f_v) {
2183 cout << "parsing generator " << i << ":" << endl;
2184 }
2185 Int_vec_print(cout, group_generator_data +
2186 i * base_len(), base_len());
2187 cout << endl;
2188 make_element_from_base_image(Elt, parent_group_S,
2189 group_generator_data + i * base_len(),
2190 verbose_level - 2);
2191 element_move(Elt, gens->ith(i), 0);
2192 }
2193 if (f_v) {
2194 cout << "done parsing generators" << endl;
2195 }
2196 S.init_trivial_group(verbose_level);
2197 S.init_generators(*gens, verbose_level);
2198 S.compute_base_orbits(verbose_level);
2199 while (TRUE) {
2200 S.closure_group(nb_times, 0/*verbose_level*/);
2201 S.group_order(cur_go);
2202 cout << "cur_go=" << cur_go << endl;
2203 if (!f_group_order_target) {
2204 break;
2205 }
2206 if (D.compare(cur_go, go) == 0) {
2207 cout << "reached target group order" << endl;
2208 break;
2209 }
2210 cout << "did not reach target group order, continuing" << endl;
2211 }
2212
2214 Strong_gens->init_from_sims(&S, verbose_level - 1);
2216
2217 FREE_int(Elt);
2218 if (f_v) {
2219 cout << "action::init_group_from_generators_by_base_images done" << endl;
2220 }
2221}
2222
2224{
2225 //longinteger_domain D;
2226
2227 if (Stabilizer_chain == NULL) {
2228 cout << "action::group_order Stabilizer_chain == NULL" << endl;
2229 go.create(0, __FILE__, __LINE__);
2230 }
2231 else {
2233 //D.multiply_up(go, Stabilizer_chain->transversal_length, base_len());
2234 }
2235}
2236
2238{
2240
2241 group_order(go);
2242 return go.as_lint();
2243}
2244
2245
2246
2247
2249{
2250 element_print_base_images(Elt, cout);
2251}
2252
2253void action::element_print_base_images(int *Elt, ostream &ost)
2254{
2256}
2257
2259 int *Elt, ostream &ost, int verbose_level)
2260{
2261 int f_v = (verbose_level >= 1);
2262 int *base_images;
2263
2264 if (f_v) {
2265 cout << "action::element_print_base_images_verbose" << endl;
2266 }
2267 base_images = NEW_int(base_len());
2268 element_base_images_verbose(Elt, base_images, verbose_level - 1);
2269 ost << "base images: ";
2270 Int_vec_print(ost, base_images, base_len());
2271 FREE_int(base_images);
2272}
2273
2274void action::element_base_images(int *Elt, int *base_images)
2275{
2276 element_base_images_verbose(Elt, base_images, 0);
2277}
2278
2280 int *Elt, int *base_images, int verbose_level)
2281{
2282 int f_v = (verbose_level >= 1);
2283 int f_vv = (verbose_level >= 2);
2284 int i, bi;
2285
2286 if (f_v) {
2287 cout << "action::element_base_images_verbose" << endl;
2288 }
2289 for (i = 0; i < base_len(); i++) {
2290 bi = base_i(i);
2291 if (f_vv) {
2292 cout << "the " << i << "-th base point is "
2293 << bi << " is mapped to:" << endl;
2294 }
2295 base_images[i] = element_image_of(bi, Elt, verbose_level - 2);
2296 if (f_vv) {
2297 cout << "the " << i << "-th base point is "
2298 << bi << " is mapped to: " << base_images[i] << endl;
2299 }
2300 }
2301}
2302
2304 groups::sims *S, int *Elt, int verbose_level)
2305{
2306 int f_v = (verbose_level >= 1);
2307 int f_vv = (verbose_level >= 2);
2308 int *base_images1;
2309 int *base_images2;
2310 int *Elt1, *Elt2, *Elt3;
2311 int i, j, /*bi,*/ oj, j0 = 0, image0 = 0, image;
2312
2313
2314 if (f_v) {
2315 cout << "action::minimize_base_images" << endl;
2316 cout << "level=" << level << endl;
2317 }
2321 base_images1 = NEW_int(base_len());
2322 base_images2 = NEW_int(base_len());
2323
2324 element_move(Elt, Elt1, 0);
2325 for (i = level; i < base_len(); i++) {
2326 element_base_images(Elt1, base_images1);
2327 //bi = base[i];
2328 if (f_vv) {
2329 cout << "level " << i << " S->orbit_len[i]="
2330 << S->get_orbit_length(i) << endl;
2331 }
2332 for (j = 0; j < S->get_orbit_length(i); j++) {
2333 oj = S->get_orbit(i, j);
2334 image = element_image_of(oj, Elt1, 0);
2335 if (f_vv) {
2336 cout << "level " << i << " j=" << j
2337 << " oj=" << oj << " image="
2338 << image << endl;
2339 }
2340 if (j == 0) {
2341 image0 = image;
2342 j0 = 0;
2343 }
2344 else {
2345 if (image < image0) {
2346 if (f_vv) {
2347 cout << "level " << i << " coset j="
2348 << j << " image=" << image
2349 << "less that image0 = "
2350 << image0 << endl;
2351 }
2352 image0 = image;
2353 j0 = j;
2354 }
2355 }
2356 }
2357 if (f_vv) {
2358 cout << "level " << i << " S->orbit_len[i]="
2359 << S->get_orbit_length(i) << " j0=" << j0 << endl;
2360 }
2361 S->coset_rep(Elt3, i, j0, 0 /*verbose_level*/);
2362 if (f_vv) {
2363 cout << "cosetrep=" << endl;
2365 if (degree < 500) {
2367 cout << endl;
2368 }
2369 }
2370 element_mult(Elt3, Elt1, Elt2, 0);
2371 element_move(Elt2, Elt1, 0);
2372 element_base_images(Elt1, base_images2);
2373 if (f_vv) {
2374 cout << "level " << i << " j0=" << j0 << endl;
2375 cout << "before: ";
2376 Int_vec_print(cout, base_images1, base_len());
2377 cout << endl;
2378 cout << "after : ";
2379 Int_vec_print(cout, base_images2, base_len());
2380 cout << endl;
2381 }
2382 }
2383
2384 element_move(Elt1, Elt, 0);
2385
2386 FREE_int(base_images1);
2387 FREE_int(base_images2);
2388 FREE_int(Elt1);
2389 FREE_int(Elt2);
2390 FREE_int(Elt3);
2391}
2392
2393
2395 char *ascii_coding,
2396 data_structures_groups::vector_ge *&gens, int *&tl, int verbose_level)
2397{
2398 int f_v = (verbose_level >= 1);
2399 int f_vv = (verbose_level >= 2);
2402
2403 if (f_v) {
2404 cout << "action::get_generators_from_ascii_coding" << endl;
2405 }
2407 G->init(this, verbose_level - 2);
2408 if (f_vv) {
2409 cout << "action::get_generators_from_ascii_coding "
2410 "before G->init_ascii_coding_to_sims" << endl;
2411 }
2412 G->init_ascii_coding_to_sims(ascii_coding, verbose_level - 2);
2413 if (f_vv) {
2414 cout << "action::get_generators_from_ascii_coding "
2415 "after G->init_ascii_coding_to_sims" << endl;
2416 }
2417
2418
2419 G->S->group_order(go);
2420
2422 tl = NEW_int(base_len());
2423 G->S->extract_strong_generators_in_order(*gens, tl,
2424 0 /* verbose_level */);
2425
2426 if (f_vv) {
2427 cout << "action::get_generators_from_ascii_coding Group order="
2428 << go << endl;
2429 }
2430
2431 FREE_OBJECT(G);
2432 if (f_v) {
2433 cout << "action::get_generators_from_ascii_coding done" << endl;
2434 }
2435}
2436
2437
2438void action::lexorder_test(long int *set, int set_sz,
2439 int &set_sz_after_test,
2440 data_structures_groups::vector_ge *gens, int max_starter,
2441 int verbose_level)
2442{
2443 int f_v = (verbose_level >= 1);
2444 int f_v5 = FALSE; //(verbose_level >= 1);
2445 groups::schreier *Sch;
2446 int i, orb, first, a, a0;
2447
2448 if (f_v) {
2449 cout << "action::lexorder_test" << endl;
2450 }
2451
2453
2454 if (f_v) {
2455 cout << "action::lexorder_test computing orbits in action "
2456 "of degree " << degree << ", max_starter="
2457 << max_starter << endl;
2458 }
2459 Sch->init(this, verbose_level - 2);
2460 Sch->init_generators(*gens, verbose_level - 2);
2461
2462 //Sch->compute_all_point_orbits(0);
2463 if (f_v) {
2464 cout << "action::lexorder_test before compute_all_orbits_on_invariant_subset" << endl;
2465 }
2467 set, 0 /* verbose_level */);
2468 if (f_v) {
2469 cout << "action::lexorder_test after compute_all_orbits_on_invariant_subset" << endl;
2470 }
2471
2472 if (f_v) {
2473 cout << "action::lexorder_test: there are "
2474 << Sch->nb_orbits << " orbits on set" << endl;
2476 }
2477 if (f_v5) {
2478 Sch->print_and_list_orbits(cout);
2479 }
2480
2481 if (f_v) {
2482 cout << "action::lexorder_test "
2483 "max_starter=" << max_starter << endl;
2484 }
2485 set_sz_after_test = 0;
2486 for (i = 0; i < set_sz; i++) {
2487 a = set[i];
2488 if (FALSE) {
2489 cout << "action::lexorder_test "
2490 "Looking at point " << a << endl;
2491 }
2492 orb = Sch->orbit_number(a);
2493 first = Sch->orbit_first[orb];
2494 a0 = Sch->orbit[first];
2495 if (a0 < max_starter) {
2496 if (f_v) {
2497 cout << "action::lexorder_test Point " << a
2498 << " maps to " << a0 << " which is less than "
2499 "max_starter = " << max_starter
2500 << " so we eliminate" << endl;
2501 }
2502 }
2503 else {
2504 set[set_sz_after_test++] = a;
2505 }
2506 }
2507 if (f_v) {
2508 cout << "action::lexorder_test Of the " << set_sz
2509 << " points, we accept " << set_sz_after_test
2510 << " and we reject " << set_sz - set_sz_after_test << endl;
2511 }
2512 FREE_OBJECT(Sch);
2513 if (f_v) {
2514 cout << "action::lexorder_test done" << endl;
2515 }
2516
2517}
2518
2520 data_structures_groups::vector_ge *gens, int verbose_level)
2521{
2522 int f_v = (verbose_level >= 1);
2523
2524 if (f_v) {
2525 cout << "action::compute_orbits_on_points" << endl;
2526 }
2528 if (f_v) {
2529 cout << "action::compute_orbits_on_points in action ";
2530 print_info();
2531 }
2532 if (f_v) {
2533 cout << "action::compute_orbits_on_points before Sch->init" << endl;
2534 }
2535 Sch->init(this, verbose_level - 2);
2536 if (f_v) {
2537 cout << "action::compute_orbits_on_points before Sch->init_generators" << endl;
2538 }
2539 Sch->init_generators(*gens, verbose_level - 2);
2540 if (f_v) {
2541 cout << "action::compute_orbits_on_points before Sch->compute_all_point_orbits, degree = " << degree << endl;
2542 }
2543 Sch->compute_all_point_orbits(verbose_level - 3);
2544 if (f_v) {
2545 cout << "action::compute_orbits_on_points after Sch->compute_all_point_orbits" << endl;
2546 cout << "action::compute_orbits_on_points Sch->nb_orbits=" << Sch->nb_orbits << endl;
2547 }
2548 //Sch.print_and_list_orbits(cout);
2549 if (f_v) {
2550 cout << "action::compute_orbits_on_points done, we found "
2551 << Sch->nb_orbits << " orbits" << endl;
2552 }
2553}
2554
2556 int k, int n, int no,
2557 data_structures_groups::vector_ge *&gens, std::string &stab_order,
2558 int verbose_level)
2559{
2560 int f_v = (verbose_level >= 1);
2561 int f_vv = (verbose_level >= 2);
2562 int *data, nb_gens, data_size;
2563 int i;
2565
2566 if (f_v) {
2567 cout << "action::stabilizer_of_dual_hyperoval_representative" << endl;
2568 }
2569 K.DH_stab_gens(k, n, no, data, nb_gens, data_size, stab_order);
2570
2572 gens->init(this, verbose_level - 2);
2573 gens->allocate(nb_gens, verbose_level - 2);
2574 if (f_vv) {
2575 cout << "action::stabilizer_of_dual_hyperoval_representative "
2576 "creating stabilizer generators:" << endl;
2577 }
2578 for (i = 0; i < nb_gens; i++) {
2579 make_element(gens->ith(i), data + i * data_size, 0 /*verbose_level*/);
2580 }
2581
2582 if (f_v) {
2583 cout << "action::stabilizer_of_dual_hyperoval_representative done"
2584 << endl;
2585 }
2586}
2587
2589 int q, int k, int no,
2590 data_structures_groups::vector_ge *&gens, std::string &stab_order,
2591 int verbose_level)
2592{
2593 int f_v = (verbose_level >= 1);
2594 int f_vv = (verbose_level >= 2);
2595 int *data, nb_gens, data_size;
2596 int i;
2598
2599 if (f_v) {
2600 cout << "action::stabilizer_of_spread_representative"
2601 << endl;
2602 }
2603 K.Spread_stab_gens(q, k, no, data, nb_gens, data_size, stab_order);
2604
2606 gens->init(this, verbose_level - 2);
2607 gens->allocate(nb_gens, verbose_level - 2);
2608 if (f_vv) {
2609 cout << "action::stabilizer_of_spread_representative "
2610 "creating stabilizer generators:" << endl;
2611 }
2612 for (i = 0; i < nb_gens; i++) {
2613 make_element(gens->ith(i),
2614 data + i * data_size, 0 /*verbose_level*/);
2615 }
2616
2617 if (f_v) {
2618 cout << "action::stabilizer_of_spread_representative done"
2619 << endl;
2620 }
2621}
2622
2624 int q, int no,
2626 std::string &stab_order,
2627 int verbose_level)
2628{
2629 int f_v = (verbose_level >= 1);
2630 int f_vv = (verbose_level >= 2);
2631 int *data, nb_gens, data_size;
2632 int i;
2634
2635 if (f_v) {
2636 cout << "action::stabilizer_of_quartic_curve_representative" << endl;
2637 }
2638 K.quartic_curves_stab_gens(q, no, data, nb_gens, data_size, stab_order);
2639
2641#if 0
2642 if (f_v) {
2643 cout << "action::stabilizer_of_quartic_curve_representative "
2644 "before gens->init_from_data" << endl;
2645 }
2646 gens->init_from_data(this, data,
2647 nb_gens, data_size, 0 /*verbose_level*/);
2648 if (f_v) {
2649 cout << "action::stabilizer_of_quartic_curve_representative "
2650 "after gens->init_from_data" << endl;
2651 }
2652#else
2653 gens->init(this, verbose_level - 2);
2654 gens->allocate(nb_gens, verbose_level - 2);
2655 if (f_vv) {
2656 cout << "action::stabilizer_of_quartic_curve_representative "
2657 "creating stabilizer generators:" << endl;
2658 }
2659 for (i = 0; i < nb_gens; i++) {
2660 make_element(gens->ith(i),
2661 data + i * data_size, 0 /*verbose_level*/);
2662 }
2663#endif
2664
2665 if (f_v) {
2666 cout << "action::stabilizer_of_quartic_curve_representative done"
2667 << endl;
2668 }
2669}
2670
2672 groups::schreier *&Sch, groups::sims *&Stab, groups::strong_generators *&stab_gens,
2673 int verbose_level)
2674{
2675 int f_v = (verbose_level >= 1);
2676
2677 if (f_v) {
2678 cout << "action::point_stabilizer_any_point" << endl;
2679 }
2680
2681 int f; //, len;
2683
2684 if (f_v) {
2685 cout << "action::point_stabilizer_any_point "
2686 "computing all point orbits:" << endl;
2687 }
2689 this, 0 /* verbose_level */);
2690 //compute_all_point_orbits(Sch,
2691 //*Strong_gens->gens, 0 /* verbose_level */);
2692 if (f_v) {
2693 cout << "computing all point orbits done, found "
2694 << Sch->nb_orbits << " orbits" << endl;
2695 }
2696
2697
2698 f = Sch->orbit_first[0];
2699 //len = Sch->orbit_len[0];
2700 pt = Sch->orbit[f];
2701
2702 if (f_v) {
2703 cout << "action::point_stabilizer_any_point "
2704 "orbit rep = "
2705 << pt << endl;
2706 }
2707
2708 group_order(go);
2709 if (f_v) {
2710 cout << "action::point_stabilizer_any_point "
2711 "Computing point stabilizer:" << endl;
2712 }
2713 Sch->point_stabilizer(this, go,
2714 Stab, 0 /* orbit_no */, 0 /* verbose_level */);
2715
2716 Stab->group_order(go);
2717
2718 if (f_v) {
2719 cout << "action::point_stabilizer_any_point "
2720 "Computing point stabilizer done:" << endl;
2721 cout << "action::point_stabilizer_any_point "
2722 "point stabilizer is a group of order " << go << endl;
2723 }
2724
2725 if (f_v) {
2726 cout << "action::point_stabilizer_any_point computing "
2727 "strong generators for the point stabilizer:" << endl;
2728 }
2730 stab_gens->init_from_sims(Stab, 0 /* verbose_level */);
2731 if (f_v) {
2732 cout << "action::point_stabilizer_any_point strong generators "
2733 "for the point stabilizer have been computed" << endl;
2734 }
2735
2736 if (f_v) {
2737 cout << "action::point_stabilizer_any_point done" << endl;
2738 }
2739}
2740
2742 groups::strong_generators *input_gens,
2743 int &pt,
2744 groups::schreier *&Sch, groups::sims *&Stab, groups::strong_generators *&stab_gens,
2745 int verbose_level)
2746{
2747 int f_v = (verbose_level >= 1);
2748
2749 if (f_v) {
2750 cout << "action::point_stabilizer_any_point_with_given_group" << endl;
2751 }
2752
2753 int f; //, len;
2755
2756 if (f_v) {
2757 cout << "action::point_stabilizer_any_point_with_given_group "
2758 "computing all point orbits:" << endl;
2759 }
2760 Sch = input_gens->orbits_on_points_schreier(this, 0 /* verbose_level */);
2761 //compute_all_point_orbits(Sch, *Strong_gens->gens, 0 /* verbose_level */);
2762 cout << "computing all point orbits done, found "
2763 << Sch->nb_orbits << " orbits" << endl;
2764
2765
2766 f = Sch->orbit_first[0];
2767 //len = Sch->orbit_len[0];
2768 pt = Sch->orbit[f];
2769
2770 if (f_v) {
2771 cout << "action::point_stabilizer_any_point_with_given_group "
2772 "orbit rep = " << pt << endl;
2773 }
2774
2775 input_gens->group_order(go);
2776 if (f_v) {
2777 cout << "action::point_stabilizer_any_point_with_given_group "
2778 "Computing point stabilizer:" << endl;
2779 }
2780 Sch->point_stabilizer(this, go,
2781 Stab, 0 /* orbit_no */, 0 /* verbose_level */);
2782
2783 Stab->group_order(go);
2784
2785 if (f_v) {
2786 cout << "action::point_stabilizer_any_point_with_given_group "
2787 "Computing point stabilizer done:" << endl;
2788 cout << "action::point_stabilizer_any_point_with_given_group "
2789 "point stabilizer is a group of order " << go << endl;
2790 }
2791
2792 if (f_v) {
2793 cout << "action::point_stabilizer_any_point_with_given_group "
2794 "computing strong generators for the point stabilizer:"
2795 << endl;
2796 }
2798 stab_gens->init_from_sims(Stab, 0 /* verbose_level */);
2799 if (f_v) {
2800 cout << "action::point_stabilizer_any_point_with_given_group "
2801 "strong generators for the point stabilizer "
2802 "have been computed" << endl;
2803 }
2804
2805 if (f_v) {
2806 cout << "action::point_stabilizer_any_point_with_given_group done"
2807 << endl;
2808 }
2809}
2810
2813 long int line_rk, int *Elt, int verbose_level)
2814{
2815 int f_v = (verbose_level >= 1);
2816
2817 if (f_v) {
2818 cout << "action::make_element_which_moves_a_line_in_PG3q" << endl;
2819 }
2820
2821 int M[4 * 4];
2822 int N[4 * 4 + 1]; // + 1 if f_semilinear
2823 int base_cols[4];
2824 int r, c, i, j;
2825
2826 //int_vec_zero(M, 16);
2827 Gr->unrank_lint_here(M, line_rk, 0 /*verbose_level*/);
2828 r = Gr->F->Linear_algebra->Gauss_simple(M, 2, 4, base_cols, 0 /* verbose_level */);
2829 Gr->F->Linear_algebra->kernel_columns(4, r, base_cols, base_cols + r);
2830
2831 for (i = r; i < 4; i++) {
2832 for (j = 0; j < 4; j++) {
2833 if (j == base_cols[i]) {
2834 c = 1;
2835 }
2836 else {
2837 c = 0;
2838 }
2839 M[i * 4 + j] = c;
2840 }
2841 }
2842 Gr->F->Linear_algebra->matrix_inverse(M, N, 4, 0 /* verbose_level */);
2843 N[4 * 4] = 0;
2844 make_element(Elt, N, 0);
2845
2846 if (f_v) {
2847 cout << "action::make_element_which_moves_a_line_in_PG3q done" << endl;
2848 }
2849}
2850
2851
2852
2854{
2855#if 0
2856 if (type_G == matrix_group_t) {
2857 matrix_group *M;
2858
2859 M = get_matrix_group();
2860 return M->n;
2861 }
2862 else if (type_G == wreath_product_t) {
2863 wreath_product *W;
2864
2866 int vector_space_dimension;
2867
2868 vector_space_dimension = W->dimension_of_tensor_action;
2869 return vector_space_dimension;
2870 }
2871 else {
2872 cout << "action::matrix_group_dimension not a matrix group" << endl;
2873 cout << "type_G=";
2874 action_print_symmetry_group_type(cout, type_G);
2875 cout << endl;
2876 exit(1);
2877 }
2878#else
2879 return dimension;
2880#endif
2881}
2882
2884{
2885 if (!is_matrix_group()) {
2886 cout << "action::matrix_group_finite_field is not a matrix group" << endl;
2887 exit(1);
2888 }
2889 else {
2891
2892 M = get_matrix_group();
2893 return M->GFq;
2894 }
2895}
2896
2898{
2899 if (!is_matrix_group()) {
2900 cout << "action::is_semilinear_matrix_group is not a matrix group" << endl;
2901 exit(1);
2902 }
2903 else {
2905
2906 M = get_matrix_group();
2907 if (M->f_semilinear) {
2908 return TRUE;
2909 }
2910 else {
2911 return FALSE;
2912 }
2913 }
2914}
2915
2917{
2918 if (!is_matrix_group()) {
2919 cout << "action::is_projective is not a matrix group" << endl;
2920 exit(1);
2921 }
2922 else {
2924
2925 M = get_matrix_group();
2926 if (M->f_projective) {
2927 return TRUE;
2928 }
2929 else {
2930 return FALSE;
2931 }
2932 }
2933}
2934
2936{
2937 if (!is_matrix_group()) {
2938 cout << "action::is_affine is not a matrix group" << endl;
2939 exit(1);
2940 }
2941 else {
2943
2944 M = get_matrix_group();
2945 if (M->f_affine) {
2946 return TRUE;
2947 }
2948 else {
2949 return FALSE;
2950 }
2951 }
2952}
2953
2955{
2956 if (!is_matrix_group()) {
2957 cout << "action::is_general_linear is not a matrix group" << endl;
2958 exit(1);
2959 }
2960 else {
2962
2963 M = get_matrix_group();
2964 if (M->f_general_linear) {
2965 return TRUE;
2966 }
2967 else {
2968 return FALSE;
2969 }
2970 }
2971}
2972
2974{
2975 if (type_G == matrix_group_t) {
2976 return TRUE;
2977 }
2978 else {
2979 if (f_has_subaction) {
2980 return subaction->is_matrix_group();
2981 }
2982 return FALSE;
2983 }
2984}
2985
2987{
2989 cout << "action::get_matrix_group type_G == unknown_symmetry_group_t" << endl;
2990 exit(1);
2991 }
2992 else if (type_G == matrix_group_t) {
2993 return G.matrix_grp;
2994 }
2995 else if (type_G == perm_group_t) {
2996 cout << "action::get_matrix_group type_G == perm_group_t" << endl;
2997 exit(1);
2998 }
2999 else if (type_G == wreath_product_t) {
3000 cout << "action::get_matrix_group type_G == wreath_product_t" << endl;
3001 exit(1);
3002 }
3003 else if (type_G == direct_product_t) {
3004 cout << "action::get_matrix_group type_G == direct_product_t" << endl;
3005 exit(1);
3006 }
3007 else if (type_G == action_on_sets_t) {
3008 return subaction->get_matrix_group();
3009 }
3010 else if (type_G == action_on_subgroups_t) {
3011 return subaction->get_matrix_group();
3012 }
3013 else if (type_G == action_on_k_subsets_t) {
3014 return subaction->get_matrix_group();
3015 }
3016 else if (type_G == action_on_pairs_t) {
3017 return subaction->get_matrix_group();
3018 }
3019 else if (type_G == action_on_ordered_pairs_t) {
3020 return subaction->get_matrix_group();
3021 }
3022 else if (type_G == base_change_t) {
3023 return subaction->get_matrix_group();
3024 }
3025 else if (type_G == product_action_t) {
3026 cout << "action::get_matrix_group type_G == product_action_t" << endl;
3027 exit(1);
3028 }
3030 return subaction->get_matrix_group();
3031 }
3032 else if (type_G == action_by_restriction_t) {
3033 return subaction->get_matrix_group();
3034 }
3035 else if (type_G == action_by_conjugation_t) {
3036 return subaction->get_matrix_group();
3037 }
3038 else if (type_G == action_on_determinant_t) {
3039 return subaction->get_matrix_group();
3040 }
3041 else if (type_G == action_on_sign_t) {
3042 return subaction->get_matrix_group();
3043 }
3044 else if (type_G == action_on_grassmannian_t) {
3045 return subaction->get_matrix_group();
3046 }
3047 else if (type_G == action_on_spread_set_t) {
3048 return subaction->get_matrix_group();
3049 }
3050 else if (type_G == action_on_orthogonal_t) {
3051 return subaction->get_matrix_group();
3052 }
3053 else if (type_G == action_on_cosets_t) {
3054 return subaction->get_matrix_group();
3055 }
3056 else if (type_G == action_on_factor_space_t) {
3057 return subaction->get_matrix_group();
3058 }
3059 else if (type_G == action_on_wedge_product_t) {
3060 return subaction->get_matrix_group();
3061 }
3062 else if (type_G == action_by_representation_t) {
3063 return subaction->get_matrix_group();
3064 }
3066 return subaction->get_matrix_group();
3067 }
3068 else if (type_G == action_on_bricks_t) {
3069 return subaction->get_matrix_group();
3070 }
3071 else if (type_G == action_on_andre_t) {
3072 return subaction->get_matrix_group();
3073 }
3074 else if (type_G == action_on_orbits_t) {
3075 return subaction->get_matrix_group();
3076 }
3077 else if (type_G == action_on_flags_t) {
3078 return subaction->get_matrix_group();
3079 }
3081 return subaction->get_matrix_group();
3082 }
3083 else {
3084 cout << "action::get_matrix_group unknown type" << endl;
3085 exit(1);
3086 }
3087}
3088
3090{
3091 int f_v = (verbose_level >= 1);
3092
3093 if (f_v) {
3094 cout << "action::perform_tests" << endl;
3095 }
3096 int r1, r2;
3097 int *Elt1;
3098 int *Elt2;
3099 int *Elt3;
3100 int *Elt4;
3101 int *perm1;
3102 int *perm2;
3103 int *perm3;
3104 int *perm4;
3105 int *perm5;
3106 int cnt;
3107 int i;
3110
3115 perm1 = NEW_int(degree);
3116 perm2 = NEW_int(degree);
3117 perm3 = NEW_int(degree);
3118 perm4 = NEW_int(degree);
3119 perm5 = NEW_int(degree);
3120
3121 for (cnt = 0; cnt < 10; cnt++) {
3122 r1 = Os.random_integer(SG->gens->len);
3123 r2 = Os.random_integer(SG->gens->len);
3124 if (f_v) {
3125 cout << "r1=" << r1 << endl;
3126 cout << "r2=" << r2 << endl;
3127 }
3128 element_move(SG->gens->ith(r1), Elt1, 0);
3129 element_move(SG->gens->ith(r2), Elt2, 0);
3130 if (f_v) {
3131 cout << "Elt1 = " << endl;
3133 }
3134 element_as_permutation(Elt1, perm1, 0 /* verbose_level */);
3135 if (f_v) {
3136 cout << "as permutation: " << endl;
3137 Combi.perm_print(cout, perm1, degree);
3138 cout << endl;
3139 }
3140
3141 if (f_v) {
3142 cout << "Elt2 = " << endl;
3144 }
3145 element_as_permutation(Elt2, perm2, 0 /* verbose_level */);
3146 if (f_v) {
3147 cout << "as permutation: " << endl;
3148 Combi.perm_print(cout, perm2, degree);
3149 cout << endl;
3150 }
3151
3152 element_mult(Elt1, Elt2, Elt3, 0);
3153 if (f_v) {
3154 cout << "Elt3 = " << endl;
3156 }
3157 element_as_permutation(Elt3, perm3, 0 /* verbose_level */);
3158 if (f_v) {
3159 cout << "as permutation: " << endl;
3160 Combi.perm_print(cout, perm3, degree);
3161 cout << endl;
3162 }
3163
3164 Combi.perm_mult(perm1, perm2, perm4, degree);
3165 if (f_v) {
3166 cout << "perm1 * perm2= " << endl;
3167 Combi.perm_print(cout, perm4, degree);
3168 cout << endl;
3169 }
3170
3171 for (i = 0; i < degree; i++) {
3172 if (perm3[i] != perm4[i]) {
3173 cout << "test " << cnt
3174 << " failed; something is wrong" << endl;
3175 exit(1);
3176 }
3177 }
3178 }
3179 if (f_v) {
3180 cout << "action::perform_tests test 1 passed" << endl;
3181 }
3182
3183 for (cnt = 0; cnt < 10; cnt++) {
3184 r1 = Os.random_integer(SG->gens->len);
3185 if (f_v) {
3186 cout << "r1=" << r1 << endl;
3187 }
3188 element_move(SG->gens->ith(r1), Elt1, 0);
3189 if (f_v) {
3190 cout << "Elt1 = " << endl;
3192 }
3193 element_as_permutation(Elt1, perm1, 0 /* verbose_level */);
3194 if (f_v) {
3195 cout << "as permutation: " << endl;
3196 Combi.perm_print(cout, perm1, degree);
3197 cout << endl;
3198 }
3200 if (f_v) {
3201 cout << "Elt2 = " << endl;
3203 }
3204 element_as_permutation(Elt2, perm2, 0 /* verbose_level */);
3205 if (f_v) {
3206 cout << "as permutation: " << endl;
3207 Combi.perm_print(cout, perm2, degree);
3208 cout << endl;
3209 }
3210
3211 element_mult(Elt1, Elt2, Elt3, 0);
3212 if (f_v) {
3213 cout << "Elt3 = " << endl;
3215 }
3216 element_as_permutation(Elt3, perm3, 0 /* verbose_level */);
3217 if (f_v) {
3218 cout << "as permutation: " << endl;
3219 Combi.perm_print(cout, perm3, degree);
3220 cout << endl;
3221 }
3222
3223 if (!Combi.perm_is_identity(perm3, degree)) {
3224 cout << "fails the inverse test" << endl;
3225 exit(1);
3226 }
3227 }
3228
3229 if (f_v) {
3230 cout << "action::perform_tests test 2 passed" << endl;
3231 }
3232
3233
3234 for (cnt = 0; cnt < 10; cnt++) {
3235 r1 = Os.random_integer(SG->gens->len);
3236 r2 = Os.random_integer(SG->gens->len);
3237 if (f_v) {
3238 cout << "r1=" << r1 << endl;
3239 cout << "r2=" << r2 << endl;
3240 }
3241 element_move(SG->gens->ith(r1), Elt1, 0);
3242 element_move(SG->gens->ith(r2), Elt2, 0);
3243 if (f_v) {
3244 cout << "Elt1 = " << endl;
3246 }
3247 element_as_permutation(Elt1, perm1, 0 /* verbose_level */);
3248 if (f_v) {
3249 cout << "as permutation: " << endl;
3250 Combi.perm_print(cout, perm1, degree);
3251 cout << endl;
3252 }
3253
3254 if (f_v) {
3255 cout << "Elt2 = " << endl;
3257 }
3258 element_as_permutation(Elt2, perm2, 0 /* verbose_level */);
3259 if (f_v) {
3260 cout << "as permutation: " << endl;
3261 Combi.perm_print(cout, perm2, degree);
3262 cout << endl;
3263 }
3264
3265 element_mult(Elt1, Elt2, Elt3, 0);
3266 if (f_v) {
3267 cout << "Elt3 = " << endl;
3269 }
3270
3272 if (f_v) {
3273 cout << "Elt4 = Elt3^-1 = " << endl;
3275 }
3276
3277
3278 element_as_permutation(Elt3, perm3, 0 /* verbose_level */);
3279 if (f_v) {
3280 cout << "as Elt3 as permutation: " << endl;
3281 Combi.perm_print(cout, perm3, degree);
3282 cout << endl;
3283 }
3284
3285 element_as_permutation(Elt4, perm4, 0 /* verbose_level */);
3286 if (f_v) {
3287 cout << "as Elt4 as permutation: " << endl;
3288 Combi.perm_print(cout, perm4, degree);
3289 cout << endl;
3290 }
3291
3292 Combi.perm_mult(perm3, perm4, perm5, degree);
3293 if (f_v) {
3294 cout << "perm3 * perm4= " << endl;
3295 Combi.perm_print(cout, perm5, degree);
3296 cout << endl;
3297 }
3298
3299 for (i = 0; i < degree; i++) {
3300 if (perm5[i] != i) {
3301 cout << "test " << cnt
3302 << " failed; something is wrong" << endl;
3303 exit(1);
3304 }
3305 }
3306 }
3307 if (f_v) {
3308 cout << "action::perform_tests test 3 passed" << endl;
3309 }
3310
3311
3312 if (f_v) {
3313 cout << "performing test 4:" << endl;
3314 }
3315
3316 int data[] = {2,0,1, 0,1,1,0, 1,0,0,1, 1,0,0,1 };
3317 make_element(Elt1, data, verbose_level);
3318 element_as_permutation(Elt1, perm1, 0 /* verbose_level */);
3319 if (f_v) {
3320 cout << "as Elt1 as permutation: " << endl;
3321 Combi.perm_print(cout, perm1, degree);
3322 cout << endl;
3323 }
3324
3326 element_as_permutation(Elt2, perm2, 0 /* verbose_level */);
3327 if (f_v) {
3328 cout << "as Elt2 as permutation: " << endl;
3329 Combi.perm_print(cout, perm2, degree);
3330 cout << endl;
3331 }
3332
3333
3334 element_mult(Elt1, Elt2, Elt3, 0);
3335 if (f_v) {
3336 cout << "Elt3 = " << endl;
3338 }
3339
3340 Combi.perm_mult(perm1, perm2, perm3, degree);
3341 if (f_v) {
3342 cout << "perm1 * perm2= " << endl;
3343 Combi.perm_print(cout, perm3, degree);
3344 cout << endl;
3345 }
3346
3347 for (i = 0; i < degree; i++) {
3348 if (perm3[i] != i) {
3349 cout << "test 4 failed; something is wrong" << endl;
3350 exit(1);
3351 }
3352 }
3353
3354 if (f_v) {
3355 cout << "action::perform_tests test 4 passed" << endl;
3356 }
3357
3358 FREE_int(Elt1);
3359 FREE_int(Elt2);
3360 FREE_int(Elt3);
3361 FREE_int(Elt4);
3362 FREE_int(perm1);
3363 FREE_int(perm2);
3364 FREE_int(perm3);
3365 FREE_int(perm4);
3366 FREE_int(perm5);
3367}
3368
3369
3370void action::multiply_based_on_text(std::string &data_A, std::string &data_B, int verbose_level)
3371{
3372 int f_v = (verbose_level >= 1);
3373
3374 if (f_v) {
3375 cout << "action::multiply_based_on_text" << endl;
3376 }
3377 if (f_v) {
3378 cout << "multiplying" << endl;
3379 cout << "A=" << data_A << endl;
3380 cout << "B=" << data_B << endl;
3381 }
3382 int *Elt1;
3383 int *Elt2;
3384 int *Elt3;
3385
3389
3390 make_element_from_string(Elt1, data_A, verbose_level);
3391 if (f_v) {
3392 cout << "A=" << endl;
3394 }
3395
3396 make_element_from_string(Elt2, data_B, verbose_level);
3397 if (f_v) {
3398 cout << "B=" << endl;
3400 }
3401
3402 element_mult(Elt1, Elt2, Elt3, 0);
3403 if (f_v) {
3404 cout << "A*B=" << endl;
3407 cout << endl;
3408 }
3409
3410 string fname;
3411
3412 fname.assign(label);
3413 fname.append("_mult.tex");
3414
3415
3416 {
3417 char title[1000];
3418 char author[1000];
3419
3420 snprintf(title, 1000, "Multiplication of Group Elements in $%s$", label_tex.c_str());
3421 //strcpy(author, "");
3422 author[0] = 0;
3423
3424
3425 {
3426 ofstream ost(fname);
3428
3429 L.head(ost,
3430 FALSE /* f_book*/,
3431 TRUE /* f_title */,
3432 title, author,
3433 FALSE /* f_toc */,
3434 FALSE /* f_landscape */,
3435 TRUE /* f_12pt */,
3436 TRUE /* f_enlarged_page */,
3437 TRUE /* f_pagenumbers */,
3438 NULL /* extra_praeamble */);
3439
3440
3441 ost << "$$" << endl;
3443 ost << "\\cdot" << endl;
3445 ost << "=" << endl;
3447 ost << "$$" << endl;
3448
3450 ost << "\\\\" << endl;
3452 ost << "\\\\" << endl;
3454 ost << "\\\\" << endl;
3455
3456 L.foot(ost);
3457
3458 }
3460
3461 if (f_v) {
3462 cout << "written file " << fname << " of size "
3463 << Fio.file_size(fname) << endl;
3464 }
3465 }
3466
3467
3468 FREE_int(Elt1);
3469 FREE_int(Elt2);
3470 FREE_int(Elt3);
3471
3472
3473 if (f_v) {
3474 cout << "action::multiply_based_on_text" << endl;
3475 }
3476}
3477
3478void action::inverse_based_on_text(std::string &data_A, int verbose_level)
3479{
3480 int f_v = (verbose_level >= 1);
3481
3482 if (f_v) {
3483 cout << "action::inverse_based_on_text" << endl;
3484 }
3485
3486 if (f_v) {
3487 cout << "computing the inverse" << endl;
3488 cout << "A=" << data_A << endl;
3489 }
3490 int *Elt1;
3491 int *Elt2;
3492
3495
3496 make_element_from_string(Elt1, data_A, verbose_level);
3497 if (f_v) {
3498 cout << "A=" << endl;
3500 }
3501
3503 if (f_v) {
3504 cout << "A^-1=" << endl;
3507 cout << endl;
3508 }
3509
3510 string fname;
3511
3512 fname.assign(label);
3513 fname.append("_inv.tex");
3514
3515
3516 {
3517 char title[1000];
3518 char author[1000];
3519
3520 snprintf(title, 1000, "Inverse of Group Element in $%s$", label_tex.c_str());
3521 //strcpy(author, "");
3522 author[0] = 0;
3523
3524
3525 {
3526 ofstream ost(fname);
3528
3529 L.head(ost,
3530 FALSE /* f_book*/,
3531 TRUE /* f_title */,
3532 title, author,
3533 FALSE /* f_toc */,
3534 FALSE /* f_landscape */,
3535 TRUE /* f_12pt */,
3536 TRUE /* f_enlarged_page */,
3537 TRUE /* f_pagenumbers */,
3538 NULL /* extra_praeamble */);
3539
3540
3541 ost << "$$" << endl;
3542 ost << "{" << endl;
3544 ost << "}^{-1}" << endl;
3545 ost << "=" << endl;
3547 ost << "$$" << endl;
3548
3550 ost << "\\\\" << endl;
3552 ost << "\\\\" << endl;
3553
3554 L.foot(ost);
3555
3556 }
3558
3559 if (f_v) {
3560 cout << "written file " << fname << " of size "
3561 << Fio.file_size(fname) << endl;
3562 }
3563 }
3564
3565
3566 FREE_int(Elt1);
3567 FREE_int(Elt2);
3568
3569
3570 if (f_v) {
3571 cout << "action::inverse_based_on_text done" << endl;
3572 }
3573}
3574
3576 std::string &exponent_text, int verbose_level)
3577{
3578 int f_v = (verbose_level >= 1);
3579
3580 if (f_v) {
3581 cout << "action::raise_to_the_power_based_on_text" << endl;
3582 }
3583
3584 if (f_v) {
3585 cout << "computing the power" << endl;
3586 cout << "A=" << data_A << endl;
3587 cout << "exponent=" << exponent_text << endl;
3588 }
3589
3590 int exponent;
3592
3593 exponent = ST.strtoi(exponent_text);
3594
3595 int *Elt1;
3596 int *Elt2;
3597
3600
3601 make_element_from_string(Elt1, data_A, verbose_level);
3602 if (f_v) {
3603 cout << "A=" << endl;
3605 }
3606
3607 move(Elt1, Elt2);
3608
3609
3611 exponent, 0 /* verbose_level*/);
3612
3613 if (f_v) {
3614 cout << "A^" << exponent << "=" << endl;
3617 cout << endl;
3618 }
3619
3620 string fname;
3621
3622 fname.assign(label);
3623 fname.append("_power.tex");
3624
3625
3626 {
3627 char title[1000];
3628 char author[1000];
3629
3630 snprintf(title, 1000, "Power of Group Element in $%s$", label_tex.c_str());
3631 //strcpy(author, "");
3632 author[0] = 0;
3633
3634
3635 {
3636 ofstream ost(fname);
3638
3639 L.head(ost,
3640 FALSE /* f_book*/,
3641 TRUE /* f_title */,
3642 title, author,
3643 FALSE /* f_toc */,
3644 FALSE /* f_landscape */,
3645 TRUE /* f_12pt */,
3646 TRUE /* f_enlarged_page */,
3647 TRUE /* f_pagenumbers */,
3648 NULL /* extra_praeamble */);
3649
3650
3651 ost << "$$" << endl;
3652 ost << "{" << endl;
3654 ost << "}^{" << exponent << "}" << endl;
3655 ost << "=" << endl;
3657 ost << "$$" << endl;
3658
3660 ost << "\\\\" << endl;
3662 ost << "\\\\" << endl;
3663
3664 L.foot(ost);
3665
3666 }
3668
3669 if (f_v) {
3670 cout << "written file " << fname << " of size "
3671 << Fio.file_size(fname) << endl;
3672 }
3673 }
3674
3675
3676 FREE_int(Elt1);
3677 FREE_int(Elt2);
3678
3679
3680 if (f_v) {
3681 cout << "action::raise_to_the_power_based_on_text done" << endl;
3682 }
3683}
3684
3685
3686}}}
3687
3688
data structure for set partitions following Jeffrey Leon
a collection of functions related to sorted vectors
void lint_vec_quicksort_increasingly(long int *v, int len)
Definition: sorting.cpp:918
int lint_vec_compare(long int *p, long int *q, int len)
Definition: sorting.cpp:2326
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
functions related to strings and character arrays
to rank and unrank subspaces of a fixed dimension in F_q^n
Definition: geometry.h:892
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
provides access to pre-computed combinatorial data in encoded form
void quartic_curves_stab_gens(int q, int i, int *&data, int &nb_gens, int &data_size, std::string &stab_order_str)
void Spread_stab_gens(int q, int k, int i, int *&data, int &nb_gens, int &data_size, std::string &stab_order_str)
void DH_stab_gens(int k, int n, int i, int *&data, int &nb_gens, int &data_size, std::string &stab_order_str)
void kernel_columns(int n, int nb_base_cols, int *base_cols, int *kernel_cols)
int Gauss_simple(int *A, int m, int n, int *base_cols, int verbose_level)
void matrix_inverse(int *A, int *Ainv, int n, int verbose_level)
void head(std::ostream &ost, int f_book, int f_title, const char *title, const char *author, int f_toc, int f_landscape, int f_12pt, int f_enlarged_page, int f_pagenumbers, const char *extras_for_preamble)
domain to compute with objects of type longinteger
Definition: ring_theory.h:240
int compare(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)
void create(long int i, const char *file, int line)
global functions related to group actions
Definition: actions.h:1015
void action_print_symmetry_group_type(std::ostream &ost, symmetry_group_type a)
void init_group_from_generators_by_base_images(groups::sims *S, int *group_generator_data, int group_generator_size, int f_group_order_target, const char *group_order_target, data_structures_groups::vector_ge *gens, groups::strong_generators *&Strong_gens_out, int verbose_level)
Definition: action.cpp:2136
void element_print_latex(void *elt, std::ostream &ost)
Definition: action_cb.cpp:364
void element_print_as_permutation_with_offset(void *elt, std::ostream &ost, int offset, int f_do_it_anyway_even_for_big_degree, int f_print_cycles_of_length_one, int verbose_level)
Definition: action_cb.cpp:463
void build_up_automorphism_group_from_aut_data(int nb_auts, int *aut_data, groups::sims &S, int verbose_level)
Definition: action.cpp:1946
void point_stabilizer_any_point(int &pt, groups::schreier *&Sch, groups::sims *&Stab, groups::strong_generators *&stab_gens, int verbose_level)
Definition: action.cpp:2671
int product_has_order_two(int *E1, int *E2, int verbose_level)
Definition: action.cpp:797
void compute_all_point_orbits(groups::schreier &S, data_structures_groups::vector_ge &gens, int verbose_level)
Definition: action.cpp:995
void element_print_quick(void *elt, std::ostream &ost)
Definition: action_cb.cpp:353
void element_print(void *elt, std::ostream &ost)
Definition: action_cb.cpp:347
void mult(void *a, void *b, void *ab)
Definition: action_cb.cpp:81
void make_element_from_permutation_representation(int *Elt, groups::sims *S, int *data, int verbose_level)
Definition: action.cpp:1664
void inverse_based_on_text(std::string &data_A, int verbose_level)
Definition: action.cpp:3478
void element_retrieve(int hdl, void *elt, int verbose_level)
Definition: action_cb.cpp:301
void element_base_images_verbose(int *Elt, int *base_images, int verbose_level)
Definition: action.cpp:2279
int product_has_order_three(int *E1, int *E2, int verbose_level)
Definition: action.cpp:822
void element_print_base_images_verbose(int *Elt, std::ostream &ost, int verbose_level)
Definition: action.cpp:2258
void all_point_orbits(groups::schreier &Schreier, int verbose_level)
Definition: action.cpp:1229
int element_order_if_divisor_of(void *elt, int o)
Definition: action.cpp:937
int least_image_of_point_generators_by_handle(std::vector< int > &gen_handle, int pt, int *transporter, int verbose_level)
Definition: action.cpp:1186
void print_symmetry_group_type(std::ostream &ost)
Definition: action_io.cpp:671
void map_a_set(long int *set, long int *image_set, int n, int *Elt, int verbose_level)
Definition: action.cpp:668
void element_mult(void *a, void *b, void *ab, int verbose_level)
Definition: action_cb.cpp:315
void find_strong_generators_at_level(int base_len, long int *the_base, int level, data_structures_groups::vector_ge &gens, data_structures_groups::vector_ge &subset_of_gens, int verbose_level)
Definition: action.cpp:1612
void element_print_for_make_element(void *elt, std::ostream &ost)
Definition: action_cb.cpp:409
int compute_orbit_of_point_generators_by_handle(int nb_gen, int *gen_handle, int pt, int *orbit, int verbose_level)
Definition: action.cpp:1137
void strong_generators_at_depth(int depth, data_structures_groups::vector_ge &gen, int verbose_level)
Definition: action.cpp:1026
void raise_to_the_power_based_on_text(std::string &data_A, std::string &exponent_text, int verbose_level)
Definition: action.cpp:3575
groups::strong_generators * Strong_gens
Definition: actions.h:130
void init_sims_only(groups::sims *G, int verbose_level)
Definition: action.cpp:709
int element_order_and_cycle_type_verbose(void *elt, int *cycle_type, int verbose_level)
Definition: action.cpp:867
void make_element_from_string(int *Elt, std::string &data_string, int verbose_level)
Definition: action.cpp:1842
int count_fixed_points(void *elt, int verbose_level)
Definition: action.cpp:601
void compute_strong_generators_from_sims(int verbose_level)
Definition: action.cpp:750
int element_has_order_two(int *E1, int verbose_level)
Definition: action.cpp:774
int check_if_transporter_for_set(int *Elt, int size, long int *set1, long int *set2, int verbose_level)
Definition: action.cpp:1402
void stabilizer_of_dual_hyperoval_representative(int k, int n, int no, data_structures_groups::vector_ge *&gens, std::string &stab_order, int verbose_level)
Definition: action.cpp:2555
void get_generators_from_ascii_coding(char *ascii_coding, data_structures_groups::vector_ge *&gens, int *&tl, int verbose_level)
Definition: action.cpp:2394
stabilizer_chain_base_data * Stabilizer_chain
Definition: actions.h:178
void make_element_which_moves_a_line_in_PG3q(geometry::grassmann *Gr, long int line_rk, int *Elt, int verbose_level)
Definition: action.cpp:2811
void element_invert(void *a, void *av, int verbose_level)
Definition: action_cb.cpp:322
void perform_tests(groups::strong_generators *SG, int verbose_level)
Definition: action.cpp:3089
void element_one(void *elt, int verbose_level)
Definition: action_cb.cpp:224
void point_stabilizer_any_point_with_given_group(groups::strong_generators *input_gens, int &pt, groups::schreier *&Sch, groups::sims *&Stab, groups::strong_generators *&stab_gens, int verbose_level)
Definition: action.cpp:2741
void element_base_images(int *Elt, int *base_images)
Definition: action.cpp:2274
void compute_stabilizer_orbits(data_structures::partitionstack *&Staborbits, int verbose_level)
Definition: action.cpp:1297
void compute_set_orbit(data_structures_groups::vector_ge &gens, int size, long int *set, int &nb_sets, long int **&Sets, int **&Transporter, int verbose_level)
Definition: action.cpp:1465
void lexorder_test(long int *set, int set_sz, int &set_sz_after_test, data_structures_groups::vector_ge *gens, int max_starter, int verbose_level)
Definition: action.cpp:2438
field_theory::finite_field * matrix_group_finite_field()
Definition: action.cpp:2883
void element_power_int_in_place(int *Elt, int n, int verbose_level)
Definition: action.cpp:2000
int element_order_and_cycle_type(void *elt, int *cycle_type)
Definition: action.cpp:860
void make_element(int *Elt, int *data, int verbose_level)
Definition: action.cpp:1875
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
int find_non_fixed_point(void *elt, int verbose_level)
Definition: action.cpp:555
void all_point_orbits_from_single_generator(groups::schreier &Schreier, int *Elt, int verbose_level)
Definition: action.cpp:1268
void element_as_permutation(void *elt, int *perm, int verbose_level)
Definition: action_cb.cpp:436
void multiply_based_on_text(std::string &data_A, std::string &data_B, int verbose_level)
Definition: action.cpp:3370
int test_if_set_stabilizes(int *Elt, int size, long int *set, int verbose_level)
Definition: action.cpp:622
void word_in_ab(int *Elt1, int *Elt2, int *Elt3, const char *word, int verbose_level)
Definition: action.cpp:2027
int least_image_of_point(data_structures_groups::vector_ge &strong_generators, int pt, int *transporter, int verbose_level)
Definition: action.cpp:1153
void element_move(void *a, void *b, int verbose_level)
Definition: action_cb.cpp:335
void make_element_2x2(int *Elt, int a0, int a1, int a2, int a3)
Definition: action.cpp:1831
void stabilizer_of_quartic_curve_representative(int q, int no, data_structures_groups::vector_ge *&gens, std::string &stab_order, int verbose_level)
Definition: action.cpp:2623
void group_order(ring_theory::longinteger_object &go)
Definition: action.cpp:2223
groups::matrix_group * get_matrix_group()
Definition: action.cpp:2986
int check_if_in_set_stabilizer(int *Elt, int size, long int *set, int verbose_level)
Definition: action.cpp:1364
void init_group_from_generators(int *group_generator_data, int group_generator_size, int f_group_order_target, const char *group_order_target, data_structures_groups::vector_ge *gens, groups::strong_generators *&Strong_gens, int verbose_level)
Definition: action.cpp:2059
void compute_point_stabilizer_chain(data_structures_groups::vector_ge &gen, groups::sims *S, int *sequence, int len, int verbose_level)
Definition: action.cpp:1046
void compute_minimal_set(data_structures_groups::vector_ge &gens, int size, long int *set, long int *minimal_set, int *transporter, int verbose_level)
Definition: action.cpp:1581
void make_element_from_base_image(int *Elt, groups::sims *S, int *data, int verbose_level)
Definition: action.cpp:1695
void all_point_orbits_from_generators(groups::schreier &Schreier, groups::strong_generators *SG, int verbose_level)
Definition: action.cpp:1254
void minimize_base_images(int level, groups::sims *S, int *Elt, int verbose_level)
Definition: action.cpp:2303
int find_fixed_points(void *elt, int *fixed_points, int verbose_level)
Definition: action.cpp:579
int compute_orbit_of_point(data_structures_groups::vector_ge &strong_generators, int pt, int *orbit, int verbose_level)
Definition: action.cpp:1114
void element_print_as_permutation(void *elt, std::ostream &ost)
Definition: action_cb.cpp:421
void map_a_set_and_reorder(long int *set, long int *image_set, int n, int *Elt, int verbose_level)
Definition: action.cpp:698
void compute_orbits_on_points(groups::schreier *&Sch, data_structures_groups::vector_ge *gens, int verbose_level)
Definition: action.cpp:2519
void delete_set_orbit(int nb_sets, long int **Sets, int **Transporter)
Definition: action.cpp:1569
long int element_image_of(long int a, void *elt, int verbose_level)
Definition: action_cb.cpp:198
void init_from_data(actions::action *A, int *data, int nb_elements, int elt_size, int verbose_level)
Definition: vector_ge.cpp:175
void init(actions::action *A, int verbose_level)
Definition: vector_ge.cpp:55
void make_element(int *Elt, int *data, int verbose_level)
a matrix group over a finite field in projective, vector space or affine action
Definition: groups.h:318
void make_element(int *Elt, int *data, int verbose_level)
Schreier trees for orbits of groups on points.
Definition: groups.h:839
void compute_all_point_orbits(int verbose_level)
Definition: schreier.cpp:988
void init_generators(data_structures_groups::vector_ge &generators, int verbose_level)
Definition: schreier.cpp:373
void compute_point_orbit(int pt, int verbose_level)
Definition: schreier.cpp:1256
void print_orbit_length_distribution(std::ostream &ost)
void point_stabilizer(actions::action *default_action, ring_theory::longinteger_object &go, groups::sims *&Stab, int orbit_no, int verbose_level)
Definition: schreier.cpp:2388
void init(actions::action *A, int verbose_level)
Definition: schreier.cpp:308
void compute_all_orbits_on_invariant_subset(int len, long int *subset, int verbose_level)
Definition: schreier.cpp:1186
void get_orbit_partition(data_structures::partitionstack &S, int verbose_level)
Definition: schreier.cpp:2112
void coset_rep(int j, int verbose_level)
Definition: schreier.cpp:787
a permutation group represented via a stabilizer chain
Definition: groups.h:1273
void init(actions::action *A, int verbose_level)
Definition: sims.cpp:289
void group_order(ring_theory::longinteger_object &go)
Definition: sims.cpp:951
void init_trivial_group(int verbose_level)
Definition: sims.cpp:584
int closure_group(int nb_times, int verbose_level)
Definition: sims_main.cpp:1353
void coset_rep(int *Elt, int i, int j, int verbose_level)
Definition: sims.cpp:1414
void init_generators(data_structures_groups::vector_ge &generators, int verbose_level)
Definition: sims.cpp:660
void compute_base_orbits(int verbose_level)
Definition: sims_main.cpp:25
void print_group_order(std::ostream &ost)
Definition: sims_io.cpp:357
void point_stabilizer_stabchain_with_action(actions::action *A2, sims &S, int pt, int verbose_level)
int strip_and_add(int *elt, int *residue, int verbose_level)
Definition: sims_main.cpp:379
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
schreier * orbits_on_points_schreier(actions::action *A_given, int verbose_level)
void init_from_sims(groups::sims *S, int verbose_level)
data_structures_groups::vector_ge * gens
Definition: groups.h:1708
void group_order(ring_theory::longinteger_object &go)
void make_element(int *Elt, int *data, int verbose_level)
void make_element(int *Elt, int *data, int verbose_level)
#define NEW_uchar(n)
Definition: foundations.h:634
#define FREE_uchar(p)
Definition: foundations.h:647
#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 Int_vec_zero(A, B)
Definition: foundations.h:713
#define NEW_pint(n)
Definition: foundations.h:627
#define FREE_plint(p)
Definition: foundations.h:643
#define NEW_char(n)
Definition: foundations.h:632
#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 ODD(x)
Definition: foundations.h:222
#define FREE_char(p)
Definition: foundations.h:646
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define FREE_pint(p)
Definition: foundations.h:641
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects
induced_actions::action_on_galois_group * on_Galois_group
induced_actions::action_by_restriction * ABR
induced_actions::action_on_orbits * OnOrbits
induced_actions::action_on_sign * OnSign
induced_actions::action_on_homogeneous_polynomials * OnHP
induced_actions::action_on_wedge_product * AW
induced_actions::action_by_conjugation * ABC
induced_actions::action_by_representation * Rep
induced_actions::action_on_bricks * OnBricks
induced_actions::action_by_subfield_structure * SubfieldStructure
induced_actions::action_on_grassmannian * AG
induced_actions::product_action * product_action_data
induced_actions::action_on_sets * on_sets
induced_actions::action_on_set_partitions * OnSetPartitions
induced_actions::action_on_determinant * AD
induced_actions::action_by_right_multiplication * ABRM
induced_actions::action_on_factor_space * AF
induced_actions::action_on_andre * OnAndre
groups::permutation_representation_domain * perm_grp
induced_actions::action_on_k_subsets * on_k_subsets