Orbiter 2022
Combinatorial Objects
any_group.cpp
Go to the documentation of this file.
1/*
2 * any_group.cpp
3 *
4 * Created on: Sep 26, 2021
5 * Author: betten
6 */
7
8
9
10#include "orbiter.h"
11
12using namespace std;
13using namespace orbiter::layer1_foundations;
14
15namespace orbiter {
16namespace layer5_applications {
17namespace apps_algebra {
18
19
21{
23 LG = NULL;
24
26 PGC = NULL;
27
29 MGC = NULL;
30
31 A_base = NULL;
32 A = NULL;
33
34 //std::string label;
35 //std::string label_tex;
36
37 Subgroup_gens = NULL;
38 Subgroup_sims = NULL;
39
40}
41
43{
44}
45
46
48{
49 int f_v = (verbose_level >= 1);
50
51 if (f_v) {
52 cout << "any_group::init_linear_group" << endl;
53 }
54
57
59 A = LG->A2;
60
61 label.assign(LG->label);
62 label_tex.assign(LG->label_tex);
63
65 cout << "any_group::init_linear_group !LG->f_has_strong_generators" << endl;
66 exit(1);
67 }
69
70 if (f_v) {
71 cout << "any_group::init_linear_group before Subgroup_gens->create_sims" << endl;
72 }
73 Subgroup_sims = Subgroup_gens->create_sims(0/*verbose_level*/);
74 if (f_v) {
75 cout << "any_group::init_linear_group after Subgroup_gens->create_sims" << endl;
76 }
77
78 if (f_v) {
79 cout << "any_group::init_linear_group done" << endl;
80 }
81}
82
84{
85 int f_v = (verbose_level >= 1);
86
87 if (f_v) {
88 cout << "any_group::init_linear_group" << endl;
89 }
90
93
95 A = PGC->A2;
96
97 label.assign(PGC->label);
98 label_tex.assign(PGC->label_tex);
99
101 cout << "any_group::init_linear_group !PGC->f_has_strong_generators" << endl;
102 exit(1);
103 }
105
106 if (f_v) {
107 cout << "any_group::init_permutation_group before Subgroup_gens->create_sims_in_different_action" << endl;
108 }
110 A_base, 0 /*verbose_level*/);
111 //Subgroup_sims = Subgroup_gens->create_sims(verbose_level);
112 if (f_v) {
113 cout << "any_group::init_permutation_group after Subgroup_gens->create_sims_in_different_action" << endl;
114 }
115
116 if (f_v) {
117 cout << "any_group::init_linear_group done" << endl;
118 }
119}
120
122{
123 int f_v = (verbose_level >= 1);
124
125 if (f_v) {
126 cout << "any_group::init_modified_group" << endl;
127 }
128
131
132 A_base = MGC->A_base;
133 A = MGC->A_modified;
134
136 cout << "any_group::init_linear_group !PGC->f_has_strong_generators" << endl;
137 exit(1);
138 }
140
141 label.assign(A->label);
142 label_tex.assign(A->label_tex);
143
144 if (f_v) {
145 cout << "any_group::init_modified_group done" << endl;
146 }
147}
148
149
150
153 int f_sylow, int f_group_table, int f_classes,
154 int verbose_level)
155{
156 int f_v = (verbose_level >= 1);
157
158
159 if (f_v) {
160 cout << "any_group::create_latex_report" << endl;
161 }
162
163 if (f_linear_group) {
164 if (f_v) {
165 cout << "any_group::create_latex_report linear group" << endl;
166 }
168 f_sylow, f_group_table, f_classes,
169 verbose_level);
170 }
171 else if (f_permutation_group) {
172 if (f_v) {
173 cout << "any_group::create_latex_report permutation group" << endl;
174 }
176 O,
177 verbose_level);
178 }
179 else if (f_modified_group) {
180 if (f_v) {
181 cout << "any_group::create_latex_report modified group" << endl;
182 }
184 O,
185 verbose_level);
186
187 }
188 else {
189 cout << "any_group::create_latex_report unknown type of group" << endl;
190 exit(1);
191 }
192}
193
195{
196 int f_v = (verbose_level >= 1);
197
198 if (f_v) {
199 cout << "any_group::do_export_orbiter" << endl;
200 }
201
202 string fname;
204
205 if (f_v) {
206 cout << "any_group::do_export_orbiter label=" << label << endl;
207 }
208 fname.assign(label);
209 fname.append(".makefile");
210 {
211 ofstream fp(fname);
212
213 if (Subgroup_gens) {
214 if (f_v) {
215 cout << "any_group::do_export_orbiter using Subgroup_gens" << endl;
216 }
217 Subgroup_gens->export_to_orbiter_as_bsgs(A2, fname, label, label_tex, verbose_level);
218 }
219 else if (A->f_has_strong_generators) {
220 if (f_v) {
221 cout << "any_group::do_export_orbiter using A_base->Strong_gens" << endl;
222 }
224 }
225 else {
226 cout << "any_group::do_export_orbiter no generators to export" << endl;
227 exit(1);
228 }
229
230 }
231 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
232
233
234 if (f_v) {
235 cout << "any_group::do_export_orbiter done" << endl;
236 }
237}
238
239
240
241void any_group::do_export_gap(int verbose_level)
242{
243 int f_v = (verbose_level >= 1);
244
245 if (f_v) {
246 cout << "any_group::do_export_gap" << endl;
247 }
248
249 string fname;
251
252 fname.assign(label);
253 fname.append("_generators.gap");
254 {
255 ofstream fp(fname);
256
257 if (Subgroup_gens) {
258 if (f_v) {
259 cout << "any_group::do_export_gap using Subgroup_gens" << endl;
260 }
262 }
263 else if (A->f_has_strong_generators) {
264 if (f_v) {
265 cout << "any_group::do_export_gap using A_base->Strong_gens" << endl;
266 }
268 }
269 else {
270 cout << "any_group::do_export_gap no generators to export" << endl;
271 exit(1);
272 }
273
274 }
275 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
276
277
278 if (f_v) {
279 cout << "any_group::do_export_gap done" << endl;
280 }
281}
282
283void any_group::do_export_magma(int verbose_level)
284{
285 int f_v = (verbose_level >= 1);
286
287 if (f_v) {
288 cout << "any_group::do_export_magma" << endl;
289 }
290
291 string fname;
293
294 fname.assign(label);
295 fname.append("_generators.magma");
296 {
297 ofstream fp(fname);
299
301 SG->export_magma(LG->A_linear, fp, verbose_level);
302 }
303 if (f_v) {
304 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
305 }
306
307
308 if (f_v) {
309 cout << "any_group::do_export_magma done" << endl;
310 }
311}
312
313void any_group::do_canonical_image_GAP(std::string &input_set_text, int verbose_level)
314{
315 int f_v = (verbose_level >= 1);
316
317 if (f_v) {
318 cout << "any_group::do_canonical_image_GAP" << endl;
319 }
320
321 string fname;
323
324 fname.assign(label);
325 fname.append("_canonical_image.gap");
326 {
327 ofstream ost(fname);
329
331 SG->canonical_image_GAP(input_set_text, ost);
332 }
333 if (f_v) {
334 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
335 }
336
337
338 if (f_v) {
339 cout << "any_group::do_canonical_image_GAP done" << endl;
340 }
341}
342
343void any_group::create_group_table(int verbose_level)
344{
345 int f_v = (verbose_level >= 1);
346
347 if (f_v) {
348 cout << "any_group::create_group_table" << endl;
349 }
350 int goi;
351
352
353
355
356 if (f_v) {
357 cout << "group order = " << goi << endl;
358 }
359
360
361 string fname;
362 int *Table;
363 long int n;
365
366 Subgroup_sims->create_group_table(Table, n, verbose_level);
367
368 if (n != goi) {
369 cout << "any_group::create_group_table n != goi" << endl;
370 exit(1);
371 }
372
373 fname.assign(label);
374 fname.append("_group_table.csv");
375
376 cout << "The group table is:" << endl;
377 Int_matrix_print(Table, n, n);
378
379 Fio.int_matrix_write_csv(fname, Table, n, n);
380 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
381
382 FREE_int(Table);
383
384 if (f_v) {
385 cout << "any_group::create_group_table done" << endl;
386 }
387}
388
389void any_group::normalizer(int verbose_level)
390{
391 int f_v = (verbose_level >= 1);
392
393 if (f_v) {
394 cout << "any_group::normalizer" << endl;
395 }
396 string fname_magma_prefix;
397 groups::sims *G;
398 groups::sims *H;
403
404
405 fname_magma_prefix.assign(LG->label);
406 fname_magma_prefix.append("_normalizer");
407
408 G = LG->initial_strong_gens->create_sims(verbose_level);
409 H = LG->Strong_gens->create_sims(verbose_level);
410
411 if (f_v) {
412 cout << "group order G = " << G->group_order_lint() << endl;
413 cout << "group order H = " << H->group_order_lint() << endl;
414 cout << "before A->normalizer_using_MAGMA" << endl;
415 }
416 A->normalizer_using_MAGMA(fname_magma_prefix,
417 G, H, gens_N, verbose_level);
418
420 LG->Strong_gens->group_order(H_order);
421 gens_N->group_order(N_order);
422 if (f_v) {
423 cout << "group order G = " << G->group_order_lint() << endl;
424 cout << "group order H = " << H_order << endl;
425 }
426 if (f_v) {
427 cout << "group order N = " << N_order << endl;
428 cout << "Strong generators for the normalizer of H are:" << endl;
429 gens_N->print_generators_tex(cout);
430 cout << "Strong generators for the normalizer of H as permutations are:" << endl;
432 }
433
434
435
436 string fname;
437
438 fname.assign(fname_magma_prefix);
439 fname.append(".tex");
440
441
442 {
443 char title[1000];
444 char author[1000];
445
446 snprintf(title, 1000, "Normalizer of subgroup %s", LG->label_tex.c_str());
447 //strcpy(author, "");
448 author[0] = 0;
449
450
451 {
452 ofstream ost(fname);
454
455 L.head(ost,
456 FALSE /* f_book*/,
457 TRUE /* f_title */,
458 title, author,
459 FALSE /* f_toc */,
460 FALSE /* f_landscape */,
461 TRUE /* f_12pt */,
462 TRUE /* f_enlarged_page */,
463 TRUE /* f_pagenumbers */,
464 NULL /* extra_praeamble */);
465
466 ost << "\\noindent The group $" << LG->label_tex << "$ "
467 "of order " << H_order << " is:\\\\" << endl;
469
470 ost << "\\bigskip" << endl;
471
472 ost << "Inside the group of order " << G_order << ", "
473 "the normalizer has order " << N_order << ":\\\\" << endl;
474 if (f_v) {
475 cout << "group_theoretic_activity::normalizer before report" << endl;
476 }
477 gens_N->print_generators_tex(ost);
478
479 if (f_v) {
480 cout << "group_theoretic_activity::normalizer after report" << endl;
481 }
482
483
484 L.foot(ost);
485
486 }
488
489 cout << "written file " << fname << " of size "
490 << Fio.file_size(fname) << endl;
491 }
492
493
494
495 if (f_v) {
496 cout << "any_group::normalizer done" << endl;
497 }
498}
499
501 std::string &element_label,
502 std::string &element_description_text,
503 int verbose_level)
504{
505 int f_v = (verbose_level >= 1);
506
507 if (f_v) {
508 cout << "any_group::centralizer" << endl;
509 }
510
512 groups::sims *S;
514
516
517 S = SG->create_sims(verbose_level);
518
519 if (f_v) {
520 cout << "any_group::centralizer "
521 "before Algebra.centralizer_of_element" << endl;
522 }
524 LG->A2, S,
525 element_description_text,
526 element_label, verbose_level);
527 if (f_v) {
528 cout << "any_group::centralizer "
529 "after Algebra.centralizer_of_element" << endl;
530 }
531
532 FREE_OBJECT(S);
533
534 if (f_v) {
535 cout << "any_group::centralizer done" << endl;
536 }
537}
538
540 std::string &element_label,
541 std::string &element_description_text,
542 int verbose_level)
543{
544 int f_v = (verbose_level >= 1);
545
546 if (f_v) {
547 cout << "any_group::normalizer_of_cyclic_subgroup" << endl;
548 }
549
551 groups::sims *S;
553
555 S = SG->create_sims(verbose_level);
556
557 if (f_v) {
558 cout << "any_group::normalizer_of_cyclic_subgroup "
559 "before Algebra.normalizer_of_cyclic_subgroup" << endl;
560 }
562 LG->A2, S,
563 element_description_text,
564 element_label, verbose_level);
565 if (f_v) {
566 cout << "any_group::normalizer_of_cyclic_subgroup "
567 "after Algebra.normalizer_of_cyclic_subgroup" << endl;
568 }
569
570 FREE_OBJECT(S);
571
572 if (f_v) {
573 cout << "any_group::normalizer_of_cyclic_subgroup done" << endl;
574 }
575}
576
577
579 int order_of_subgroup,
580 int verbose_level)
581{
582 int f_v = (verbose_level >= 1);
583
584 if (f_v) {
585 cout << "any_group::do_find_subgroups" << endl;
586 }
587
589 groups::sims *S;
591
593
594 int nb_subgroups;
597
598
599 S = SG->create_sims(verbose_level);
600
601 Algebra.find_subgroups(
602 LG->A2, S,
603 order_of_subgroup,
604 LG->A2->label,
605 nb_subgroups,
606 H_gens,
607 N_gens,
608 verbose_level);
609
610
611 cout << "We found " << nb_subgroups << " subgroups" << endl;
612
613
614 string fname;
615 string title;
616 const char *author = "Orbiter";
617 const char *extras_for_preamble = "";
618
620
621 fname.assign(LG->A2->label);
622 fname.append("_report.tex");
623
624
625 char str[1000];
626
627 sprintf(str, "Subgroups of order $%d$ in $", order_of_subgroup);
628 title.assign(str);
629 title.append(LG->A2->label_tex);
630 title.append("$");
631
632
633 {
634 ofstream fp(fname);
636 //latex_head_easy(fp);
637 L.head(fp,
638 FALSE /* f_book */, TRUE /* f_title */,
639 title.c_str(), author,
640 FALSE /*f_toc*/, FALSE /* f_landscape*/, FALSE /* f_12pt*/,
641 TRUE /*f_enlarged_page*/, TRUE /* f_pagenumbers*/,
642 extras_for_preamble);
643
645 nb_subgroups, H_gens, N_gens,
646 verbose_level);
647
648 L.foot(fp);
649 }
650
651 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
652
653
654 FREE_OBJECT(S);
655 FREE_OBJECTS(H_gens);
656 FREE_OBJECTS(N_gens);
657
658
659 if (f_v) {
660 cout << "any_group::do_find_subgroups done" << endl;
661 }
662}
663
664
665void any_group::print_elements(int verbose_level)
666{
667 int f_v = (verbose_level >= 1);
668
669 if (f_v) {
670 cout << "any_group::print_elements" << endl;
671 }
672
674
676
677
678 groups::sims *H;
679
680 //G = LG->initial_strong_gens->create_sims(verbose_level);
681 H = SG->create_sims(verbose_level);
682
683 //cout << "group order G = " << G->group_order_int() << endl;
684 cout << "group order H = " << H->group_order_lint() << endl;
685
686 int *Elt;
688 int i; //, cnt;
689
690 Elt = NEW_int(A->elt_size_in_int);
691 H->group_order(go);
692
693
694 //cnt = 0;
695 for (i = 0; i < go.as_lint(); i++) {
696 H->element_unrank_lint(i, Elt);
697
698 cout << "Element " << setw(5) << i << " / "
699 << go.as_int() << ":" << endl;
700 A->element_print(Elt, cout);
701 cout << endl;
703 cout << endl;
704
705
706
707 }
708 FREE_int(Elt);
709 if (f_v) {
710 cout << "any_group::print_elements done" << endl;
711 }
712}
713
715 int verbose_level)
716{
717 int f_v = (verbose_level >= 1);
718
719 if (f_v) {
720 cout << "any_group::print_elements_tex" << endl;
721 }
722
724
725
727
728 groups::sims *H;
729
730 //G = LG->initial_strong_gens->create_sims(verbose_level);
731 H = SG->create_sims(verbose_level);
732
733 //cout << "group order G = " << G->group_order_int() << endl;
734 cout << "group order H = " << H->group_order_lint() << endl;
735
736 int *Elt;
738
739 Elt = NEW_int(A->elt_size_in_int);
740 H->group_order(go);
741
742 string fname;
743
744 fname.assign(label);
745 fname.append("_elements.tex");
746
747
748 {
749 ofstream fp(fname);
751 L.head_easy(fp);
752
754 //H->print_all_group_elements_with_permutations_tex(fp);
755
756 //Schreier.print_and_list_orbits_tex(fp);
757
758
759 L.foot(fp);
760 }
761
762 FREE_int(Elt);
763 if (f_v) {
764 cout << "any_group::print_elements_tex done" << endl;
765 }
766}
767
769 std::string &Elements_text,
770 int verbose_level)
771{
772 int f_v = (verbose_level >= 1);
773
774 if (f_v) {
775 cout << "any_group::order_of_products_of_elements" << endl;
776 }
777
779
780
782
783 groups::sims *H;
784
785 H = SG->create_sims(verbose_level);
786
787 //cout << "group order G = " << G->group_order_int() << endl;
788 cout << "group order H = " << H->group_order_lint() << endl;
789
790 int *Elt;
792
793 Elt = NEW_int(A->elt_size_in_int);
794 H->group_order(go);
795
796 int *elements;
797 int nb_elements;
798
799 Int_vec_scan(Elements_text, elements, nb_elements);
800
801
802 string fname;
803
804 fname.assign(label);
805 fname.append("_elements.tex");
806
807
808 {
809 ofstream fp(fname);
811 L.head_easy(fp);
812
814 //H->print_all_group_elements_with_permutations_tex(fp);
815
816 //Schreier.print_and_list_orbits_tex(fp);
817
818 int *order_table;
819 int i;
820
821
822 int j;
823 int *Elt1, *Elt2, *Elt3;
824
825 Elt1 = NEW_int(A->elt_size_in_int);
826 Elt2 = NEW_int(A->elt_size_in_int);
827 Elt3 = NEW_int(A->elt_size_in_int);
828
829 order_table = NEW_int(nb_elements * nb_elements);
830 for (i = 0; i < nb_elements; i++) {
831
832 H->element_unrank_lint(elements[i], Elt1);
833
834
835 for (j = 0; j < nb_elements; j++) {
836
837 H->element_unrank_lint(elements[j], Elt2);
838
839 A->element_mult(Elt1, Elt2, Elt3, 0);
840
841 order_table[i * nb_elements + j] = A->element_order(Elt3);
842
843 }
844 }
845 FREE_int(Elt1);
846 FREE_int(Elt2);
847 FREE_int(Elt3);
848
849 //latex_interface L;
850
851 fp << "$$" << endl;
852 L.print_integer_matrix_with_labels(fp, order_table,
853 nb_elements, nb_elements, elements, elements, TRUE /* f_tex */);
854 fp << "$$" << endl;
855
856 L.foot(fp);
857 }
858
859 FREE_int(Elt);
860 if (f_v) {
861 cout << "any_group::order_of_products_of_elements done" << endl;
862 }
863}
864
865void any_group::save_elements_csv(std::string &fname, int verbose_level)
866{
867 int f_v = (verbose_level >= 1);
868
869 if (f_v) {
870 cout << "any_group::save_elements_csv" << endl;
871 }
872
873
874 Subgroup_sims->all_elements_save_csv(fname, verbose_level);
875
876 if (f_v) {
877 cout << "any_group::save_elements_csv done" << endl;
878 }
879}
880
881void any_group::multiply_elements_csv(std::string &fname1,
882 std::string &fname2, std::string &fname3,
883 int f_column_major_ordering, int verbose_level)
884{
885 int f_v = (verbose_level >= 1);
886
887 if (f_v) {
888 cout << "any_group::multiply_elements_csv" << endl;
889 }
890
892 int n1, n2, n3;
893 int i, j, k;
894
895 V1.read_column_csv(fname1, A, 1 /* col_idx */, verbose_level);
896 n1 = V1.len;
897
898 V2.read_column_csv(fname2, A, 1 /* col_idx */, verbose_level);
899 n2 = V2.len;
900
901 n3 = n1 * n2;
902
903 if (f_v) {
904 cout << "any_group::multiply_elements_csv "
905 "n1=" << V1.len << " n2=" << V2.len << " n3=" << n3 << endl;
906 }
907
908 V3.init(A, 0 /* vl */);
909 V3.allocate(n3, 0 /* vl */);
910
911 if (f_column_major_ordering) {
912 k = 0;
913 for (j = 0; j < n2; j++) {
914 for (i = 0; i < n1; i++, k++) {
915 A->mult(V1.ith(i), V2.ith(j), V3.ith(k));
916 }
917 }
918 }
919 else {
920 k = 0;
921 for (i = 0; i < n1; i++) {
922 for (j = 0; j < n2; j++, k++) {
923 A->mult(V1.ith(i), V2.ith(j), V3.ith(k));
924 }
925 }
926
927 }
928
929 //Subgroup_sims->all_elements_save_csv(fname, verbose_level);
930 V3.save_csv(fname3, verbose_level);
931
932 if (f_v) {
933 cout << "any_group::multiply_elements_csv done" << endl;
934 }
935}
936
937void any_group::apply_elements_to_set_csv(std::string &fname1, std::string &fname2,
938 std::string &set_text,
939 int verbose_level)
940{
941 int f_v = (verbose_level >= 1);
942
943 if (f_v) {
944 cout << "any_group::apply_elements_to_set_csv" << endl;
945 }
946
948 int n1;
949 int i, j;
950 long int *set;
951 long int *set_image;
952 int *set_image_int;
953 int sz;
954 int *Rk;
956
957
958 Lint_vec_scan(set_text, set, sz);
959
960 V1.read_column_csv(fname1, A, 1 /* col_idx */, verbose_level);
961 n1 = V1.len;
962
963 set_image = NEW_lint(sz);
964 set_image_int = NEW_int(sz);
965 Rk = NEW_int(n1);
966
967 if (f_v) {
968 cout << "any_group::apply_elements_to_set_csv "
969 "n1=" << V1.len << endl;
970 }
971
972 for (i = 0; i < n1; i++) {
973 A->map_a_set_and_reorder(set, set_image,
974 sz, V1.ith(i), 0 /* verbose_level */);
975
976 for (j = 0; j < sz; j++) {
977 set_image_int[j] = set_image[j];
978 }
979 Rk[i] = Combi.rank_k_subset(set_image_int, A->degree, sz);
980
981 cout << i << " : ";
982 Lint_vec_print(cout, set_image, sz);
983 cout << i << " : ";
984 cout << Rk[i];
985 cout << endl;
986
987 }
988
989
990 cout << "Image sets by rank: ";
991 Int_vec_print_fully(cout, Rk, n1);
992 cout << endl;
993
994
995 if (!Combi.is_permutation(Rk, n1)) {
996 cout << "any_group::apply_elements_to_set_csv "
997 "The set Rk is *not* a permutation" << endl;
998 exit(1);
999 }
1000 else {
1001 cout << "any_group::apply_elements_to_set_csv "
1002 "The set Rk is a permutation" << endl;
1003 }
1004
1005 FREE_lint(set);
1006 FREE_lint(set_image);
1007 FREE_int(set_image_int);
1008
1009 if (f_v) {
1010 cout << "any_group::apply_elements_to_set_csv done" << endl;
1011 }
1012}
1013
1014
1015
1016
1017void any_group::element_rank(std::string &elt_data, int verbose_level)
1018{
1019 int f_v = (verbose_level >= 1);
1020
1021 if (f_v) {
1022 cout << "any_group::element_rank" << endl;
1023 }
1024
1025 actions::action *A1;
1026
1027 A1 = A;
1028
1029 groups::sims *H;
1030
1031 //G = LG->initial_strong_gens->create_sims(verbose_level);
1033
1034 SG = get_strong_generators();
1035 H = SG->create_sims(verbose_level);
1036
1037 if (f_v) {
1038 //cout << "group order G = " << G->group_order_int() << endl;
1039 cout << "group order H = " << H->group_order_lint() << endl;
1040 }
1041
1042 if (f_v) {
1043 cout << "creating element " << elt_data << endl;
1044 }
1045 int *Elt;
1046
1047 Elt = NEW_int(A1->elt_size_in_int);
1048 A1->make_element_from_string(Elt, elt_data, 0);
1049
1050 if (f_v) {
1051 cout << "Element :" << endl;
1052 A1->element_print(Elt, cout);
1053 cout << endl;
1054 }
1055
1057 H->element_rank(a, Elt);
1058
1059 if (f_v) {
1060 cout << "The rank of the element is " << a << endl;
1061 }
1062
1063
1064 FREE_int(Elt);
1065 FREE_OBJECT(H);
1066
1067
1068
1069 if (f_v) {
1070 cout << "any_group::element_rank done" << endl;
1071 }
1072}
1073
1074void any_group::element_unrank(std::string &rank_string, int verbose_level)
1075{
1076 int f_v = (verbose_level >= 1);
1077
1078 if (f_v) {
1079 cout << "any_group::element_unrank" << endl;
1080 }
1081
1082 actions::action *A1;
1083
1084 A1 = A;
1085
1086 groups::sims *H;
1088
1089 SG = get_strong_generators();
1090
1091 //G = LG->initial_strong_gens->create_sims(verbose_level);
1092 H = SG->create_sims(verbose_level);
1093
1094 //cout << "group order G = " << G->group_order_int() << endl;
1095 if (f_v) {
1096 cout << "group order H = " << H->group_order_lint() << endl;
1097 }
1098
1099 int *Elt;
1100
1101 Elt = NEW_int(A1->elt_size_in_int);
1102
1103
1105
1106 a.create_from_base_10_string(rank_string.c_str(), 0 /*verbose_level*/);
1107
1108 if (f_v) {
1109 cout << "Creating element of rank " << a << endl;
1110 }
1111
1112 H->element_unrank(a, Elt);
1113
1114 if (f_v) {
1115 cout << "Element :" << endl;
1116 A1->element_print(Elt, cout);
1117 cout << endl;
1118 }
1119
1120
1121 FREE_int(Elt);
1122 FREE_OBJECT(H);
1123
1124 if (f_v) {
1125 cout << "any_group::element_unrank done" << endl;
1126 }
1127}
1128
1129
1130
1131void any_group::conjugacy_class_of(std::string &elt_data, int verbose_level)
1132{
1133 int f_v = (verbose_level >= 1);
1134
1135 if (f_v) {
1136 cout << "any_group::conjugacy_class_of" << endl;
1137 }
1138
1139#if 0
1140 sims *H;
1141
1142 //G = LG->initial_strong_gens->create_sims(verbose_level);
1143 H = LG->Strong_gens->create_sims(verbose_level);
1144
1145 //cout << "group order G = " << G->group_order_int() << endl;
1146 cout << "group order H = " << H->group_order_lint() << endl;
1147#endif
1148
1149 int *Elt;
1150
1151 Elt = NEW_int(A->elt_size_in_int);
1152
1154
1155#if 1
1156 cout << "creating element " << elt_data << endl;
1157
1158 A->make_element_from_string(Elt, elt_data, 0);
1159
1160 Subgroup_sims->element_rank(a, Elt);
1161
1162 a.assign_to(b);
1163
1164
1165#else
1166
1167
1168 a.create_from_base_10_string(rank_string.c_str(), 0 /*verbose_level*/);
1169
1170 cout << "Creating element of rank " << a << endl;
1171
1172 a.assign_to(b);
1173
1174 H->element_unrank(a, Elt);
1175
1176#endif
1177
1178 cout << "Element :" << endl;
1179 A->element_print(Elt, cout);
1180 cout << endl;
1181
1182
1183 actions::action *A_conj;
1184
1186 Subgroup_sims /*Base_group*/, FALSE /* f_ownership */,
1187 verbose_level);
1188
1189
1190 cout << "created action A_conj of degree " << A_conj->degree << endl;
1191
1192#if 0
1193 schreier *Sch;
1194
1196 A_conj, b.as_lint(), verbose_level);
1197
1198 cout << "Orbits on itself by conjugation:\\\\" << endl;
1199 Sch->print_orbit_reps(cout);
1200
1201
1202 FREE_OBJECT(Sch);
1203#else
1204
1205
1206 orbit_of_sets Orb;
1207 long int set[1];
1209
1210 set[0] = b.as_lint();
1211
1212 Orb.init(A, A_conj,
1213 set, 1 /* sz */, LG->Strong_gens->gens, verbose_level);
1214 cout << "Found an orbit of size " << Orb.used_length << endl;
1215
1216 std::vector<long int> Orbit;
1217
1218 cout << "before Orb.get_orbit_of_points" << endl;
1219 Orb.get_orbit_of_points(Orbit, verbose_level);
1220 cout << "Found an orbit of size " << Orbit.size() << endl;
1221
1222 int *M;
1223 int i, j;
1224
1225 M = NEW_int(Orbit.size() * A->make_element_size);
1226 for (i = 0; i < Orbit.size(); i++) {
1227 Subgroup_sims->element_unrank_lint(Orbit[i], Elt);
1228 for (j = 0; j < A->make_element_size; j++) {
1229 M[i * A->make_element_size + j] = Elt[j];
1230 }
1231 //M[i] = Orbit[i];
1232 }
1233 string fname;
1234
1235 fname.assign(LG->label);
1236 fname.append("_class_of_");
1237 fname.append(elt_data);
1238 fname.append(".csv");
1239
1240 Fio.int_matrix_write_csv(fname, M, Orbit.size(), A->make_element_size);
1241
1242 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
1243
1244 FREE_int(M);
1245
1246#endif
1247
1248 FREE_OBJECT(A_conj);
1249 //FREE_OBJECT(H);
1250
1251
1252
1253 FREE_int(Elt);
1254 if (f_v) {
1255 cout << "any_group::conjugacy_class_of done" << endl;
1256 }
1257}
1258
1259
1261{
1262 int f_v = (verbose_level >= 1);
1263 //int f_vv = (verbose_level >= 5);
1264
1265 if (f_v) {
1266 cout << "any_group::do_reverse_isomorphism_exterior_square" << endl;
1267 }
1268
1269
1270 if (LG->f_has_nice_gens) {
1271 if (f_v) {
1272 cout << "any_group::do_reverse_isomorphism_exterior_square nice generators are:" << endl;
1273 LG->nice_gens->print(cout);
1274 }
1276 }
1277 else {
1278 if (f_v) {
1279 cout << "any_group::do_reverse_isomorphism_exterior_square strong generators are:" << endl;
1281 }
1283 }
1284
1285 if (f_v) {
1286 cout << "any_group::do_reverse_isomorphism_exterior_square done" << endl;
1287 }
1288}
1289
1290
1291
1293 int number_of_columns, int first_column, int verbose_level)
1294{
1295 int f_v = (verbose_level >= 1);
1296
1297 if (f_v) {
1298 cout << "any_group::orbits_on_set_system_from_file" << endl;
1299 }
1300 if (f_v) {
1301 cout << "computing orbits on set system from file "
1302 << fname_csv << ":" << endl;
1303 }
1305 int *M;
1306 int m, n;
1307 long int *Table;
1308 int i, j;
1309
1310 Fio.int_matrix_read_csv(fname_csv, M,
1311 m, n, verbose_level);
1312 if (f_v) {
1313 cout << "read a matrix of size " << m << " x " << n << endl;
1314 }
1315
1316
1317 //orbits_on_set_system_first_column = atoi(argv[++i]);
1318 //orbits_on_set_system_number_of_columns = atoi(argv[++i]);
1319
1320
1321 Table = NEW_lint(m * number_of_columns);
1322 for (i = 0; i < m; i++) {
1323 for (j = 0; j < number_of_columns; j++) {
1324 Table[i * number_of_columns + j] =
1325 M[i * n + first_column + j];
1326 }
1327 }
1328 actions::action *A_on_sets;
1329 int set_size;
1330
1331 set_size = number_of_columns;
1332
1333 if (f_v) {
1334 cout << "creating action on sets:" << endl;
1335 }
1336 A_on_sets = A->create_induced_action_on_sets(m /* nb_sets */,
1337 set_size, Table,
1338 verbose_level);
1339
1340 groups::schreier *Sch;
1341 int first, a;
1342
1343 if (f_v) {
1344 cout << "computing orbits on sets:" << endl;
1345 }
1346 A_on_sets->compute_orbits_on_points(Sch,
1347 LG->Strong_gens->gens, verbose_level);
1348
1349 if (f_v) {
1350 cout << "The orbit lengths are:" << endl;
1351 Sch->print_orbit_lengths(cout);
1352 }
1353
1354 if (f_v) {
1355 cout << "The orbits are:" << endl;
1356 //Sch->print_and_list_orbits(cout);
1357 for (i = 0; i < Sch->nb_orbits; i++) {
1358 cout << " Orbit " << i << " / " << Sch->nb_orbits
1359 << " : " << Sch->orbit_first[i] << " : " << Sch->orbit_len[i];
1360 cout << " : ";
1361
1362 first = Sch->orbit_first[i];
1363 a = Sch->orbit[first + 0];
1364 cout << a << " : ";
1365 Lint_vec_print(cout, Table + a * set_size, set_size);
1366 cout << endl;
1367 //Sch->print_and_list_orbit_tex(i, ost);
1368 }
1369 }
1370 string fname;
1372
1373 fname.assign(fname_csv);
1374 ST.chop_off_extension(fname);
1375 fname.append("_orbit_reps.txt");
1376
1377 {
1378 ofstream ost(fname);
1379
1380 for (i = 0; i < Sch->nb_orbits; i++) {
1381
1382 first = Sch->orbit_first[i];
1383 a = Sch->orbit[first + 0];
1384 ost << set_size;
1385 for (j = 0; j < set_size; j++) {
1386 ost << " " << Table[a * set_size + j];
1387 }
1388 ost << endl;
1389 }
1390 ost << -1 << " " << Sch->nb_orbits << endl;
1391 }
1392 if (f_v) {
1393 cout << "any_group::orbits_on_set_system_from_file done" << endl;
1394 }
1395}
1396
1397void any_group::orbits_on_set_from_file(std::string &fname_csv, int verbose_level)
1398{
1399 int f_v = (verbose_level >= 1);
1400
1401 if (f_v) {
1402 cout << "any_group::orbits_on_set_from_file" << endl;
1403 }
1404
1405 if (f_v) {
1406 cout << "computing orbit of set from file "
1407 << fname_csv << ":" << endl;
1408 }
1410 long int *the_set;
1411 int set_sz;
1412
1413 Fio.read_set_from_file(fname_csv,
1414 the_set, set_sz, 0 /*verbose_level*/);
1415 if (f_v) {
1416 cout << "read a set of size " << set_sz << endl;
1417 }
1418
1419
1420 string label_set;
1422
1423 label_set.assign(fname_csv);
1424 ST.chop_off_extension(label_set);
1425
1427 long int *Table;
1428 int size;
1429
1431 the_set, set_sz,
1432 A, A,
1434 label_set,
1435 LG->label,
1436 Table, size,
1437 verbose_level);
1438
1439 FREE_lint(Table);
1440
1441 if (f_v) {
1442 cout << "any_group::orbits_on_set_from_file done" << endl;
1443 }
1444}
1445
1446
1447void any_group::orbit_of(int point_idx, int verbose_level)
1448{
1449 int f_v = (verbose_level >= 1);
1450
1451 if (f_v) {
1452 cout << "any_group::orbit_of" << endl;
1453 }
1454 groups::schreier *Sch;
1456
1457 cout << "computing orbit of point " << point_idx << ":" << endl;
1458
1459 //A->all_point_orbits(*Sch, verbose_level);
1460
1461 Sch->init(A, verbose_level - 2);
1462 if (!A->f_has_strong_generators) {
1463 cout << "any_group::orbit_of !f_has_strong_generators" << endl;
1464 exit(1);
1465 }
1466 Sch->init_generators(*LG->Strong_gens->gens /* *strong_generators */, verbose_level - 2);
1467 Sch->initialize_tables();
1468 Sch->compute_point_orbit(point_idx, verbose_level);
1469
1470
1471 cout << "computing orbit of point done." << endl;
1472
1473 string fname_tree_mask;
1474 char str[1000];
1475
1476 fname_tree_mask.assign(LG->label);
1477 sprintf(str, "_orbit_of_point_%d.layered_graph", point_idx);
1478 fname_tree_mask.append(str);
1479
1480
1481 Sch->export_tree_as_layered_graph(0 /* orbit_no */,
1482 fname_tree_mask,
1483 verbose_level - 1);
1484
1486 ring_theory::longinteger_object full_group_order;
1487
1488 LG->Strong_gens->group_order(full_group_order);
1489
1490 cout << "computing the stabilizer of the orbit rep:" << endl;
1491 SG_stab = Sch->stabilizer_orbit_rep(
1492 LG->A_linear,
1493 full_group_order,
1494 0 /* orbit_idx */, verbose_level);
1495 cout << "The stabilizer of the orbit rep has been computed:" << endl;
1496 SG_stab->print_generators(cout);
1497 SG_stab->print_generators_tex();
1498
1499
1500 groups::schreier *shallow_tree;
1501
1502 cout << "computing shallow Schreier tree:" << endl;
1503
1504 #if 0
1505 enum shallow_schreier_tree_strategy Shallow_schreier_tree_strategy =
1507 //shallow_schreier_tree_Seress_deterministic;
1508 //shallow_schreier_tree_Seress_randomized;
1509 //shallow_schreier_tree_Sajeeb;
1510 #endif
1511 int orbit_idx = 0;
1512 int f_randomized = TRUE;
1513
1514 Sch->shallow_tree_generators(orbit_idx,
1515 f_randomized,
1516 shallow_tree,
1517 verbose_level);
1518
1519 cout << "computing shallow Schreier tree done." << endl;
1520
1521 fname_tree_mask.assign(label);
1522 fname_tree_mask.append("_%d_shallow.layered_graph");
1523
1524 shallow_tree->export_tree_as_layered_graph(0 /* orbit_no */,
1525 fname_tree_mask,
1526 verbose_level - 1);
1527 if (f_v) {
1528 cout << "any_group::orbit_of done" << endl;
1529 }
1530}
1531
1533{
1534 int f_v = (verbose_level >= 1);
1535
1536 if (f_v) {
1537 cout << "any_group::orbits_on_points" << endl;
1538 }
1540
1541
1542 int f_load_save = TRUE;
1543 string prefix;
1544
1545 prefix.assign(label);
1546
1547 if (f_v) {
1548 cout << "any_group::orbits_on_points before Algebra.orbits_on_points" << endl;
1549 }
1550 Algebra.orbits_on_points(
1551 A,
1553 f_load_save,
1554 prefix,
1555 Orb,
1556 verbose_level);
1557 if (f_v) {
1558 cout << "any_group::orbits_on_points after Algebra.orbits_on_points" << endl;
1559 }
1560
1561
1562 if (f_v) {
1563 cout << "any_group::orbits_on_points done" << endl;
1564 }
1565}
1566
1570 int subset_size,
1571 int verbose_level)
1572{
1573 int f_v = (verbose_level >= 1);
1574
1575 if (f_v) {
1576 cout << "any_group::orbits_on_subsets subset_size=" << subset_size << endl;
1577 }
1578 //poset_classification *PC;
1580
1582
1583 if (f_v) {
1584 cout << "any_group::orbits_on_subsets control=" << endl;
1585 Control->print();
1586 }
1587 if (f_v) {
1588 cout << "any_group::orbits_on_subsets label=" << label << endl;
1589 }
1590 if (f_v) {
1591 cout << "any_group::orbits_on_subsets A_base=" << endl;
1592 A_base->print_info();
1593 }
1594 if (f_v) {
1595 cout << "any_group::orbits_on_subsets A=" << endl;
1596 A->print_info();
1597 }
1598 if (f_v) {
1599 cout << "any_group::orbits_on_subsets group order" << endl;
1600
1602
1604
1605 cout << go << endl;
1606 }
1607
1608
1609 if (f_v) {
1610 cout << "any_group::orbits_on_subsets "
1611 "before Poset->init_subset_lattice" << endl;
1612 }
1615 verbose_level);
1616
1617 if (f_v) {
1618 cout << "any_group::orbits_on_subsets "
1619 "before Poset->orbits_on_k_sets_compute" << endl;
1620 }
1621 PC = Poset->orbits_on_k_sets_compute(
1622 Control,
1623 subset_size,
1624 verbose_level);
1625 if (f_v) {
1626 cout << "any_group::orbits_on_subsets "
1627 "after Poset->orbits_on_k_sets_compute" << endl;
1628 }
1629
1630 if (f_v) {
1631 cout << "any_group::orbits_on_subsets "
1632 "before orbits_on_poset_post_processing" << endl;
1633 }
1635 PC, subset_size,
1636 verbose_level);
1637 if (f_v) {
1638 cout << "any_group::orbits_on_subsets "
1639 "after orbits_on_poset_post_processing" << endl;
1640 }
1641
1642
1643 if (f_v) {
1644 cout << "any_group::orbits_on_subsets done" << endl;
1645 }
1646}
1647
1648
1651 int depth,
1652 int verbose_level)
1653{
1654 int f_v = (verbose_level >= 1);
1655
1656 if (f_v) {
1657 cout << "any_group::orbits_on_poset_post_processing" << endl;
1658 }
1659
1660
1661
1662#if 0
1663 if (Descr->f_test_if_geometric) {
1664 int d = Descr->test_if_geometric_depth;
1665
1666 //for (depth = 0; depth <= orbits_on_subsets_size; depth++) {
1667
1668 cout << "Orbits on subsets of size " << d << ":" << endl;
1670 FALSE /* f_has_print_function */,
1671 NULL /* void (*print_function)(ostream &ost, int len, int *S, void *data)*/,
1672 NULL /* void *print_function_data*/,
1673 TRUE /* f_show_orbit_decomposition */,
1674 TRUE /* f_show_stab */,
1675 FALSE /* f_save_stab */,
1676 TRUE /* f_show_whole_orbit*/);
1677 int nb_orbits, orbit_idx;
1678
1679 nb_orbits = PC->nb_orbits_at_level(d);
1680 for (orbit_idx = 0; orbit_idx < nb_orbits; orbit_idx++) {
1681
1682 int orbit_length;
1683 long int *Orbit;
1684
1685 cout << "before PC->get_whole_orbit depth " << d
1686 << " orbit " << orbit_idx
1687 << " / " << nb_orbits << ":" << endl;
1688 PC->get_whole_orbit(
1689 d, orbit_idx,
1690 Orbit, orbit_length, verbose_level);
1691 cout << "depth " << d << " orbit " << orbit_idx
1692 << " / " << nb_orbits << " has length "
1693 << orbit_length << ":" << endl;
1694 Orbiter->Lint_vec.matrix_print(Orbit, orbit_length, d);
1695
1696 action *Aut;
1697 longinteger_object ago;
1698 nauty_interface_with_group Nauty;
1699
1700 Aut = Nauty.create_automorphism_group_of_block_system(
1701 A2->degree /* nb_points */,
1702 orbit_length /* nb_blocks */,
1703 depth /* block_size */, Orbit,
1704 verbose_level);
1705 Aut->group_order(ago);
1706 cout << "The automorphism group of the set system "
1707 "has order " << ago << endl;
1708
1709 FREE_OBJECT(Aut);
1710 FREE_lint(Orbit);
1711 }
1712 if (nb_orbits == 2) {
1713 cout << "the number of orbits at depth " << depth
1714 << " is two, we will try create_automorphism_"
1715 "group_of_collection_of_two_block_systems" << endl;
1716 long int *Orbit1;
1717 int orbit_length1;
1718 long int *Orbit2;
1719 int orbit_length2;
1720
1721 cout << "before PC->get_whole_orbit depth " << d
1722 << " orbit " << orbit_idx
1723 << " / " << nb_orbits << ":" << endl;
1724 PC->get_whole_orbit(
1725 depth, 0 /* orbit_idx*/,
1726 Orbit1, orbit_length1, verbose_level);
1727 cout << "depth " << d << " orbit " << 0
1728 << " / " << nb_orbits << " has length "
1729 << orbit_length1 << ":" << endl;
1730 Orbiter->Lint_vec.matrix_print(Orbit1, orbit_length1, d);
1731
1732 PC->get_whole_orbit(
1733 depth, 1 /* orbit_idx*/,
1734 Orbit2, orbit_length2, verbose_level);
1735 cout << "depth " << d << " orbit " << 1
1736 << " / " << nb_orbits << " has length "
1737 << orbit_length2 << ":" << endl;
1738 Orbiter->Lint_vec.matrix_print(Orbit2, orbit_length2, d);
1739
1740 action *Aut;
1741 longinteger_object ago;
1742 nauty_interface_with_group Nauty;
1743
1744 Aut = Nauty.create_automorphism_group_of_collection_of_two_block_systems(
1745 A2->degree /* nb_points */,
1746 orbit_length1 /* nb_blocks */,
1747 depth /* block_size */, Orbit1,
1748 orbit_length2 /* nb_blocks */,
1749 depth /* block_size */, Orbit2,
1750 verbose_level);
1751 Aut->group_order(ago);
1752 cout << "The automorphism group of the collection of two set systems "
1753 "has order " << ago << endl;
1754
1755 FREE_OBJECT(Aut);
1756 FREE_lint(Orbit1);
1757 FREE_lint(Orbit2);
1758
1759 } // if nb_orbits == 2
1760 } // if (f_test_if_geometric)
1761#endif
1762
1763
1764
1765 if (f_v) {
1766 cout << "any_group::orbits_on_poset_post_processing done" << endl;
1767 }
1768}
1769
1770
1771
1772
1773
1774
1775
1776
1777
1779 std::string &elt_label, std::string &elt_text, int verbose_level)
1780{
1781 int f_v = (verbose_level >= 1);
1782
1783 if (f_v) {
1784 cout << "any_group::do_conjugacy_class_of_element" << endl;
1785 }
1786
1787
1788 int *data, sz;
1789
1790 Int_vec_scan(elt_text, data, sz);
1791
1792 if (f_v) {
1793 cout << "computing conjugacy class of ";
1794 Int_vec_print(cout, data, sz);
1795 cout << endl;
1796 }
1797
1798
1799 int *Elt;
1800
1801 Elt = NEW_int(A->elt_size_in_int);
1802 A->make_element(Elt, data, 0 /* verbose_level */);
1803
1804 if (!A->f_has_sims) {
1805 if (f_v) {
1806 cout << "any_group::do_conjugacy_class_of_element "
1807 "Group does not have a sims object" << endl;
1808 }
1809 //exit(1);
1810
1811 {
1812 groups::sims *S;
1813
1814 S = LG->Strong_gens->create_sims(verbose_level);
1815
1816 if (f_v) {
1817 cout << "any_group::do_conjugacy_class_of_element before init_sims" << endl;
1818 }
1819 A->init_sims_only(S, 0/*verbose_level - 1*/);
1820 if (f_v) {
1821 cout << "any_group::do_conjugacy_class_of_element after init_sims" << endl;
1822 }
1823 }
1824
1825 }
1826 groups::sims *S;
1827
1828 S = A->Sims;
1829
1830 long int the_set[1];
1831 int set_size = 1;
1832
1833 the_set[0] = S->element_rank_lint(Elt);
1834
1835 if (f_v) {
1836 cout << "computing conjugacy class of " << endl;
1837 A->element_print_latex(Elt, cout);
1838 cout << "which is the set ";
1839 Lint_vec_print(cout, the_set, set_size);
1840 cout << endl;
1841 }
1842
1843
1844 actions::action A_conj;
1845 if (f_v) {
1846 cout << "any_group::do_conjugacy_class_of_element "
1847 "before A_conj.induced_action_by_conjugation" << endl;
1848 }
1850 FALSE /* f_ownership */, FALSE /* f_basis */,
1851 verbose_level);
1852 if (f_v) {
1853 cout << "any_group::do_conjugacy_class_of_element "
1854 "created action by conjugation" << endl;
1855 }
1856
1857
1858
1859 //schreier Classes;
1860 //Classes.init(&A_conj, verbose_level - 2);
1861 //Classes.init_generators(*A1->Strong_gens->gens, verbose_level - 2);
1862 //cout << "Computing orbits:" << endl;
1863 //Classes.compute_all_point_orbits(1 /*verbose_level - 1*/);
1864 //cout << "found " << Classes.nb_orbits << " conjugacy classes" << endl;
1865
1866
1867
1868
1870
1871 long int *Table;
1872 int orbit_length;
1873
1875 the_set, set_size,
1876 A, &A_conj,
1878 elt_label,
1879 LG->label,
1880 Table,
1881 orbit_length,
1882 verbose_level);
1883
1884
1885 // write as txt file:
1886
1887 string fname;
1889
1890 fname.assign(elt_label);
1891 fname.append("_orbit_under_");
1892 fname.append(LG->label);
1893 fname.append("_elements_coded.csv");
1894
1895 if (f_v) {
1896 cout << "Writing table to file " << fname << endl;
1897 }
1898 {
1899 ofstream ost(fname);
1900 int i;
1901
1902 // header line:
1903 ost << "ROW";
1904 for (int j = 0; j < A->make_element_size; j++) {
1905 ost << ",C" << j;
1906 }
1907 ost << endl;
1908
1909 for (i = 0; i < orbit_length; i++) {
1910
1911 ost << i;
1912 S->element_unrank_lint(Table[i], Elt);
1913
1914 for (int j = 0; j < A->make_element_size; j++) {
1915 ost << "," << Elt[j];
1916 }
1917 ost << endl;
1918 }
1919 ost << "END" << endl;
1920 }
1921 if (f_v) {
1922 cout << "Written file " << fname << " of size "
1923 << Fio.file_size(fname) << endl;
1924 }
1925
1926
1927
1928 FREE_int(Elt);
1929 FREE_int(data);
1930 FREE_lint(Table);
1931
1932 if (f_v) {
1933 cout << "any_group::do_conjugacy_class_of_element done" << endl;
1934 }
1935}
1936
1937
1939 std::string &fname_group_elements_coded,
1940 std::string &fname_transporter,
1941 int verbose_level)
1942{
1943 int f_v = (verbose_level >= 1);
1944
1945 if (f_v) {
1946 cout << "any_group::do_orbits_on_group_elements_under_conjugation" << endl;
1947 }
1948
1949
1950
1951
1952 if (!A->f_has_sims) {
1953 if (f_v) {
1954 cout << "any_group::do_orbits_on_group_elements_under_conjugation "
1955 "Group does not have a sims object" << endl;
1956 }
1957 //exit(1);
1958
1959 {
1960 //sims *S;
1961
1962 A->create_sims(verbose_level);
1963
1964#if 0
1965 if (f_v) {
1966 cout << "any_group::do_orbits_on_group_elements_under_conjugation before init_sims" << endl;
1967 }
1968 A2->init_sims_only(S, 0/*verbose_level - 1*/);
1969 if (f_v) {
1970 cout << "any_group::do_orbits_on_group_elements_under_conjugation after init_sims" << endl;
1971 }
1972#endif
1973 }
1974
1975 }
1976
1977
1978
1979
1980
1981 groups::sims *S;
1982
1983 S = A->Sims;
1984
1985 if (f_v) {
1986 cout << "the group has order " << S->group_order_lint() << endl;
1987 }
1988 int *Elt;
1989
1990 Elt = NEW_int(A->elt_size_in_int);
1991
1992 if (f_v) {
1993 cout << "computing the element ranks:" << endl;
1994 }
1995
1997 long int *the_ranks;
1999 int m, n;
2000 int i;
2001
2002 {
2003 int *M;
2004 Fio.int_matrix_read_csv(fname_group_elements_coded,
2005 M, m, n, 0 /*verbose_level*/);
2006 if (f_v) {
2007 cout << "read a set of size " << m << endl;
2008 }
2009 the_ranks = NEW_lint(m);
2010 for (i = 0; i < m; i++) {
2011
2012 if (FALSE) {
2013 cout << i << " : ";
2014 Int_vec_print(cout, M + i * n, n);
2015 cout << endl;
2016 }
2017
2018 LG->A_linear->make_element(Elt, M + i * n, 0 /* verbose_level */);
2019 if (FALSE) {
2020 cout << "computing rank of " << endl;
2021 LG->A_linear->element_print_latex(Elt, cout);
2022 }
2023
2024 the_ranks[i] = S->element_rank_lint(Elt);
2025 if (FALSE) {
2026 cout << i << " : " << the_ranks[i] << endl;
2027 }
2028 }
2029
2030 FREE_int(M);
2031 }
2032
2034 Transporter->init(S->A, 0);
2035 {
2036 int *M;
2037 Fio.int_matrix_read_csv(fname_transporter,
2038 M, m, n, 0 /*verbose_level*/);
2039 if (f_v) {
2040 cout << "read a set of size " << m << endl;
2041 }
2042 Transporter->allocate(m, 0);
2043 for (i = 0; i < m; i++) {
2044
2045 if (FALSE) {
2046 cout << i << " : ";
2047 Int_vec_print(cout, M + i * n, n);
2048 cout << endl;
2049 }
2050
2051 LG->A_linear->make_element(Transporter->ith(i), M + i * n, 0 /* verbose_level */);
2052 if (FALSE) {
2053 cout << "computing rank of " << endl;
2054 LG->A_linear->element_print_latex(Elt, cout);
2055 }
2056
2057 }
2058
2059 FREE_int(M);
2060 }
2061
2062
2063
2064
2065 if (f_v) {
2066 cout << "computing conjugacy classes on the set " << endl;
2067 Lint_vec_print(cout, the_ranks, m);
2068 cout << endl;
2069 }
2070
2072
2073 if (f_v) {
2074 cout << "any_group::do_orbits_on_group_elements_under_conjugation "
2075 "before Algebra.orbits_under_conjugation" << endl;
2076 }
2078 the_ranks, m, S,
2079 LG->Strong_gens,
2080 Transporter,
2081 verbose_level);
2082 if (f_v) {
2083 cout << "any_group::do_orbits_on_group_elements_under_conjugation "
2084 "after Algebra.orbits_under_conjugation" << endl;
2085 }
2086
2087
2088
2089
2090 FREE_int(Elt);
2091
2092 if (f_v) {
2093 cout << "any_group::do_orbits_on_group_elements_under_conjugation done" << endl;
2094 }
2095}
2096
2099 int verbose_level)
2100{
2101 int f_v = (verbose_level >= 1);
2102
2103
2104 if (f_v) {
2105 cout << "any_group::create_latex_report_for_permutation_group" << endl;
2106 }
2107
2108 {
2109 string fname;
2110 string title;
2111 string author;
2112
2113 fname.assign(label);
2114 fname.append("_report.tex");
2115 title.assign("The group $");
2116 title.append(label_tex);
2117 title.append("$");
2118
2119 author.assign("");
2120
2121
2122 {
2123 ofstream ost(fname);
2125
2126 L.head(ost,
2127 FALSE /* f_book*/,
2128 TRUE /* f_title */,
2129 title.c_str(), author.c_str(),
2130 FALSE /* f_toc */,
2131 FALSE /* f_landscape */,
2132 TRUE /* f_12pt */,
2133 TRUE /* f_enlarged_page */,
2134 TRUE /* f_pagenumbers */,
2135 NULL /* extra_praeamble */);
2136
2137
2138#if 0
2139 if (f_v) {
2140 cout << "any_group::create_latex_report_for_permutation_group before A->report" << endl;
2141 }
2142 A->report(ost, A->f_has_sims, A->Sims,
2144 O,
2145 verbose_level);
2146 if (f_v) {
2147 cout << "any_group::create_latex_report_for_permutation_group after A->report" << endl;
2148 }
2149#endif
2150
2151
2152 if (f_v) {
2153 cout << "any_group::create_latex_report_for_permutation_group before Subgroup_gens->print_generators_in_latex_individually" << endl;
2154 }
2156 if (f_v) {
2157 cout << "any_group::create_latex_report_for_permutation_group after Subgroup_gens->print_generators_in_latex_individually" << endl;
2158 }
2159 //A_initial->print_base();
2160 //A_initial->print_info();
2161
2162#if 0
2163 if (f_v) {
2164 cout << "any_group::create_latex_report_for_permutation_group before Subgroup_sims->report" << endl;
2165 }
2166 Subgroup_sims->report(ost,
2167 label,
2168 O,
2169 verbose_level);
2170 if (f_v) {
2171 cout << "any_group::create_latex_report_for_permutation_group after Subgroup_sims->report" << endl;
2172 }
2173#endif
2174
2175 L.foot(ost);
2176
2177 }
2179
2180 cout << "written file " << fname << " of size "
2181 << Fio.file_size(fname) << endl;
2182 }
2183
2184
2185
2186
2187 if (f_v) {
2188 cout << "any_group::create_latex_report_for_permutation_group done" << endl;
2189 }
2190}
2191
2194 int verbose_level)
2195{
2196 int f_v = (verbose_level >= 1);
2197
2198
2199 if (f_v) {
2200 cout << "any_group::create_latex_report_for_modified_group" << endl;
2201 }
2202
2203 {
2204 string fname;
2205 string title;
2206 string author;
2207
2208 fname.assign(label);
2209 fname.append("_report.tex");
2210 title.assign("The group $");
2211 title.append(label_tex);
2212 title.append("$");
2213
2214 author.assign("");
2215
2216
2217 {
2218 ofstream ost(fname);
2220
2221 L.head(ost,
2222 FALSE /* f_book*/,
2223 TRUE /* f_title */,
2224 title.c_str(), author.c_str(),
2225 FALSE /* f_toc */,
2226 FALSE /* f_landscape */,
2227 TRUE /* f_12pt */,
2228 TRUE /* f_enlarged_page */,
2229 TRUE /* f_pagenumbers */,
2230 NULL /* extra_praeamble */);
2231
2232
2233#if 0
2234 if (f_v) {
2235 cout << "any_group::create_latex_report_for_modified_group before A->report" << endl;
2236 }
2237 A->report(ost, A->f_has_sims, A->Sims,
2239 O,
2240 verbose_level);
2241 if (f_v) {
2242 cout << "any_group::create_latex_report_for_modified_group after A->report" << endl;
2243 }
2244#endif
2245
2246
2247 if (f_v) {
2248 cout << "any_group::create_latex_report_for_modified_group before Subgroup_gens->print_generators_in_latex_individually" << endl;
2249 }
2251 if (f_v) {
2252 cout << "any_group::create_latex_report_for_modified_group after Subgroup_gens->print_generators_in_latex_individually" << endl;
2253 }
2254 //A_initial->print_base();
2255 //A_initial->print_info();
2256
2257#if 0
2258 if (f_v) {
2259 cout << "any_group::create_latex_report_for_modified_group before Subgroup_sims->report" << endl;
2260 }
2261 Subgroup_sims->report(ost,
2262 label,
2263 O,
2264 verbose_level);
2265 if (f_v) {
2266 cout << "any_group::create_latex_report_for_modified_group after Subgroup_sims->report" << endl;
2267 }
2268#endif
2269
2270 L.foot(ost);
2271
2272 }
2274
2275 cout << "written file " << fname << " of size "
2276 << Fio.file_size(fname) << endl;
2277 }
2278
2279
2280
2281
2282 if (f_v) {
2283 cout << "any_group::create_latex_report_for_modified_group done" << endl;
2284 }
2285}
2286
2288{
2289 int f_v = FALSE;
2291
2292 if (Subgroup_gens) {
2293 if (f_v) {
2294 cout << "any_group::get_strong_generators using Subgroup_gens" << endl;
2295 }
2296 SG = Subgroup_gens;
2297 }
2298 else if (A->f_has_strong_generators) {
2299 if (f_v) {
2300 cout << "any_group::get_strong_generators using A_base->Strong_gens" << endl;
2301 }
2302 SG = A->Strong_gens;
2303 }
2304 else {
2305 cout << "any_group::get_strong_generators no generators to export" << endl;
2306 exit(1);
2307 }
2308 return SG;
2309}
2310
2311
2312
2313
2314
2315
2316}}}
2317
void matrix_print(long int *p, int m, int n)
Definition: lint_vec.cpp:203
functions related to strings and character arrays
options for drawing an object of type layered_graph
Definition: graphics.h:457
void int_matrix_write_csv(std::string &fname, int *M, int m, int n)
Definition: file_io.cpp:1300
void int_matrix_read_csv(std::string &fname, int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1477
void read_set_from_file(std::string &fname, long int *&the_set, int &set_size, int verbose_level)
Definition: file_io.cpp:2374
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)
void print_integer_matrix_with_labels(std::ostream &ost, int *p, int m, int n, int *row_labels, int *col_labels, int f_tex)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
void create_from_base_10_string(const char *str, int verbose_level)
a permutation group in a fixed action.
Definition: actions.h:99
void element_print_latex(void *elt, std::ostream &ost)
Definition: action_cb.cpp:364
void element_print(void *elt, std::ostream &ost)
Definition: action_cb.cpp:347
void normalizer_using_MAGMA(std::string &fname_magma_prefix, groups::sims *G, groups::sims *H, groups::strong_generators *&gens_N, int verbose_level)
void mult(void *a, void *b, void *ab)
Definition: action_cb.cpp:81
void element_mult(void *a, void *b, void *ab, int verbose_level)
Definition: action_cb.cpp:315
void report(std::ostream &ost, int f_sims, groups::sims *S, int f_strong_gens, groups::strong_generators *SG, graphics::layered_graph_draw_options *LG_Draw_options, int verbose_level)
Definition: action_io.cpp:22
action * create_induced_action_on_sets(int nb_sets, int set_size, long int *sets, int verbose_level)
groups::strong_generators * Strong_gens
Definition: actions.h:130
void init_sims_only(groups::sims *G, int verbose_level)
Definition: action.cpp:709
void make_element_from_string(int *Elt, std::string &data_string, int verbose_level)
Definition: action.cpp:1842
void make_element(int *Elt, int *data, int verbose_level)
Definition: action.cpp:1875
action * create_induced_action_by_conjugation(groups::sims *Base_group, int f_ownership, int verbose_level)
void induced_action_by_conjugation(groups::sims *old_G, groups::sims *Base_group, int f_ownership, int f_basis, int verbose_level)
void export_to_orbiter_as_bsgs(std::string &fname, std::string &label, std::string &label_tex, groups::strong_generators *SG, int verbose_level)
Definition: action_io.cpp:1077
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 report_groups_and_normalizers(std::ostream &ost, int nb_subgroups, groups::strong_generators *H_gens, groups::strong_generators *N_gens, int verbose_level)
void read_column_csv(std::string &fname, actions::action *A, int col_idx, int verbose_level)
Definition: vector_ge.cpp:787
void save_csv(std::string &fname, int verbose_level)
Definition: vector_ge.cpp:751
void init(actions::action *A, int verbose_level)
Definition: vector_ge.cpp:55
creates a linear group from command line arguments using linear_group_description
Definition: groups.h:244
void create_latex_report(graphics::layered_graph_draw_options *O, int f_sylow, int f_group_table, int f_classes, int verbose_level)
data_structures_groups::vector_ge * nice_gens
Definition: groups.h:266
compute orbits of a group in a given action; allows file io
Definition: groups.h:492
a domain for permutation groups whose elements are given in the permutation representation
Definition: groups.h:636
Schreier trees for orbits of groups on points.
Definition: groups.h:839
void shallow_tree_generators(int orbit_idx, int f_randomized, schreier *&shallow_tree, int verbose_level)
Definition: schreier.cpp:2962
void export_tree_as_layered_graph(int orbit_no, std::string &fname_mask, int verbose_level)
strong_generators * stabilizer_orbit_rep(actions::action *default_action, ring_theory::longinteger_object &full_group_order, int orbit_idx, int verbose_level)
Definition: schreier.cpp:2345
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 init(actions::action *A, int verbose_level)
Definition: schreier.cpp:308
a permutation group represented via a stabilizer chain
Definition: groups.h:1273
void element_unrank(ring_theory::longinteger_object &a, int *elt, int verbose_level)
Definition: sims.cpp:1213
void element_rank(ring_theory::longinteger_object &a, int *elt)
Definition: sims.cpp:1276
void group_order(ring_theory::longinteger_object &go)
Definition: sims.cpp:951
void create_group_table(int *&Table, long int &n, int verbose_level)
void report(std::ostream &ost, std::string &prefix, graphics::layered_graph_draw_options *LG_Draw_options, int verbose_level)
Definition: sims_io.cpp:760
void print_all_group_elements_tex(std::ostream &ost)
Definition: sims_io.cpp:474
void element_unrank_lint(long int rk, int *Elt, int verbose_level)
Definition: sims.cpp:1326
void all_elements_save_csv(std::string &fname, int verbose_level)
Definition: sims.cpp:2236
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
schreier * orbit_of_one_point_schreier(actions::action *A_given, int pt, int verbose_level)
void canonical_image_GAP(std::string &input_set_text, std::ostream &ost)
void export_magma(actions::action *A, std::ostream &ost, int verbose_level)
void export_to_orbiter_as_bsgs(actions::action *A2, std::string &fname, std::string &label, std::string &label_tex, int verbose_level)
void print_generators_gap_in_different_action(std::ostream &ost, actions::action *A2)
sims * create_sims_in_different_action(actions::action *A_given, int verbose_level)
data_structures_groups::vector_ge * gens
Definition: groups.h:1708
void group_order(ring_theory::longinteger_object &go)
orbit of sets using a Schreier tree, used in packing::make_spread_table
Definition: orbits.h:106
void get_orbit_of_points(std::vector< long int > &Orbit, int verbose_level)
void init(actions::action *A, actions::action *A2, long int *set, int sz, data_structures_groups::vector_ge *gens, int verbose_level)
to control the behavior of the poset classification algorithm
void list_all_orbits_at_level(int depth, int f_has_print_function, void(*print_function)(std::ostream &ost, int len, long int *S, void *data), void *print_function_data, int f_show_orbit_decomposition, int f_show_stab, int f_save_stab, int f_show_whole_orbit)
void get_whole_orbit(int depth, int orbit_idx, long int *&Orbit, int &orbit_length, int verbose_level)
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
poset_classification * orbits_on_k_sets_compute(poset_classification_control *Control, int k, int verbose_level)
void find_subgroups(actions::action *A, groups::sims *S, int subgroup_order, std::string &label, int &nb_subgroups, groups::strong_generators *&H_gens, groups::strong_generators *&N_gens, int verbose_level)
void orbits_on_set_from_file(long int *the_set, int set_size, actions::action *A1, actions::action *A2, data_structures_groups::vector_ge *gens, std::string &label_set, std::string &label_group, long int *&Table, int &orbit_length, int verbose_level)
void normalizer_of_cyclic_subgroup(actions::action *A, groups::sims *S, std::string &element_description, std::string &label, int verbose_level)
void orbits_under_conjugation(long int *the_set, int set_size, groups::sims *S, groups::strong_generators *SG, data_structures_groups::vector_ge *Transporter, int verbose_level)
void centralizer_of_element(actions::action *A, groups::sims *S, std::string &element_description, std::string &label, int verbose_level)
void orbits_on_points(actions::action *A2, groups::strong_generators *Strong_gens, int f_load_save, std::string &prefix, groups::orbits_on_something *&Orb, int verbose_level)
void orbit_of(int point_idx, int verbose_level)
Definition: any_group.cpp:1447
void create_latex_report_for_permutation_group(graphics::layered_graph_draw_options *O, int verbose_level)
Definition: any_group.cpp:2097
void init_permutation_group(groups::permutation_group_create *PGC, int verbose_level)
Definition: any_group.cpp:83
void apply_elements_to_set_csv(std::string &fname1, std::string &fname2, std::string &set_text, int verbose_level)
Definition: any_group.cpp:937
void create_latex_report(graphics::layered_graph_draw_options *O, int f_sylow, int f_group_table, int f_classes, int verbose_level)
Definition: any_group.cpp:151
void element_rank(std::string &elt_data, int verbose_level)
Definition: any_group.cpp:1017
groups::strong_generators * get_strong_generators()
Definition: any_group.cpp:2287
void element_unrank(std::string &rank_string, int verbose_level)
Definition: any_group.cpp:1074
void do_conjugacy_class_of_element(std::string &elt_label, std::string &elt_text, int verbose_level)
Definition: any_group.cpp:1778
void order_of_products_of_elements(std::string &Elements_text, int verbose_level)
Definition: any_group.cpp:768
void orbits_on_poset_post_processing(poset_classification::poset_classification *PC, int depth, int verbose_level)
Definition: any_group.cpp:1649
void init_modified_group(modified_group_create *MGC, int verbose_level)
Definition: any_group.cpp:121
void save_elements_csv(std::string &fname, int verbose_level)
Definition: any_group.cpp:865
void create_latex_report_for_modified_group(graphics::layered_graph_draw_options *O, int verbose_level)
Definition: any_group.cpp:2192
void do_canonical_image_GAP(std::string &input_set, int verbose_level)
Definition: any_group.cpp:313
void orbits_on_set_system_from_file(std::string &fname_csv, int number_of_columns, int first_column, int verbose_level)
Definition: any_group.cpp:1292
void centralizer(std::string &element_label, std::string &element_description_text, int verbose_level)
Definition: any_group.cpp:500
void conjugacy_class_of(std::string &rank_string, int verbose_level)
Definition: any_group.cpp:1131
void do_orbits_on_group_elements_under_conjugation(std::string &fname_group_elements_coded, std::string &fname_transporter, int verbose_level)
Definition: any_group.cpp:1938
void init_linear_group(groups::linear_group *LG, int verbose_level)
Definition: any_group.cpp:47
void normalizer_of_cyclic_subgroup(std::string &element_label, std::string &element_description_text, int verbose_level)
Definition: any_group.cpp:539
void do_reverse_isomorphism_exterior_square(int verbose_level)
Definition: any_group.cpp:1260
void do_export_orbiter(actions::action *A2, int verbose_level)
Definition: any_group.cpp:194
void multiply_elements_csv(std::string &fname1, std::string &fname2, std::string &fname3, int f_column_major_ordering, int verbose_level)
Definition: any_group.cpp:881
void orbits_on_subsets(poset_classification::poset_classification_control *Control, poset_classification::poset_classification *&PC, int subset_size, int verbose_level)
Definition: any_group.cpp:1567
void orbits_on_points(groups::orbits_on_something *&Orb, int verbose_level)
Definition: any_group.cpp:1532
void orbits_on_set_from_file(std::string &fname_csv, int verbose_level)
Definition: any_group.cpp:1397
void do_find_subgroups(int order_of_subgroup, int verbose_level)
Definition: any_group.cpp:578
to create a new group or group action from old ones, using class group_modification_description
#define FREE_OBJECTS(p)
Definition: foundations.h:652
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_print_fully(A, B, C)
Definition: foundations.h:687
#define Lint_vec_scan(A, B, C)
Definition: foundations.h:717
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define Int_matrix_print(A, B, C)
Definition: foundations.h:707
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
algebra, combinatorics and graph theory, geometry, linear algebra, number theory, data structures,...
Definition: a_domain.cpp:18
shallow_schreier_tree_strategy
the strategy which is employed to create shallow Schreier trees
the orbiter library for the classification of combinatorial objects