Orbiter 2022
Combinatorial Objects
algebra_global_with_action.cpp
Go to the documentation of this file.
1/*
2 * algebra_global_with_action.cpp
3 *
4 * Created on: Dec 15, 2019
5 * Author: betten
6 */
7
8
9
10#include "orbiter.h"
11
12
13//#include "orbiter.h"
14
15using namespace std;
16
17//using namespace orbiter::foundations;
18
19namespace orbiter {
20namespace layer5_applications {
21namespace apps_algebra {
22
23
25 long int *the_set, int set_size, groups::sims *S,
28 int verbose_level)
29// this is related to Betten, Topalova, Zhelezova 2021,
30// packings in PG(3,4) invariant under an elementary group of order 4
31{
32 int f_v = (verbose_level >= 1);
33
34 if (f_v) {
35 cout << "algebra_global_with_action::orbits_under_conjugation" << endl;
36 }
37 actions::action A_conj;
38 if (f_v) {
39 cout << "algebra_global_with_action::orbits_under_conjugation "
40 "before A_conj.induced_action_by_conjugation" << endl;
41 }
43 FALSE /* f_ownership */, FALSE /* f_basis */,
44 verbose_level);
45 if (f_v) {
46 cout << "algebra_global_with_action::orbits_under_conjugation "
47 "created action by conjugation" << endl;
48 }
49
50 actions::action *A_conj_restricted;
51
52 if (f_v) {
53 cout << "algebra_global_with_action::orbits_under_conjugation "
54 "before A_conj.restricted_action" << endl;
55 }
56
57 A_conj_restricted = A_conj.restricted_action(the_set, set_size,
58 verbose_level);
59
60 if (f_v) {
61 cout << "algebra_global_with_action::orbits_under_conjugation "
62 "after A_conj.restricted_action" << endl;
63 }
64
65
66
67 groups::schreier Classes;
68 Classes.init(A_conj_restricted, verbose_level - 2);
69 Classes.init_generators(*SG->gens, verbose_level - 2);
70 if (f_v) {
71 cout << "algebra_global_with_action::orbits_under_conjugation "
72 "before Classes.compute_all_point_orbits" << endl;
73 }
74 Classes.compute_all_point_orbits(1 /*verbose_level - 1*/);
75 if (f_v) {
76 cout << "algebra_global_with_action::orbits_under_conjugation "
77 "after Classes.compute_all_point_orbits" << endl;
78 cout << "found " << Classes.nb_orbits << " conjugacy classes" << endl;
79 }
80
81
82 if (f_v) {
83 cout << "algebra_global_with_action::orbits_under_conjugation "
84 "before create_subgroups" << endl;
85 }
87 the_set, set_size, S, &A_conj,
88 &Classes,
89 Transporter,
90 verbose_level);
91 if (f_v) {
92 cout << "algebra_global_with_action::orbits_under_conjugation "
93 "after create_subgroups" << endl;
94 }
95
96 if (f_v) {
97 cout << "algebra_global_with_action::orbits_under_conjugation done" << endl;
98 }
99}
100
103 long int *the_set, int set_size, groups::sims *S, actions::action *A_conj,
104 groups::schreier *Classes,
106 int verbose_level)
107// this is related to Betten, Topalova, Zhelezova 2021,
108// packings in PG(3,4) invariant under an elementary abelian group of order 4
109{
110 int f_v = (verbose_level >= 1);
111
112 if (f_v) {
113 cout << "algebra_global_with_action::create_subgroups" << endl;
114 }
115
116 int i, j;
117 int f, l, rep;
118 long int *the_set_sorted;
119 long int *position;
122
123 SG->group_order(go);
124 if (f_v) {
125 cout << "The group has order " << go << endl;
126 }
127
128 the_set_sorted = NEW_lint(set_size);
129 position = NEW_lint(set_size);
130 Lint_vec_copy(the_set, the_set_sorted, set_size);
131 //Sorting.lint_vec_heapsort(the_set_sorted, set_size);
132 for (i = 0; i < set_size; i++) {
133 position[i] = i;
134 }
135 Sorting.lint_vec_heapsort_with_log(the_set_sorted, position, set_size);
136
137
138 cout << "There are " << Classes->nb_orbits << " orbits on the given set of elements by conjugation" << endl;
139 for (i = 0; i < Classes->nb_orbits; i++) {
140
141 f = Classes->orbit_first[i];
142 l = Classes->orbit_len[i];
143 rep = Classes->orbit[f];
144 if (f_v) {
145 cout << "Orbit " << i << " has length " << l << " representative is " << rep << " = " << the_set[rep] << endl;
146 }
147 }
148
149 long int rk0;
150 long int rk1;
151 long int rk2;
152 int idx;
153 int *Elt0;
154 int *Elt1;
155 int *Elt2;
156 int nb_flag_orbits;
157 long int *Flags;
158 groups::strong_generators **Flag_stab;
159 int *SO;
160 int *SOL;
161 int nb_reject;
162
163 Elt0 = NEW_int(S->A->elt_size_in_int);
164 Elt1 = NEW_int(S->A->elt_size_in_int);
165 Elt2 = NEW_int(S->A->elt_size_in_int);
166
167 f = Classes->orbit_first[0];
168 l = Classes->orbit_len[0];
169 if (l != 1) {
170 cout << "algebra_global_with_action::create_subgroups l != 1" << endl;
171 exit(1);
172 }
173 rep = Classes->orbit[f];
174 rk0 = the_set[rep];
175
176 S->element_unrank_lint(rk0, Elt0);
177
178 nb_flag_orbits = 0;
179 Flags = NEW_lint(Classes->nb_orbits * 3);
180 Flag_stab = new groups::pstrong_generators [Classes->nb_orbits];
181 SO = NEW_int(Classes->nb_orbits);
182 SOL = NEW_int(Classes->nb_orbits);
183
184 nb_reject = 0;
185
186 for (j = 1; j < Classes->nb_orbits; j++) {
187
188
189
190 f = Classes->orbit_first[j];
191 l = Classes->orbit_len[j];
192 rep = Classes->orbit[f];
193 rk1 = the_set[rep];
194 rk2 = S->mult_by_rank(rk0, rk1, 0 /*verbose_level*/);
195
196 if (Sorting.lint_vec_search(the_set_sorted, set_size, rk2, idx, 0 /*verbose_level*/)) {
197 cout << "flag orbit " << nb_flag_orbits << " : " << j << " l=" << l << " : " << rk0 << "," << rk1 << "," << rk2 << endl;
198
199 S->element_unrank_lint(rk1, Elt1);
200 S->element_unrank_lint(rk2, Elt2);
201 S->A->element_print_quick(Elt0, cout);
202 S->A->element_print_quick(Elt1, cout);
203 S->A->element_print_quick(Elt2, cout);
204
205 Flags[nb_flag_orbits * 3 + 0] = rk0;
206 Flags[nb_flag_orbits * 3 + 1] = rk1;
207 Flags[nb_flag_orbits * 3 + 2] = rk2;
208 SO[nb_flag_orbits] = j;
209 SOL[nb_flag_orbits] = l;
210
211 if (f_v) {
212 cout << "algebra_global_with_action::create_subgroups before Classes->stabilizer_orbit_rep" << endl;
213 }
214 Flag_stab[nb_flag_orbits] = Classes->stabilizer_orbit_rep(
215 S->A,
216 go,
217 j /* orbit_idx */, 0 /*verbose_level*/);
218 if (f_v) {
219 cout << "algebra_global_with_action::create_subgroups after Classes->stabilizer_orbit_rep" << endl;
220 }
221
222
223 nb_flag_orbits++;
224 }
225 else {
226 cout << "Class " << j << " is rejected because the third element does not belong to the same class." << endl;
227 nb_reject++;
228 }
229
230 }
231
232 if (f_v) {
233 cout << "We found " << nb_flag_orbits << " flag orbits, with " << nb_reject << " may rejected" << endl;
234
235 int h;
236
237 for (h = 0; h < nb_flag_orbits; h++) {
239
240 cout << "flag orbit " << h << " / " << nb_flag_orbits << ":" << endl;
241 Flag_stab[h]->group_order(go1);
242 rk0 = Flags[h * 3 + 0];
243 rk1 = Flags[h * 3 + 1];
244 rk2 = Flags[h * 3 + 2];
245 S->element_unrank_lint(rk0, Elt0);
246 S->element_unrank_lint(rk1, Elt1);
247 S->element_unrank_lint(rk2, Elt2);
248 cout << h << " : " << SO[h] << " : " <<SOL[h] << " : (" << rk0 << "," << rk1 << "," << rk2 << ") : " << go1 << endl;
249 cout << "The subgroup consists of the following three non-identity elements:" << endl;
250 S->A->element_print_quick(Elt0, cout);
251 S->A->element_print_quick(Elt1, cout);
252 S->A->element_print_quick(Elt2, cout);
253
254 Flag_stab[h]->print_generators_tex(cout);
255
256 }
257 }
258
259 int flag;
260 int nb_iso;
261 int *upstep_transversal_size;
262 int *iso_type_of_flag_orbit;
263 int *f_is_definition;
264 int *flag_orbit_of_iso_type;
265 int *f_fused;
267 long int cur_flag[3];
268 long int cur_flag_mapped1[3];
269 int h, pt;
270
271 upstep_transversal_size = NEW_int(nb_flag_orbits);
272 iso_type_of_flag_orbit = NEW_int(nb_flag_orbits);
273 flag_orbit_of_iso_type = NEW_int(nb_flag_orbits);
274 f_is_definition = NEW_int(nb_flag_orbits);
275 f_fused = NEW_int(nb_flag_orbits);
276 Int_vec_zero(f_is_definition, nb_flag_orbits);
277 Int_vec_zero(f_fused, nb_flag_orbits);
278
279 Aut = new groups::pstrong_generators [nb_flag_orbits];
280
281
282 nb_iso = 0;
283 for (flag = 0; flag < nb_flag_orbits; flag++) {
284
285 if (f_v) {
286 cout << "upstep: considering flag orbit " << flag << " / " << nb_flag_orbits
287 << " with a flag stabilizer of order " << Flag_stab[flag]->group_order_as_lint() << endl;
288 }
289
290 if (f_fused[flag]) {
291 if (f_v) {
292 cout << "upstep: flag orbit " << flag << " / " << nb_flag_orbits << " has been fused, skipping" << endl;
293 }
294 continue;
295 }
296 f_is_definition[flag] = TRUE;
297 iso_type_of_flag_orbit[flag] = nb_iso;
298 flag_orbit_of_iso_type[nb_iso] = flag;
299 upstep_transversal_size[nb_iso] = 1;
300
302
304 transversal->init(S->A, 0);
305 transversal->allocate(6, 0);
306 for (h = 0; h < 6; h++) {
307 S->A->element_one(transversal->ith(h), 0);
308 }
309
310 for (h = 1; h < 6; h++) {
311 if (h == 1) {
312 cur_flag[0] = Flags[flag * 3 + 0];
313 cur_flag[1] = Flags[flag * 3 + 2];
314 cur_flag[2] = Flags[flag * 3 + 1];
315 }
316 else if (h == 2) {
317 cur_flag[0] = Flags[flag * 3 + 1];
318 cur_flag[1] = Flags[flag * 3 + 0];
319 cur_flag[2] = Flags[flag * 3 + 2];
320 }
321 else if (h == 3) {
322 cur_flag[0] = Flags[flag * 3 + 1];
323 cur_flag[1] = Flags[flag * 3 + 2];
324 cur_flag[2] = Flags[flag * 3 + 0];
325 }
326 else if (h == 4) {
327 cur_flag[0] = Flags[flag * 3 + 2];
328 cur_flag[1] = Flags[flag * 3 + 0];
329 cur_flag[2] = Flags[flag * 3 + 1];
330 }
331 else if (h == 5) {
332 cur_flag[0] = Flags[flag * 3 + 2];
333 cur_flag[1] = Flags[flag * 3 + 1];
334 cur_flag[2] = Flags[flag * 3 + 0];
335 }
336
337 // move cur_flag[0] to the_set[0] using the inverse of Transporter
338
339 if (!Sorting.lint_vec_search(the_set_sorted, set_size, cur_flag[0], idx, 0 /*verbose_level*/)) {
340 cout << "cannot find cur_flag[0] in the_set_sorted" << endl;
341 exit(1);
342 }
343 pt = position[idx];
344 S->A->element_invert(Transporter->ith(pt), Elt0, 0);
345 for (int u = 0; u < 3; u++) {
346 cur_flag_mapped1[u] = A_conj->element_image_of(cur_flag[u], Elt0, 0);
347 }
348 if (cur_flag_mapped1[0] != rk0) {
349 cout << "cur_flag_mapped1[u] != rk0" << endl;
350 exit(1);
351 }
352
353
354
355 if (!Sorting.lint_vec_search(the_set_sorted, set_size, cur_flag_mapped1[1], idx, 0 /*verbose_level*/)) {
356 cout << "cannot find cur_flag[1] in the_set_sorted" << endl;
357 exit(1);
358 }
359 pt = position[idx];
360 j = Classes->orbit_number(pt);
361
362
363 if (j == SO[flag]) {
364 cout << "flag " << flag << " coset " << h << ", found an automorphism" << endl;
365
366 int orbit_idx;
367
369 orbit_idx, Elt1, verbose_level);
370
371 S->A->element_mult(Elt0, Elt1, Elt2, 0);
372 S->A->element_print_quick(Elt2, cout);
373
374 for (int u = 0; u < 3; u++) {
375 cur_flag_mapped1[u] = A_conj->element_image_of(cur_flag[u], Elt2, 0);
376 }
377 cout << "which maps as follows:" << endl;
378 for (int u = 0; u < 3; u++) {
379 cout << cur_flag[u] << " -> " << cur_flag_mapped1[u] << endl;
380 }
381
382 S->A->element_move(Elt2, transversal->ith(upstep_transversal_size[nb_iso]), 0);
383
384 upstep_transversal_size[nb_iso]++;
385 }
386 else {
387 if (!Sorting.int_vec_search(SO, nb_flag_orbits, j, idx)) {
388 cout << "cannot find j in SO" << endl;
389 exit(1);
390 }
391 cout << "flag " << flag << " coset " << h << ", fusing with flag " << idx << endl;
392 f_fused[idx] = TRUE;
393 }
394
395 }
396
398
400
401 if (f_v) {
402 cout << "flag " << flag << " stab order = " << Flag_stab[flag]->group_order_as_lint()
403 << " upstep ransversal length = " << upstep_transversal_size[nb_iso] << endl;
404 cout << "before aut->init_group_extension" << endl;
405 }
406 aut->init(S->A);
407 aut->init_group_extension(Flag_stab[flag],
408 transversal, upstep_transversal_size[nb_iso] /* index */,
409 verbose_level);
410
411 cout << "created a stabilizer of order " << aut->group_order_as_lint() << endl;
412
413 Aut[nb_iso] = aut;
414
415 nb_iso++;
416 }
417
418 cout << "We found " << nb_iso << " conjugacy classes of subgroups" << endl;
419 for (i = 0; i < nb_iso; i++) {
420 flag = flag_orbit_of_iso_type[i];
421 rk0 = Flags[flag * 3 + 0];
422 rk1 = Flags[flag * 3 + 1];
423 rk2 = Flags[flag * 3 + 2];
424 cout << i << " : " << flag << " : " << " : " << SO[flag] << " l=" << SOL[flag]
425 << " : " << rk0 << "," << rk1 << "," << rk2 << " : "
426 << upstep_transversal_size[i] << " : " << Aut[i]->group_order_as_lint() << endl;
427
428 S->element_unrank_lint(rk0, Elt0);
429 S->element_unrank_lint(rk1, Elt1);
430 S->element_unrank_lint(rk2, Elt2);
431
432 cout << "The subgroup consists of the following three non-identity elements:" << endl;
433 S->A->element_print_quick(Elt0, cout);
434 S->A->element_print_quick(Elt1, cout);
435 S->A->element_print_quick(Elt2, cout);
436
437 Aut[i]->print_generators_tex(cout);
438
439 }
440
441
442 {
443 char str[1000];
444 string fname;
445 char title[1000];
446 char author[1000];
447
448 snprintf(str, 1000, "subgroups_of_order_4.tex");
449 fname.assign(str);
450 snprintf(title, 1000, "Subgroups of order 4");
451 //strcpy(author, "");
452 author[0] = 0;
453
454
455 {
456 ofstream ost(fname);
458
459 L.head(ost,
460 FALSE /* f_book*/,
461 TRUE /* f_title */,
462 title, author,
463 FALSE /* f_toc */,
464 FALSE /* f_landscape */,
465 TRUE /* f_12pt */,
466 TRUE /* f_enlarged_page */,
467 TRUE /* f_pagenumbers */,
468 NULL /* extra_praeamble */);
469
470
471 if (f_v) {
472 cout << "algebra_global_with_action::create_subgroups before report" << endl;
473 }
474#if 1
475 int h;
476 ost << "There are " << nb_flag_orbits << " flag orbits:\\\\" << endl;
477 for (h = 0; h < nb_flag_orbits; h++) {
479
480 ost << "Flag orbit " << h << " / " << nb_flag_orbits << ":\\\\" << endl;
481 Flag_stab[h]->group_order(go1);
482 rk0 = Flags[h * 3 + 0];
483 rk1 = Flags[h * 3 + 1];
484 rk2 = Flags[h * 3 + 2];
485 S->element_unrank_lint(rk0, Elt0);
486 S->element_unrank_lint(rk1, Elt1);
487 S->element_unrank_lint(rk2, Elt2);
488 cout << h << " : " << SO[h] << " : " << SOL[h] << " : (" << rk0 << "," << rk1 << "," << rk2 << ") : " << go1 << endl;
489 ost << "The subgroup consists of the following three non-identity elements:\\\\" << endl;
490 ost << "$$" << endl;
491 S->A->element_print_latex(Elt0, ost);
492 S->A->element_print_latex(Elt1, ost);
493 S->A->element_print_latex(Elt2, ost);
494 ost << "$$" << endl;
495 ost << "The flag stabilizer is the following group:\\\\" << endl;
496 Flag_stab[h]->print_generators_tex(ost);
497
498 }
499
500 ost << "\\bigskip" << endl;
501#endif
502
503 ost << "We found " << nb_iso << " conjugacy classes of subgroups\\\\" << endl;
504 ost << "Subgroup : Order of normalizer\\\\" << endl;
505 for (i = 0; i < nb_iso; i++) {
506 ost << i << " : " << Aut[i]->group_order_as_lint() << "\\\\" << endl;
507 }
508
509 ost << "\\bigskip" << endl;
510
511 for (i = 0; i < nb_iso; i++) {
512 ost << "Subgroup " << i << " / " << nb_iso << ":\\\\" << endl;
513 flag = flag_orbit_of_iso_type[i];
514 rk0 = Flags[flag * 3 + 0];
515 rk1 = Flags[flag * 3 + 1];
516 rk2 = Flags[flag * 3 + 2];
517 cout << i << " : " << flag << " : " << " : " << SO[flag] << " l=" << SOL[flag]
518 << " : " << rk0 << "," << rk1 << "," << rk2 << " : "
519 << upstep_transversal_size[i] << " : " << Aut[i]->group_order_as_lint() << endl;
520
521 S->element_unrank_lint(rk0, Elt0);
522 S->element_unrank_lint(rk1, Elt1);
523 S->element_unrank_lint(rk2, Elt2);
524
525 ost << "The subgroup consists of the following three non-identity elements:\\\\" << endl;
526 ost << "$$" << endl;
527 S->A->element_print_latex(Elt0, ost);
528 S->A->element_print_latex(Elt1, ost);
529 S->A->element_print_latex(Elt2, ost);
530 ost << "$$" << endl;
531 S->A->element_print_for_make_element(Elt0, ost);
532 ost << "\\\\" << endl;
533 S->A->element_print_for_make_element(Elt1, ost);
534 ost << "\\\\" << endl;
535 S->A->element_print_for_make_element(Elt2, ost);
536 ost << "\\\\" << endl;
537 ost << "The normalizer is the following group:\\\\" << endl;
538 Aut[i]->print_generators_tex(ost);
539
540 ost << "\\bigskip" << endl;
541
542 }
543
544
545 if (f_v) {
546 cout << "algebra_global_with_action::create_subgroups after report" << endl;
547 }
548
549
550 L.foot(ost);
551
552 }
554
555 cout << "written file " << fname << " of size "
556 << Fio.file_size(fname) << endl;
557 }
558
559
560 FREE_int(upstep_transversal_size);
561 FREE_int(iso_type_of_flag_orbit);
562 FREE_int(f_is_definition);
563 FREE_int(f_fused);
564 FREE_int(flag_orbit_of_iso_type);
565 FREE_lint(Flags);
566 FREE_int(SO);
567 FREE_int(Elt0);
568 FREE_int(Elt1);
569 FREE_int(Elt2);
570 FREE_lint(the_set_sorted);
571 FREE_lint(position);
572 if (f_v) {
573 cout << "algebra_global_with_action::create_subgroups done" << endl;
574 }
575}
576
578 long int *the_set, int set_size,
581 std::string &label_set,
582 std::string &label_group,
583 long int *&Table,
584 int &orbit_length,
585 int verbose_level)
586{
587 int f_v = (verbose_level >= 1);
588
589 if (f_v) {
590 cout << "algebra_global_with_action::orbits_on_set_from_file" << endl;
591 }
592
593 orbit_of_sets *OS;
594
596
597 if (f_v) {
598 cout << "algebra_global_with_action::orbits_on_set_from_file before OS->init" << endl;
599 }
600 OS->init(A1, A2, the_set, set_size, gens, verbose_level - 2);
601 if (f_v) {
602 cout << "algebra_global_with_action::orbits_on_set_from_file after OS->init" << endl;
603 }
604
605 if (f_v) {
606 cout << "Found an orbit of length " << OS->used_length << endl;
607 }
608
609 int set_size1;
610
611 if (f_v) {
612 cout << "before OS->get_table_of_orbits" << endl;
613 }
615 orbit_length, set_size1, verbose_level - 2);
616 if (f_v) {
617 cout << "after OS->get_table_of_orbits" << endl;
618 }
619
620 if (f_v) {
621 cout << "before OS->get_table_of_orbits" << endl;
622 }
623 OS->get_table_of_orbits(Table,
624 orbit_length, set_size, verbose_level);
625 if (f_v) {
626 cout << "after OS->get_table_of_orbits" << endl;
627 }
628
629
630 // write transporter as csv file:
631
632 string fname;
633
635
636 if (f_v) {
637 cout << "before OS->make_table_of_coset_reps" << endl;
638 }
639 OS->make_table_of_coset_reps(Coset_reps, verbose_level);
640 if (f_v) {
641 cout << "after OS->make_table_of_coset_reps" << endl;
642 }
643
644 fname.assign(label_set);
645 fname.append("_orbit_under_");
646 fname.append(label_group);
647 fname.append("_transporter.csv");
648
649 Coset_reps->write_to_csv_file_coded(fname, verbose_level);
650
651 // testing Coset_reps
652
653 if (f_v) {
654 cout << "testing Coset_reps " << endl;
655 }
656
657 long int rk0 = the_set[0];
658 long int rk1;
659
660 for (int i = 0; i < orbit_length; i++) {
661 rk1 = A2->element_image_of(rk0, Coset_reps->ith(i), 0);
662 if (rk1 != Table[i * set_size + 0]) {
663 cout << "rk1 != Table[i * set_size + 0], i=" << i << endl;
664 exit(1);
665 }
666 }
667
668 if (f_v) {
669 cout << "testing Coset_reps passes" << endl;
670 }
671
672 // write as csv file:
673
674
675 fname.assign(label_set);
676 fname.append("_orbit_under_");
677 fname.append(label_group);
678 fname.append(".csv");
679
680 if (f_v) {
681 cout << "Writing orbit to file " << fname << endl;
682 }
684
685 Fio.lint_matrix_write_csv(fname, Table, orbit_length, set_size);
686 if (f_v) {
687 cout << "Written file " << fname << " of size "
688 << Fio.file_size(fname) << endl;
689 }
690
691
692
693 // write as txt file:
694
695
696 fname.assign(label_set);
697 fname.append("_orbit_under_");
698 fname.append(label_group);
699 fname.append(".txt");
700
701 if (f_v) {
702 cout << "Writing table to file " << fname << endl;
703 }
704 {
705 ofstream ost(fname);
706 int i;
707 for (i = 0; i < orbit_length; i++) {
708 ost << set_size;
709 for (int j = 0; j < set_size; j++) {
710 ost << " " << Table[i * set_size + j];
711 }
712 ost << endl;
713 }
714 ost << -1 << " " << orbit_length << endl;
715 }
716 if (f_v) {
717 cout << "Written file " << fname << " of size "
718 << Fio.file_size(fname) << endl;
719 }
720
721
722 if (f_v) {
723 cout << "before FREE_OBJECT(OS)" << endl;
724 }
725 FREE_OBJECT(OS);
726 if (f_v) {
727 cout << "after FREE_OBJECT(OS)" << endl;
728 }
729 FREE_OBJECT(Coset_reps);
730 if (f_v) {
731 cout << "algebra_global_with_action::orbits_on_set_from_file done" << endl;
732 }
733}
734
735
738 groups::sims *override_Sims,
739 std::string &label,
740 std::string &label_tex,
741 int verbose_level)
742{
743 int f_v = (verbose_level >= 1);
744 string prefix;
745 string fname_output;
747 int d;
749
750
751 if (f_v) {
752 cout << "algebra_global_with_action::conjugacy_classes_based_on_normal_forms" << endl;
753 }
754
755 prefix.assign(label);
756 fname_output.assign(label);
757
758
759 d = A->matrix_group_dimension();
761
762 if (f_v) {
763 cout << "algebra_global_with_action::conjugacy_classes_based_on_normal_forms d=" << d << endl;
764 cout << "algebra_global_with_action::conjugacy_classes_based_on_normal_forms q=" << F->q << endl;
765 }
766
769 int nb_classes;
770 int *Mtx;
771 int *Elt;
772 int i, order;
773 long int a;
774
775 char str[1000];
776
777 sprintf(str, "_classes_based_on_normal_forms_%d_%d.tex", d, F->q);
778 fname_output.append("_classes_normal_form.tex");
779
780 C.init(d, F, verbose_level);
781
782 if (f_v) {
783 cout << "before C.make_classes" << endl;
784 }
785 C.make_classes(R, nb_classes, FALSE /*f_no_eigenvalue_one*/, verbose_level);
786 if (f_v) {
787 cout << "after C.make_classes" << endl;
788 }
789
790 Mtx = NEW_int(d * d + 1);
791 Elt = NEW_int(A->elt_size_in_int);
792
793 int *Order;
794
795 Order = NEW_int(nb_classes);
796
797 for (i = 0; i < nb_classes; i++) {
798
799 if (f_v) {
800 cout << "class " << i << " / " << nb_classes << ":" << endl;
801 }
802
803 Int_vec_zero(Mtx, d * d + 1);
804 C.make_matrix_from_class_rep(Mtx, R + i, verbose_level - 1);
805
806 A->make_element(Elt, Mtx, 0);
807
808 if (f_v) {
809 cout << "before override_Sims->element_rank_lint" << endl;
810 }
811 a = override_Sims->element_rank_lint(Elt);
812 if (f_v) {
813 cout << "after override_Sims->element_rank_lint" << endl;
814 }
815
816 cout << "Representative of class " << i << " / "
817 << nb_classes << " has rank " << a << "\\\\" << endl;
818 Int_matrix_print(Elt, d, d);
819
820 if (f_v) {
821 cout << "before C.print_matrix_and_centralizer_order_latex" << endl;
822 }
824 cout, R + i);
825 if (f_v) {
826 cout << "after C.print_matrix_and_centralizer_order_latex" << endl;
827 }
828
829 if (f_v) {
830 cout << "before A->element_order" << endl;
831 }
832 order = A->element_order(Elt);
833 if (f_v) {
834 cout << "after A->element_order" << endl;
835 }
836
837 cout << "The element order is : " << order << "\\\\" << endl;
838
839 Order[i] = order;
840
841 }
842
844
845 T_order.init(Order, nb_classes, FALSE, 0);
846
847
848 {
849 ofstream ost(fname_output);
851
852 L.head_easy(ost);
853 //C.report(fp, verbose_level);
854
855
856 ost << "The distribution of element orders is:" << endl;
857#if 0
858 ost << "$$" << endl;
859 T_order.print_file_tex_we_are_in_math_mode(ost, FALSE /* f_backwards */);
860 ost << "$$" << endl;
861#endif
862
863 //ost << "$" << endl;
864 T_order.print_file_tex(ost, FALSE /* f_backwards */);
865 ost << "\\\\" << endl;
866
867 ost << "$$" << endl;
868 T_order.print_array_tex(ost, FALSE /* f_backwards */);
869 ost << "$$" << endl;
870
871
872
873 int t, f, l, a, h, c;
874
875 for (t = 0; t < T_order.nb_types; t++) {
876 f = T_order.type_first[t];
877 l = T_order.type_len[t];
878 a = T_order.data_sorted[f];
879
880 if (f_v) {
881 cout << "class type " << t << " / " << T_order.nb_types << ":" << endl;
882 }
883
884 ost << "\\section{The Classes of Elements of Order $" << a << "$}" << endl;
885
886
887 ost << "There are " << l << " classes of elements of order " << a << "\\\\" << endl;
888
889 for (h = 0; h < l; h++) {
890
891 c = f + h;
892
893 i = T_order.sorting_perm_inv[c];
894
895 if (f_v) {
896 cout << "class " << h << " / " << l << " of elements of order " << a << ":" << endl;
897 }
898
899 Int_vec_zero(Mtx, d * d + 1);
900 C.make_matrix_from_class_rep(Mtx, R + i, verbose_level - 1);
901
902 A->make_element(Elt, Mtx, 0);
903
904 if (f_v) {
905 cout << "before override_Sims->element_rank_lint" << endl;
906 }
907 a = override_Sims->element_rank_lint(Elt);
908 if (f_v) {
909 cout << "after override_Sims->element_rank_lint" << endl;
910 }
911
912 ost << "Representative of class " << i << " / "
913 << nb_classes << " has rank " << a << "\\\\" << endl;
914 Int_matrix_print(Elt, d, d);
915
916 if (f_v) {
917 cout << "before C.print_matrix_and_centralizer_order_latex" << endl;
918 }
920 if (f_v) {
921 cout << "after C.print_matrix_and_centralizer_order_latex" << endl;
922 }
923
924 if (f_v) {
925 cout << "before A->element_order" << endl;
926 }
927 order = A->element_order(Elt);
928 if (f_v) {
929 cout << "after A->element_order" << endl;
930 }
931
932 ost << "The element order is : " << order << "\\\\" << endl;
933
934
935 }
936
937 }
938 L.foot(ost);
939 }
940 cout << "Written file " << fname_output << " of size "
941 << Fio.file_size(fname_output) << endl;
942
943 FREE_int(Mtx);
944 FREE_int(Elt);
945 FREE_OBJECTS(R);
946
947 if (f_v) {
948 cout << "algebra_global_with_action::conjugacy_classes_based_on_normal_forms done" << endl;
949 }
950}
951
952
953
955 int f_no_eigenvalue_one, int verbose_level)
956{
959 int nb_classes;
960 int i;
961
962
963 C.init(d, F, verbose_level);
964
965 C.make_classes(R, nb_classes, f_no_eigenvalue_one, verbose_level);
966
970 int a;
971 int *Mtx;
972 int *Elt;
973
974
975
977 A->init_projective_group(d /* n */, F,
978 FALSE /* f_semilinear */,
979 TRUE /* f_basis */, TRUE /* f_init_sims */,
980 nice_gens,
981 verbose_level);
982 FREE_OBJECT(nice_gens);
983 A->print_base();
984 A->group_order(Go);
985
986 Mtx = NEW_int(d * d);
987 Elt = NEW_int(A->elt_size_in_int);
988
989
990 for (i = 0; i < nb_classes; i++) {
991
992 C.make_matrix_from_class_rep(Mtx, R + i, 0 /*verbose_level - 1 */);
993
994 A->make_element(Elt, Mtx, 0);
995
996 a = A->Sims->element_rank_lint(Elt);
997
998 cout << "Representative of class " << i << " / "
999 << nb_classes << " has rank " << a << endl;
1000 Int_matrix_print(Elt, d, d);
1001
1003 cout, R + i);
1004
1005 }
1006
1007
1008 char fname[1000];
1009
1010 sprintf(fname, "Class_reps_GL_%d_%d.tex", d, F->q);
1011 {
1012 ofstream fp(fname);
1014
1015 L.head_easy(fp);
1016 C.report(fp, verbose_level);
1017 L.foot(fp);
1018 }
1019
1020 //make_gl_classes(d, q, f_no_eigenvalue_one, verbose_level);
1021
1022 FREE_int(Mtx);
1023 FREE_int(Elt);
1024 FREE_OBJECTS(R);
1025 FREE_OBJECT(A);
1026}
1027
1029 int f_no_eigenvalue_one, int *data, int data_sz,
1030 int verbose_level)
1031{
1032 int f_v = (verbose_level >= 1);
1035 int nb_classes;
1037
1038 if (f_v) {
1039 cout << "algebra_global_with_action::do_normal_form" << endl;
1040 }
1042 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1043
1044 if (f_v) {
1045 cout << "algebra_global_with_action::do_normal_form before C.init" << endl;
1046 }
1047 C.init(d, F, 0 /*verbose_level*/);
1048 if (f_v) {
1049 cout << "algebra_global_with_action::do_normal_form after C.init" << endl;
1050 }
1051
1052 if (f_v) {
1053 cout << "algebra_global_with_action::do_normal_form before C.make_classes" << endl;
1054 }
1055 C.make_classes(Reps, nb_classes, f_no_eigenvalue_one,
1056 0 /*verbose_level*/);
1057 if (f_v) {
1058 cout << "algebra_global_with_action::do_normal_form after C.make_classes" << endl;
1059 }
1060
1061
1062
1063 actions::action *A;
1066
1067
1069 A->init_projective_group(d /* n */, F,
1070 FALSE /* f_semilinear */, TRUE /* f_basis */, TRUE /* f_init_sims */,
1071 nice_gens,
1072 0 /*verbose_level*/);
1073 FREE_OBJECT(nice_gens);
1074 A->print_base();
1075 A->group_order(Go);
1076
1077
1078 int class_rep;
1079
1080 int *Elt, *Basis;
1081
1082 Elt = NEW_int(A->elt_size_in_int);
1083 Basis = NEW_int(d * d);
1084
1085 //go = Go.as_int();
1086
1087 cout << "Making element from data ";
1088 Int_vec_print(cout, data, data_sz);
1089 cout << endl;
1090
1091 //A->Sims->element_unrank_int(elt_idx, Elt);
1092 A->make_element(Elt, data, verbose_level);
1093
1094 cout << "Looking at element:" << endl;
1095 Int_matrix_print(Elt, d, d);
1096
1097
1099
1101
1102 C.identify_matrix(Elt, R1, Basis, verbose_level);
1103
1104 class_rep = C.find_class_rep(Reps, nb_classes, R1,
1105 0 /* verbose_level */);
1106
1107 cout << "class = " << class_rep << endl;
1108
1109 FREE_OBJECT(R1);
1110
1111
1112
1113
1114 FREE_int(Elt);
1115 FREE_int(Basis);
1116 FREE_OBJECT(A);
1117 FREE_OBJECT(F);
1118 FREE_OBJECTS(Reps);
1119}
1120
1121
1123 int f_no_eigenvalue_one, int elt_idx,
1124 int verbose_level)
1125{
1128 int nb_classes;
1130
1132 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1133
1134 C.init(d, F, verbose_level);
1135
1136 C.make_classes(Reps, nb_classes, f_no_eigenvalue_one, verbose_level);
1137
1138
1139
1140 actions::action *A;
1143
1144
1146 A->init_projective_group(d /* n */, F,
1147 FALSE /* f_semilinear */,
1148 TRUE /* f_basis */, TRUE /* f_init_sims */,
1149 nice_gens,
1150 verbose_level);
1151 FREE_OBJECT(nice_gens);
1152 A->print_base();
1153 A->group_order(Go);
1154
1155
1156 int class_rep;
1157
1158 int *Elt, *Basis;
1159
1160 Elt = NEW_int(A->elt_size_in_int);
1161 Basis = NEW_int(d * d);
1162
1163 //int go;
1164 //go = Go.as_int();
1165
1166 cout << "Looking at element " << elt_idx << ":" << endl;
1167
1168 A->Sims->element_unrank_lint(elt_idx, Elt);
1169 Int_matrix_print(Elt, d, d);
1170
1171
1173
1175
1176 C.identify_matrix(Elt, R1, Basis, verbose_level);
1177
1178 class_rep = C.find_class_rep(Reps, nb_classes, R1, 0 /* verbose_level */);
1179
1180 cout << "class = " << class_rep << endl;
1181
1182 FREE_OBJECT(R1);
1183
1184
1185
1186
1187 FREE_int(Elt);
1188 FREE_int(Basis);
1189 FREE_OBJECT(A);
1190 FREE_OBJECT(F);
1191 FREE_OBJECTS(Reps);
1192}
1193
1195 int f_no_eigenvalue_one, int verbose_level)
1196{
1199 int nb_classes;
1201
1203 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1204
1205 C.init(d, F, verbose_level);
1206
1207 C.make_classes(Reps, nb_classes, f_no_eigenvalue_one, verbose_level);
1208
1209
1210
1211 actions::action *A;
1213 int *Class_count;
1215
1216
1218 A->init_projective_group(d /* n */, F,
1219 FALSE /* f_semilinear */,
1220 TRUE /* f_basis */, TRUE /* f_init_sims */,
1221 nice_gens,
1222 verbose_level);
1223 FREE_OBJECT(nice_gens);
1224 A->print_base();
1225 A->group_order(Go);
1226
1227
1228 int i, go, class_rep;
1229
1230 int *Elt, *Basis;
1231
1232 Class_count = NEW_int(nb_classes);
1233 Int_vec_zero(Class_count, nb_classes);
1234 Elt = NEW_int(A->elt_size_in_int);
1235 Basis = NEW_int(d * d);
1236
1237 go = Go.as_int();
1238 for (i = 0; i < go; i++) {
1239
1240 cout << "Looking at element " << i << ":" << endl;
1241
1242 A->Sims->element_unrank_lint(i, Elt);
1243 Int_matrix_print(Elt, d, d);
1244
1245
1247
1249
1250 C.identify_matrix(Elt, R1, Basis, verbose_level);
1251
1252 class_rep = C.find_class_rep(Reps,
1253 nb_classes, R1, 0 /* verbose_level */);
1254
1255 cout << "class = " << class_rep << endl;
1256
1257 Class_count[class_rep]++;
1258
1259 FREE_OBJECT(R1);
1260 }
1261
1262 cout << "class : count" << endl;
1263 for (i = 0; i < nb_classes; i++) {
1264 cout << setw(3) << i << " : " << setw(10)
1265 << Class_count[i] << endl;
1266 }
1267
1268
1269
1270 FREE_int(Class_count);
1271 FREE_int(Elt);
1272 FREE_int(Basis);
1273 FREE_OBJECTS(Reps);
1274 FREE_OBJECT(A);
1275 FREE_OBJECT(F);
1276}
1277
1278void algebra_global_with_action::do_random(int q, int d, int f_no_eigenvalue_one, int verbose_level)
1279{
1280 //gl_random_matrix(d, q, verbose_level);
1281
1284 int nb_classes;
1286
1288 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1289 C.init(d, F, verbose_level);
1290
1291 C.make_classes(Reps, nb_classes, f_no_eigenvalue_one, verbose_level);
1292
1293 int *Mtx;
1294 int *Basis;
1295 int class_rep;
1296
1297
1298 Mtx = NEW_int(d * d);
1299 Basis = NEW_int(d * d);
1300
1301 C.F->Linear_algebra->random_invertible_matrix(Mtx, d, verbose_level - 2);
1302
1303
1305
1307
1308 C.identify_matrix(Mtx, R1, Basis, verbose_level);
1309
1310 class_rep = C.find_class_rep(Reps, nb_classes,
1311 R1, 0 /* verbose_level */);
1312
1313 cout << "class = " << class_rep << endl;
1314
1315 FREE_OBJECT(R1);
1316
1317 FREE_int(Mtx);
1318 FREE_int(Basis);
1319 FREE_OBJECTS(Reps);
1320 FREE_OBJECT(F);
1321}
1322
1323
1324void algebra_global_with_action::group_table(int q, int d, int f_poly, std::string &poly,
1325 int f_no_eigenvalue_one, int verbose_level)
1326{
1329 int nb_classes;
1330 int *Class_rep;
1331 int *List;
1332 int list_sz, a, b, j, h;
1334
1336 if (f_poly) {
1337 F->init_override_polynomial(q, poly, FALSE /* f_without_tables */, 0);
1338 }
1339 else {
1340 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1341 }
1342
1343 C.init(d, F, verbose_level);
1344
1345 C.make_classes(Reps, nb_classes, f_no_eigenvalue_one, verbose_level);
1346
1347
1348 actions::action *A;
1351
1352
1354 A->init_projective_group(d /* n */,
1355 F,
1356 FALSE /* f_semilinear */,
1357 TRUE /* f_basis */, TRUE /* f_init_sims */,
1358 nice_gens,
1359 verbose_level);
1360 FREE_OBJECT(nice_gens);
1361 A->print_base();
1362 A->group_order(Go);
1363
1364
1365 int i, go, class_rep;
1366 int eval;
1367
1368 int *Elt;
1369 int *Elt1;
1370 int *Elt2;
1371 int *Elt3;
1372 int *Basis;
1373
1374 Elt = NEW_int(A->elt_size_in_int);
1375 Elt1 = NEW_int(A->elt_size_in_int);
1376 Elt2 = NEW_int(A->elt_size_in_int);
1377 Elt3 = NEW_int(A->elt_size_in_int);
1378 Basis = NEW_int(d * d);
1379
1380
1381
1382
1383 go = Go.as_int();
1384 List = NEW_int(go);
1385 list_sz = 0;
1386 for (i = 0; i < go; i++) {
1387
1388 cout << "Looking at element " << i << ":" << endl;
1389
1390 A->Sims->element_unrank_lint(i, Elt);
1391 Int_matrix_print(Elt, d, d);
1392
1393 {
1396
1397
1398
1399 U.create_object_by_rank(char_poly, 0, __FILE__, __LINE__, verbose_level);
1400
1402 d, char_poly, verbose_level - 2);
1403
1404 cout << "The characteristic polynomial is ";
1405 U.print_object(char_poly, cout);
1406 cout << endl;
1407
1408 eval = U.substitute_scalar_in_polynomial(char_poly,
1409 1 /* scalar */, 0 /* verbose_level */);
1410 U.delete_object(char_poly);
1411
1412
1413 }
1414
1415 if (eval) {
1416 List[list_sz++] = i;
1417 }
1418
1419 } // next i
1420
1421 cout << "Found " << list_sz
1422 << " elements without eigenvalue one" << endl;
1423
1424
1425 Class_rep = NEW_int(list_sz);
1426
1427 for (i = 0; i < list_sz; i++) {
1428 a = List[i];
1429
1430 cout << "Looking at element " << a << ":" << endl;
1431
1432 A->Sims->element_unrank_lint(a, Elt);
1433 Int_matrix_print(Elt, d, d);
1434
1435
1437
1439
1440 C.identify_matrix(Elt, R1, Basis, verbose_level);
1441
1442 class_rep = C.find_class_rep(Reps,
1443 nb_classes, R1, 0 /* verbose_level */);
1444
1445
1446 FREE_OBJECT(R1);
1447
1448
1449 cout << "class = " << class_rep << endl;
1450 Class_rep[i] = class_rep;
1451 }
1452
1453 int *Group_table;
1454 int *Table;
1455
1456 Group_table = NEW_int(list_sz * list_sz);
1457 Int_vec_zero(Group_table, list_sz * list_sz);
1458 for (i = 0; i < list_sz; i++) {
1459 a = List[i];
1460 A->Sims->element_unrank_lint(a, Elt1);
1461 for (j = 0; j < list_sz; j++) {
1462 b = List[j];
1463 A->Sims->element_unrank_lint(b, Elt2);
1464 A->element_mult(Elt1, Elt2, Elt3, 0);
1465 h = A->Sims->element_rank_lint(Elt3);
1466 Group_table[i * list_sz + j] = h;
1467 }
1468 }
1469 int L_sz = list_sz + 1;
1470 Table = NEW_int(L_sz * L_sz);
1471 Int_vec_zero(Table, L_sz * L_sz);
1472 for (i = 0; i < list_sz; i++) {
1473 Table[0 * L_sz + 1 + i] = List[i];
1474 Table[(i + 1) * L_sz + 0] = List[i];
1475 }
1476 for (i = 0; i < list_sz; i++) {
1477 for (j = 0; j < list_sz; j++) {
1478 Table[(i + 1) * L_sz + 1 + j] =
1479 Group_table[i * list_sz + j];
1480 }
1481 }
1482 cout << "extended group table:" << endl;
1483 Int_matrix_print(Table, L_sz, L_sz);
1484
1485
1486 const char *fname = "group_table.tex";
1487
1488 {
1489 ofstream fp(fname);
1491
1492 L.head(fp, FALSE /* f_book */, FALSE /* f_title */,
1493 "" /*const char *title */, "" /*const char *author */,
1494 FALSE /* f_toc */, FALSE /* f_landscape */, FALSE /* f_12pt */,
1495 FALSE /* f_enlarged_page */, FALSE /* f_pagenumbers */,
1496 NULL /* extra_praeamble */);
1497
1498
1499 L.print_integer_matrix_tex_block_by_block(fp, Table, L_sz, L_sz, 15);
1500
1501
1502
1503 L.foot(fp);
1504
1505 }
1506
1507
1508 FREE_int(List);
1509 FREE_int(Class_rep);
1510 FREE_int(Elt);
1511 FREE_int(Elt1);
1512 FREE_int(Elt2);
1513 FREE_int(Elt3);
1514 FREE_int(Basis);
1515 FREE_OBJECTS(Reps);
1516 FREE_OBJECT(A);
1517 FREE_OBJECT(F);
1518}
1519
1521 int elt_idx, int verbose_level)
1522// problem elt_idx does not describe the group element uniquely.
1523// Reason: the sims chain is not canonical.
1524{
1525 actions::action *A;
1529
1531 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1532
1534 A->init_projective_group(d /* n */, F,
1535 FALSE /* f_semilinear */,
1536 TRUE /* f_basis */, TRUE /* f_init_sims */,
1537 nice_gens,
1538 verbose_level);
1539 FREE_OBJECT(nice_gens);
1540 A->print_base();
1541 A->group_order(Go);
1542
1543
1544 int i, go;
1545
1546 int *Elt;
1547 int *Eltv;
1548 int *Elt1;
1549 int *Elt2;
1550 int *Elt3;
1551 int *List;
1552 int sz;
1553
1554 Elt = NEW_int(A->elt_size_in_int);
1555 Eltv = NEW_int(A->elt_size_in_int);
1556 Elt1 = NEW_int(A->elt_size_in_int);
1557 Elt2 = NEW_int(A->elt_size_in_int);
1558 Elt3 = NEW_int(A->elt_size_in_int);
1559
1560
1561
1562
1563 go = Go.as_int();
1564 List = NEW_int(go);
1565 sz = 0;
1566
1567
1568
1569 A->Sims->element_unrank_lint(elt_idx, Elt);
1570
1571 cout << "Computing centralizer of element "
1572 << elt_idx << ":" << endl;
1573 Int_matrix_print(Elt, d, d);
1574
1575 A->element_invert(Elt, Eltv, 0);
1576
1577 for (i = 0; i < go; i++) {
1578
1579 cout << "Looking at element " << i << " / " << go << endl;
1580
1581 A->Sims->element_unrank_lint(i, Elt1);
1582 //int_matrix_print(Elt1, d, d);
1583
1584
1585 A->element_invert(Elt1, Elt2, 0);
1586 A->element_mult(Elt2, Elt, Elt3, 0);
1587 A->element_mult(Elt3, Elt1, Elt2, 0);
1588 A->element_mult(Elt2, Eltv, Elt3, 0);
1589 if (A->is_one(Elt3)) {
1590 List[sz++] = i;
1591 }
1592 }
1593
1594 cout << "The centralizer has order " << sz << endl;
1595
1596 int a;
1599 int *tl;
1600
1603 tl = NEW_int(A->base_len());
1604 gens->init(A, verbose_level - 2);
1605 gens->allocate(sz, verbose_level - 2);
1606
1607 for (i = 0; i < sz; i++) {
1608 a = List[i];
1609
1610 cout << "Looking at element " << i << " / " << sz
1611 << " which is " << a << endl;
1612
1613 A->Sims->element_unrank_lint(a, Elt1);
1614 Int_matrix_print(Elt1, d, d);
1615
1616 A->element_move(Elt1, gens->ith(i), 0);
1617 }
1618
1619 groups::sims *Cent;
1620
1622 gens, sz, 0 /* verbose_level */);
1624 0 /* verbose_level */);
1625 cout << "strong generators for the centralizer are:" << endl;
1626 for (i = 0; i < SG->len; i++) {
1627
1628 A->element_move(SG->ith(i), Elt1, 0);
1629 a = A->Sims->element_rank_lint(Elt1);
1630
1631 cout << "Element " << i << " / " << SG->len
1632 << " which is " << a << endl;
1633
1634 Int_matrix_print(Elt1, d, d);
1635
1636 }
1637
1638
1639
1640 FREE_int(Elt);
1641 FREE_int(Eltv);
1642 FREE_int(Elt1);
1643 FREE_int(Elt2);
1644 FREE_int(Elt3);
1645 FREE_OBJECT(A);
1646 FREE_OBJECT(F);
1647}
1648
1649
1651 int elt_idx, int verbose_level)
1652{
1654 actions::action *A_PGL;
1655 actions::action *A_GL;
1658
1660 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1661
1662 A_PGL = NEW_OBJECT(actions::action);
1663 A_PGL->init_projective_group(d /* n */, F,
1664 FALSE /* f_semilinear */,
1665 TRUE /* f_basis */, TRUE /* f_init_sims */,
1666 nice_gens,
1667 0 /*verbose_level*/);
1668 FREE_OBJECT(nice_gens);
1669 A_PGL->print_base();
1670 A_PGL->group_order(Go);
1671
1673 A_GL->init_general_linear_group(d /* n */, F,
1674 FALSE /* f_semilinear */,
1675 TRUE /* f_basis */, TRUE /* f_init_sims */,
1676 nice_gens,
1677 0 /*verbose_level*/);
1678 FREE_OBJECT(nice_gens);
1679 A_GL->print_base();
1680 A_GL->group_order(Go);
1681
1682 int *Elt;
1683
1684 Elt = NEW_int(A_PGL->elt_size_in_int);
1685
1686
1687 //go = Go.as_int();
1688
1689 cout << "Looking at element " << elt_idx << ":" << endl;
1690
1691 A_PGL->Sims->element_unrank_lint(elt_idx, Elt);
1692 Int_matrix_print(Elt, d, d);
1693
1697
1700
1701 cout << "before Cent->init_centralizer_of_matrix" << endl;
1702 Cent->init_centralizer_of_matrix(A_PGL, Elt, verbose_level);
1703 cout << "before Cent->init_centralizer_of_matrix" << endl;
1704
1705 cout << "before Cent_GL->init_centralizer_of_matrix_general_linear" << endl;
1707 A_PGL, A_GL, Elt, verbose_level);
1708 cout << "after Cent_GL->init_centralizer_of_matrix_general_linear" << endl;
1709
1710
1711
1712 Cent->group_order(go);
1713 Cent_GL->group_order(go1);
1714
1715 cout << "order of centralizer in PGL: " << go << " in GL: " << go1 << endl;
1716 FREE_int(Elt);
1717 FREE_OBJECT(Cent);
1718 FREE_OBJECT(Cent_GL);
1719 FREE_OBJECT(A_GL);
1720 FREE_OBJECT(A_PGL);
1721 FREE_OBJECT(F);
1722
1723}
1724
1725void algebra_global_with_action::centralizer(int q, int d, int verbose_level)
1726{
1727 actions::action *A;
1731 int go, i;
1732
1734 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
1736 A->init_projective_group(d /* n */, F,
1737 FALSE /* f_semilinear */,
1738 TRUE /* f_basis */, TRUE /* f_init_sims */,
1739 nice_gens,
1740 0 /*verbose_level*/);
1741 FREE_OBJECT(nice_gens);
1742 A->print_base();
1743 A->group_order(Go);
1744
1745 int *Elt;
1746
1747 Elt = NEW_int(A->elt_size_in_int);
1748
1749
1750 go = Go.as_int();
1751
1752 for (i = 0; i < go; i++) {
1753 cout << "Looking at element " << i << ":" << endl;
1754
1755 A->Sims->element_unrank_lint(i, Elt);
1756 Int_matrix_print(Elt, d, d);
1757
1758 groups::sims *Cent;
1760
1762 Elt, verbose_level);
1763 Cent->group_order(cent_go);
1764
1765 cout << "Looking at element " << i
1766 << ", the centralizer has order " << cent_go << endl;
1767
1768
1769
1770 FREE_OBJECT(Cent);
1771
1772 }
1773
1774
1775
1776 FREE_int(Elt);
1777 FREE_OBJECT(A);
1778 FREE_OBJECT(F);
1779}
1780
1781
1784 data_structures_groups::vector_ge *SG, int *&perm, int verbose_level)
1785{
1787 int goi, i;
1789
1790 S->group_order(go);
1791 goi = go.as_int();
1792 cout << "computing the regular representation of degree "
1793 << go << ":" << endl;
1794 perm = NEW_int(SG->len * goi);
1795
1796 for (i = 0; i < SG->len; i++) {
1797 S->regular_representation(SG->ith(i),
1798 perm + i * goi, verbose_level);
1799 }
1800 cout << endl;
1801 for (i = 0; i < SG->len; i++) {
1802 Combi.perm_print_offset(cout,
1803 perm + i * goi, goi, 1 /* offset */,
1804 FALSE /* f_print_cycles_of_length_one */,
1805 FALSE /* f_cycle_length */, FALSE, 0,
1806 TRUE /* f_orbit_structure */,
1807 NULL, NULL);
1808 cout << endl;
1809 }
1810}
1811
1813 actions::action *A, groups::sims *S, int goi,
1814 data_structures_groups::vector_ge *gens, int *primes,
1815 int verbose_level)
1816{
1817 int *Elt1, *Elt2, *Elt3, *Elt4;
1818 int i, j, jj, k, l, a, b;
1819 int word[100];
1820 int *word_list;
1821 int *inverse_word_list;
1822
1823 Elt1 = NEW_int(A->elt_size_in_int);
1824 Elt2 = NEW_int(A->elt_size_in_int);
1825 Elt3 = NEW_int(A->elt_size_in_int);
1826 Elt4 = NEW_int(A->elt_size_in_int);
1827
1828 word_list = NEW_int(goi);
1829 inverse_word_list = NEW_int(goi);
1830
1831 l = gens->len;
1832
1833 cout << "presentation of length " << l << endl;
1834 cout << "primes: ";
1835 Int_vec_print(cout, primes, l);
1836 cout << endl;
1837
1838#if 0
1839 // replace g5 by g5 * g3:
1840 A->mult(gens->ith(5), gens->ith(3), Elt1);
1841 A->move(Elt1, gens->ith(5));
1842
1843 // replace g7 by g7 * g4:
1844 A->mult(gens->ith(7), gens->ith(4), Elt1);
1845 A->move(Elt1, gens->ith(7));
1846#endif
1847
1848
1849
1850 for (i = 0; i < goi; i++) {
1851 inverse_word_list[i] = -1;
1852 }
1853 for (i = 0; i < goi; i++) {
1854 A->one(Elt1);
1855 j = i;
1856 for (k = 0; k < l; k++) {
1857 b = j % primes[k];
1858 word[k] = b;
1859 j = j - b;
1860 j = j / primes[k];
1861 }
1862 for (k = 0; k < l; k++) {
1863 b = word[k];
1864 while (b) {
1865 A->mult(Elt1, gens->ith(k), Elt2);
1866 A->move(Elt2, Elt1);
1867 b--;
1868 }
1869 }
1870 A->move(Elt1, Elt2);
1871 a = S->element_rank_lint(Elt2);
1872 word_list[i] = a;
1873 inverse_word_list[a] = i;
1874 cout << "word " << i << " = ";
1875 Int_vec_print(cout, word, 9);
1876 cout << " gives " << endl;
1877 A->print(cout, Elt1);
1878 cout << "which is element " << word_list[i] << endl;
1879 cout << endl;
1880 }
1881 cout << "i : word_list[i] : inverse_word_list[i]" << endl;
1882 for (i = 0; i < goi; i++) {
1883 cout << setw(5) << i << " : " << setw(5) << word_list[i]
1884 << " : " << setw(5) << inverse_word_list[i] << endl;
1885 }
1886
1887
1888
1889 for (i = 0; i < l; i++) {
1890 cout << "generator " << i << ":" << endl;
1891 A->print(cout, gens->ith(i));
1892 cout << endl;
1893 }
1894 for (i = 0; i < l; i++) {
1895 A->move(gens->ith(i), Elt1);
1896 A->element_power_int_in_place(Elt1, primes[i], 0);
1897 a = S->element_rank_lint(Elt1);
1898 cout << "generator " << i << " to the power " << primes[i]
1899 << " is elt " << a << " which is word "
1900 << inverse_word_list[a];
1901 j = inverse_word_list[a];
1902 for (k = 0; k < l; k++) {
1903 b = j % primes[k];
1904 word[k] = b;
1905 j = j - b;
1906 j = j / primes[k];
1907 }
1908 Int_vec_print(cout, word, l);
1909 cout << " :" << endl;
1910 A->print(cout, Elt1);
1911 cout << endl;
1912 }
1913
1914
1915 for (i = 0; i < l; i++) {
1916 A->move(gens->ith(i), Elt1);
1917 A->invert(Elt1, Elt2);
1918 for (j = 0; j < i; j++) {
1919 A->mult(Elt2, gens->ith(j), Elt3);
1920 A->mult(Elt3, Elt1, Elt4);
1921 cout << "g_" << j << "^{g_" << i << "} =" << endl;
1922 a = S->element_rank_lint(Elt4);
1923 cout << "which is element " << a << " which is word "
1924 << inverse_word_list[a] << " = ";
1925 jj = inverse_word_list[a];
1926 for (k = 0; k < l; k++) {
1927 b = jj % primes[k];
1928 word[k] = b;
1929 jj = jj - b;
1930 jj = jj / primes[k];
1931 }
1932 Int_vec_print(cout, word, l);
1933 cout << endl;
1934 A->print(cout, Elt4);
1935 cout << endl;
1936 }
1937 cout << endl;
1938 }
1939
1940 FREE_int(Elt1);
1941 FREE_int(Elt2);
1942 FREE_int(Elt3);
1943 FREE_int(Elt4);
1944
1945 FREE_int(word_list);
1946 FREE_int(inverse_word_list);
1947}
1948
1949
1951 int size, int *Data, int verbose_level)
1952{
1953 int f_v = (verbose_level >= 1);
1955 int i, j, k, a, h;
1956 //unipoly_domain U;
1957 //unipoly_object char_poly;
1959
1960 if (f_v) {
1961 cout << "algebra_global_with_action::do_eigenstuff" << endl;
1962 }
1963 M.m_mn(size, size);
1964 k = 0;
1965 for (i = 0; i < size; i++) {
1966 for (j = 0; j < size; j++) {
1967 a = Data[k++];
1968 M.m_iji(i, j, a);
1969 }
1970 }
1971
1972 if (f_v) {
1973 cout << "M=" << endl;
1974 cout << M << endl;
1975 }
1976
1977 //domain d(q);
1978 domain d(F);
1979 with w(&d);
1980
1981#if 0
1982
1983 matrix M2;
1984 M2 = M;
1985 for (i = 0; i < size; i++) {
1986 unipoly mue;
1987 M2.KX_module_order_ideal(i, mue, verbose_level - 1);
1988 cout << "order ideal " << i << ":" << endl;
1989 cout << mue << endl;
1990 }
1991#endif
1992
1993 // This part uses DISCRETA data structures:
1994
1995 discreta_matrix M1, P, Pv, Q, Qv, S, T;
1996
1998 M.minus_X_times_id();
1999 M1 = M;
2000 cout << "M - x * Id has been computed" << endl;
2001 //cout << "M - x * Id =" << endl << M << endl;
2002
2003 if (f_v) {
2004 cout << "M - x * Id = " << endl;
2005 cout << M << endl;
2006 }
2007
2008
2009 cout << "before M.smith_normal_form" << endl;
2010 M.smith_normal_form(P, Pv, Q, Qv, verbose_level);
2011 cout << "after M.smith_normal_form" << endl;
2012
2013 cout << "the Smith normal form is:" << endl;
2014 cout << M << endl;
2015
2016 S.mult(P, Pv);
2017 cout << "P * Pv=" << endl << S << endl;
2018
2019 S.mult(Q, Qv);
2020 cout << "Q * Qv=" << endl << S << endl;
2021
2022 S.mult(P, M1);
2023 cout << "T.mult(S, Q):" << endl;
2024 T.mult(S, Q);
2025 cout << "T=" << endl << T << endl;
2026
2027
2028 unipoly charpoly;
2029 int deg;
2030 int l, lv, b, c;
2031
2032 charpoly = M.s_ij(size - 1, size - 1);
2033
2034 cout << "characteristic polynomial:" << charpoly << endl;
2035 deg = charpoly.degree();
2036 cout << "has degree " << deg << endl;
2037 l = charpoly.s_ii(deg);
2038 cout << "leading coefficient " << l << endl;
2039 lv = F->inverse(l);
2040 cout << "leading coefficient inverse " << lv << endl;
2041 for (i = 0; i <= deg; i++) {
2042 b = charpoly.s_ii(i);
2043 c = F->mult(b, lv);
2044 charpoly.m_ii(i, c);
2045 }
2046 cout << "monic characteristic polynomial:" << charpoly << endl;
2047
2048 integer x, y;
2049 int *roots;
2050 int nb_roots = 0;
2051
2052 roots = new int[F->q];
2053
2054 for (a = 0; a < F->q; a++) {
2055 x.m_i(a);
2056 charpoly.evaluate_at(x, y);
2057 if (y.s_i() == 0) {
2058 cout << "root " << a << endl;
2059 roots[nb_roots++] = a;
2060 }
2061 }
2062 cout << "we found the following eigenvalues: ";
2063 Int_vec_print(cout, roots, nb_roots);
2064 cout << endl;
2065
2066 int eigenvalue, eigenvalue_negative;
2067
2068 for (h = 0; h < nb_roots; h++) {
2069 eigenvalue = roots[h];
2070 cout << "looking at eigenvalue " << eigenvalue << endl;
2071 int *A, *B, *Bt;
2072 eigenvalue_negative = F->negate(eigenvalue);
2073 A = new int[size * size];
2074 B = new int[size * size];
2075 Bt = new int[size * size];
2076 for (i = 0; i < size; i++) {
2077 for (j = 0; j < size; j++) {
2078 A[i * size + j] = Data[i * size + j];
2079 }
2080 }
2081 cout << "A:" << endl;
2083 size, size, size, F->log10_of_q);
2084 for (i = 0; i < size; i++) {
2085 for (j = 0; j < size; j++) {
2086 a = A[i * size + j];
2087 if (j == i) {
2088 a = F->add(a, eigenvalue_negative);
2089 }
2090 B[i * size + j] = a;
2091 }
2092 }
2093 cout << "B = A - eigenvalue * I:" << endl;
2095 size, size, size, F->log10_of_q);
2096
2097 cout << "B transposed:" << endl;
2098 F->Linear_algebra->transpose_matrix(B, Bt, size, size);
2100 size, size, size, F->log10_of_q);
2101
2102 int f_special = FALSE;
2103 int f_complete = TRUE;
2104 int *base_cols;
2105 int nb_base_cols;
2106 int f_P = FALSE;
2107 int kernel_m, kernel_n, *kernel;
2108
2109 base_cols = new int[size];
2110 kernel = new int[size * size];
2111
2112 nb_base_cols = F->Linear_algebra->Gauss_int(Bt,
2113 f_special, f_complete, base_cols,
2114 f_P, NULL, size, size, size,
2115 verbose_level - 1);
2116 cout << "rank = " << nb_base_cols << endl;
2117
2118 F->Linear_algebra->matrix_get_kernel(Bt, size, size, base_cols, nb_base_cols,
2119 kernel_m, kernel_n, kernel, 0 /* verbose_level */);
2120 cout << "kernel = left eigenvectors:" << endl;
2122 size, kernel_n, kernel_n, F->log10_of_q);
2123
2124 int *vec1, *vec2;
2125 vec1 = new int[size];
2126 vec2 = new int[size];
2127 for (i = 0; i < size; i++) {
2128 vec1[i] = kernel[i * kernel_n + 0];
2129 }
2130 Int_vec_print(cout, vec1, size);
2131 cout << endl;
2132 F->PG_element_normalize_from_front(vec1, 1, size);
2133 Int_vec_print(cout, vec1, size);
2134 cout << endl;
2135 F->PG_element_rank_modified(vec1, 1, size, a);
2136 cout << "has rank " << a << endl;
2137
2138
2139 cout << "computing xA" << endl;
2140
2141 F->Linear_algebra->mult_vector_from_the_left(vec1, A, vec2, size, size);
2142 Int_vec_print(cout, vec2, size);
2143 cout << endl;
2144 F->PG_element_normalize_from_front(vec2, 1, size);
2145 Int_vec_print(cout, vec2, size);
2146 cout << endl;
2147 F->PG_element_rank_modified(vec2, 1, size, a);
2148 cout << "has rank " << a << endl;
2149
2150 delete [] vec1;
2151 delete [] vec2;
2152
2153 delete [] A;
2154 delete [] B;
2155 delete [] Bt;
2156 }
2157}
2158
2159
2160// a5_in_PSL.cpp
2161//
2162// Anton Betten, Evi Haberberger
2163// 10.06.2000
2164//
2165// moved here from D2: 3/18/2010
2166
2167void algebra_global_with_action::A5_in_PSL_(int q, int verbose_level)
2168{
2169 int f_v = (verbose_level >= 1);
2170 int p, f;
2171 discreta_matrix A, B, D; //, B1, B2, C, D, A2, A3, A4;
2173
2174
2175 NT.factor_prime_power(q, p, f);
2176 domain *dom;
2177
2178 if (f_v) {
2179 cout << "algebra_global_with_action::A5_in_PSL_ "
2180 "q=" << q << ", p=" << p << ", f=" << f << endl;
2181 }
2182 dom = allocate_finite_field_domain(q, verbose_level);
2183
2184 A5_in_PSL_2_q(q, A, B, dom, verbose_level);
2185
2186 {
2187 with w(dom);
2188 D.mult(A, B);
2189
2190 if (f_v) {
2191 cout << "A5_in_PSL_2_q done" << endl;
2192 cout << "A=\n" << A << endl;
2193 cout << "B=\n" << B << endl;
2194 cout << "AB=\n" << D << endl;
2195 int AA[4], BB[4], DD[4];
2199 cout << "A=" << endl;
2200 Int_vec_print_integer_matrix_width(cout, AA, 2, 2, 2, 7);
2201 cout << "B=" << endl;
2202 Int_vec_print_integer_matrix_width(cout, BB, 2, 2, 2, 7);
2203 cout << "AB=" << endl;
2204 Int_vec_print_integer_matrix_width(cout, DD, 2, 2, 2, 7);
2205 }
2206
2207 int oA, oB, oD;
2208
2209 oA = proj_order(A);
2210 oB = proj_order(B);
2211 oD = proj_order(D);
2212 if (f_v) {
2213 cout << "projective order of A = " << oA << endl;
2214 cout << "projective order of B = " << oB << endl;
2215 cout << "projective order of AB = " << oD << endl;
2216 }
2217
2218
2219 }
2221}
2222
2226 layer2_discreta::domain *dom_GFq, int verbose_level)
2227{
2228 if (((q - 1) % 5) == 0) {
2229 A5_in_PSL_2_q_easy(q, A, B, dom_GFq, verbose_level);
2230 }
2231 else if (((q + 1) % 5) == 0) {
2232 A5_in_PSL_2_q_hard(q, A, B, dom_GFq, verbose_level);
2233 }
2234 else {
2235 cout << "either q + 1 or q - 1 must be divisible by 5!" << endl;
2236 exit(1);
2237 }
2238}
2239
2243 layer2_discreta::domain *dom_GFq,
2244 int verbose_level)
2245{
2246 int f_v = (verbose_level >= 1);
2247 int i, r;
2248 integer zeta5, zeta5v, b, c, d, b2, e;
2249
2250 if (f_v) {
2251 cout << "algebra_global_with_action::A5_in_PSL_2_q_easy verbose_level=" << verbose_level << endl;
2252 }
2253 with w(dom_GFq);
2254
2255 i = (q - 1) / 5;
2257 zeta5.m_i(r);
2258 zeta5.power_int(i);
2259 zeta5v = zeta5;
2260 zeta5v.power_int(4);
2261
2262 if (f_v) {
2263 cout << "zeta5=" << zeta5 << endl;
2264 cout << "zeta5v=" << zeta5v << endl;
2265 }
2266
2267 A.m_mn_n(2, 2);
2268 B.m_mn_n(2, 2);
2269 A[0][0] = zeta5;
2270 A[0][1].zero();
2271 A[1][0].zero();
2272 A[1][1] = zeta5v;
2273
2274 if (f_v) {
2275 cout << "A=\n" << A << endl;
2276 }
2277
2278 // b := (zeta5 - zeta5^{-1})^{-1}:
2279 b = zeta5v;
2280 b.negate();
2281 b += zeta5;
2282 b.invert();
2283
2284 // determine c, d such that $-b^2 -cd = 1$:
2285 b2 = b;
2286 b2 *= b;
2287 b2.negate();
2288 e.m_one();
2289 e += b2;
2290 c.one();
2291 d = e;
2292 B[0][0] = b;
2293 B[0][1] = c;
2294 B[1][0] = d;
2295 B[1][1] = b;
2296 B[1][1].negate();
2297
2298 if (f_v) {
2299 cout << "B=\n" << B << endl;
2300 }
2301 if (f_v) {
2302 cout << "algebra_global_with_action::A5_in_PSL_2_q_easy done" << endl;
2303 }
2304}
2305
2306
2310 layer2_discreta::domain *dom_GFq,
2311 int verbose_level)
2312{
2313 int f_v = (verbose_level >= 1);
2314 with w(dom_GFq);
2315 unipoly m;
2316 int i, q2;
2317 discreta_matrix S, Sv, E, /*Sbart, SSbart,*/ AA, BB;
2318 integer a, b, m1;
2319 int norm_alpha, l;
2320
2321 if (f_v) {
2322 cout << "algebra_global_with_action::A5_in_PSL_2_q_hard" << endl;
2323 }
2324#if 0
2325 m.get_an_irreducible_polynomial(2, verbose_level);
2326#else
2327 m.Singer(q, 2, verbose_level);
2328#endif
2329 cout << "m=" << m << endl;
2330 norm_alpha = m.s_ii(0);
2331 cout << "norm_alpha=" << norm_alpha << endl;
2332
2333 domain GFq2(&m, dom_GFq);
2334 with ww(&GFq2);
2335 q2 = q * q;
2336
2337 if (f_v) {
2338 cout << "searching for element of norm -1:" << endl;
2339 }
2340 S.m_mn_n(2, 2);
2341 m1.m_one();
2342 if (f_v) {
2343 cout << "-1=" << m1 << endl;
2344 }
2345#if 0
2346 for (i = q; i < q2; i++) {
2347 // cout << "i=" << i;
2348 a.m_i(i);
2349 b = a;
2350 b.power_int(q + 1);
2351 cout << i << ": (" << a << ")^" << q + 1 << " = " << b << endl;
2352 if (b.is_m_one())
2353 break;
2354 }
2355 if (i == q2) {
2356 cout << "A5_in_PSL_2_q_hard() couldn't find element of norm -1" << endl;
2357 exit(1);
2358 }
2359#else
2360 a.m_i(q); // alpha
2361 a.power_int((q - 1) >> 1);
2362 b = a;
2363 b.power_int(q + 1);
2364 cout << "(" << a << ")^" << q + 1 << " = " << b << endl;
2365 if (!b.is_m_one()) {
2366 cout << "fatal: element a does not have norm -1" << endl;
2367 exit(1);
2368 }
2369#endif
2370 if (f_v) {
2371 cout << "element of norm -1:" << a << endl;
2372 }
2373#if 1
2374 S[0][0] = a;
2375 S[0][1].one();
2376 S[1][0].one();
2377 S[1][0].negate();
2378 S[1][1] = a;
2379#else
2380 // Huppert I page 105 (does not work!)
2381 S[0][0].one();
2382 S[0][1] = a;
2383 S[1][0].one();
2384 S[1][1] = a;
2385 S[1][1].negate();
2386#endif
2387 if (f_v) {
2388 cout << "S=\n" << S << endl;
2389 }
2390 Sv = S;
2391 Sv.invert();
2392 E.mult(S, Sv);
2393 if (f_v) {
2394 cout << "S^{-1}=\n" << Sv << endl;
2395 cout << "S \\cdot S^{-1}=\n" << E << endl;
2396 }
2397
2398#if 0
2399 Sbart = S;
2400 elementwise_power_int(Sbart, q);
2401 Sbart.transpose();
2402 SSbart.mult(S, Sbart);
2403 if (f_v) {
2404 cout << "\\bar{S}^\\top=\n" << Sbart << endl;
2405 cout << "S \\cdot \\bar{S}^\\top=\n" << SSbart << endl;
2406 }
2407#endif
2408
2409 int r;
2410 integer zeta5, zeta5v;
2411
2412 i = (q2 - 1) / 5;
2414 zeta5.m_i(r);
2415 zeta5.power_int(i);
2416 zeta5v = zeta5;
2417 zeta5v.power_int(4);
2418
2419 if (f_v) {
2420 cout << "zeta5=" << zeta5 << endl;
2421 cout << "zeta5v=" << zeta5v << endl;
2422 }
2423
2424 AA.m_mn_n(2, 2);
2425 BB.m_mn_n(2, 2);
2426 AA[0][0] = zeta5;
2427 AA[0][1].zero();
2428 AA[1][0].zero();
2429 AA[1][1] = zeta5v;
2430
2431 if (f_v) {
2432 cout << "AA=\n" << AA << endl;
2433 }
2434
2435 integer bb, c, d, e, f, c1, b1;
2436
2437 // b := (zeta5 - zeta5^{-1})^{-1}:
2438 b = zeta5v;
2439 b.negate();
2440 b += zeta5;
2441 b.invert();
2442
2443 if (f_v) {
2444 cout << "b=" << b << endl;
2445 }
2446
2447 // compute $c$ with $N(c) = c \cdot \bar{c} = 1 - N(b) = 1 - b \cdot \bar{b}$:
2448 b1 = b;
2449 b1.power_int(q);
2450
2451 bb.mult(b, b1);
2452 bb.negate();
2453 e.one();
2454 e += bb;
2455 if (f_v) {
2456 cout << "1 - b \\cdot \\bar{b}=" << e << endl;
2457 }
2458#if 1
2459 for (l = 0; l < q; l++) {
2460 c.m_i(norm_alpha);
2461 f = c;
2462 f.power_int(l);
2463 if (f.compare_with(e) == 0) {
2464 break;
2465 }
2466 }
2467 if (f_v) {
2468 cout << "the discrete log with respect to " << norm_alpha << " is " << l << endl;
2469 }
2470 c.m_i(q);
2471 c.power_int(l);
2472
2473 f = c;
2474 f.power_int(q + 1);
2475 if (f.compare_with(e) != 0) {
2476 cout << "fatal: norm of " << c << " is not " << e << endl;
2477 exit(1);
2478 }
2479#else
2480 for (i = q; i < q2; i++) {
2481 c.m_i(i);
2482 f = c;
2483 f.power_int(q + 1);
2484 if (f.compare_with(e) == 0) {
2485 break;
2486 }
2487 }
2488 if (i == q2) {
2489 cout << "A5_in_PSL_2_q_hard() couldn't find element c" << endl;
2490 exit(1);
2491 }
2492#endif
2493 if (f_v) {
2494 cout << "element c=" << c << endl;
2495 }
2496 c1 = c;
2497 c1.power_int(q);
2498
2499 BB[0][0] = b;
2500 BB[0][1] = c;
2501 BB[1][0] = c1;
2502 BB[1][0].negate();
2503 BB[1][1] = b1;
2504 if (f_v) {
2505 cout << "BB=\n" << BB << endl;
2506 }
2507 A.mult(S, AA);
2508 A *= Sv;
2509 B.mult(S, BB);
2510 B *= Sv;
2511
2512 if (f_v) {
2513 cout << "A=\n" << A << endl;
2514 cout << "B=\n" << B << endl;
2515 }
2516 if (f_v) {
2517 cout << "algebra_global_with_action::A5_in_PSL_2_q_hard done" << endl;
2518 }
2519}
2520
2522{
2524 int m, n;
2525 int ord;
2526
2527 m = A.s_m();
2528 n = A.s_n();
2529 if (m != n) {
2530 cout << "algebra_global_with_action::proj_order m != n" << endl;
2531 exit(1);
2532 }
2533 if (A.is_zero()) {
2534 ord = 0;
2535 cout << "is zero matrix!" << endl;
2536 }
2537 else {
2538 B = A;
2539 ord = 1;
2540 while (is_in_center(B) == FALSE) {
2541 ord++;
2542 B *= A;
2543 }
2544 }
2545 return ord;
2546}
2550{
2551 int i, m, n;
2552
2553 m = A.s_m();
2554 n = A.s_n();
2555 if (m != n) {
2556 cout << "ERROR: matrix::trace not a square matrix!" << endl;
2557 exit(1);
2558 }
2559 tr = A[0][0];
2560 for (i = 1; i < m; i++) {
2561 tr += A[i][i];
2562 }
2563}
2564
2567{
2568 int i, j, m, n;
2569
2570 m = A.s_m();
2571 n = A.s_n();
2572
2573 for (i = 0; i < m; i++) {
2574 for (j = 0; j < n; j++) {
2575 A[i][j].power_int(k);
2576 }
2577 }
2578}
2579
2582{
2583 int m, n, i, j;
2585 integer c;
2586
2587 m = B.s_m();
2588 n = B.s_n();
2589 A = B;
2590 c = A[0][0];
2591 for (i = 0; i < m; i++) {
2592 for (j = 0; j < n; j++) {
2593 integer e;
2594
2595 e = A[i][j];
2596 if (i != j && !e.is_zero()) {
2597 return FALSE;
2598 }
2599 if (i == j && e.s_i() != c.s_i()) {
2600 return FALSE;
2601 }
2602 }
2603 }
2604 return TRUE;
2605}
2606
2607
2609 layer2_discreta::discreta_matrix &A, int *AA, int q)
2610{
2611 int m, n, i, j, /*h, l,*/ val;
2612
2613 m = A.s_m();
2614 n = A.s_n();
2615 for (i = 0; i < m; i++) {
2616 for (j = 0; j < n; j++) {
2617
2618 //cout << "i=" << i << " j=" << j << endl;
2619 discreta_base a;
2620
2621 A[i][j].copyobject_to(a);
2622
2623 //cout << "a=" << a << endl;
2624 //a.printobjectkindln(cout);
2625
2626 val = a.s_i_i();
2627#if 0
2628 l = a.as_unipoly().s_l();
2629 cout << "degree=" << l << endl;
2630 for (h = l - 1; h >= 0; h--) {
2631 val *= q;
2632 cout << "coeff=" << a.as_unipoly().s_ii(h) << endl;
2633 val += a.as_unipoly().s_ii(h);
2634 }
2635#endif
2636 //cout << "val=" << val << endl;
2637 AA[i * n + j] = val;
2638 }
2639 }
2640}
2641
2642
2643
2644
2645
2647{
2648 int f_v = (verbose_level >= 1);
2649
2650 if (f_v) {
2651 cout << "algebra_global_with_action::young_symmetrizer" << endl;
2652 }
2653
2654 young *Y;
2655
2656 Y = NEW_OBJECT(young);
2657
2658 Y->init(n, verbose_level);
2659
2660
2661
2662 int *elt1, *elt2, *h_alpha, *elt4, *elt5, *elt6, *elt7;
2663
2664 Y->group_ring_element_create(Y->A, Y->S, elt1);
2665 Y->group_ring_element_create(Y->A, Y->S, elt2);
2666 Y->group_ring_element_create(Y->A, Y->S, h_alpha);
2667 Y->group_ring_element_create(Y->A, Y->S, elt4);
2668 Y->group_ring_element_create(Y->A, Y->S, elt5);
2669 Y->group_ring_element_create(Y->A, Y->S, elt6);
2670 Y->group_ring_element_create(Y->A, Y->S, elt7);
2671
2672
2673
2674 int *part;
2675 int *parts;
2676
2677 int *Base;
2678 int *Base_inv;
2679 int *Fst;
2680 int *Len;
2681 int cnt, s, i, j;
2683
2684
2685 part = NEW_int(n);
2686 parts = NEW_int(n);
2687 Fst = NEW_int(Y->goi);
2688 Len = NEW_int(Y->goi);
2689 Base = NEW_int(Y->goi * Y->goi * Y->D->size_of_instance_in_int);
2690 Base_inv = NEW_int(Y->goi * Y->goi * Y->D->size_of_instance_in_int);
2691 s = 0;
2692 Fst[0] = 0;
2693
2694 // create the first partition in exponential notation:
2695 Combi.partition_first(part, n);
2696 cnt = 0;
2697
2698
2699 while (TRUE) {
2700 int nb_parts;
2701
2702 // turn the partition from exponential notation into the list of parts:
2703 // the large parts come first.
2704 nb_parts = 0;
2705 for (i = n - 1; i >= 0; i--) {
2706 for (j = 0; j < part[i]; j++) {
2707 parts[nb_parts++] = i + 1;
2708 }
2709 }
2710
2711 if (f_v) {
2712 cout << "partition ";
2713 Int_vec_print(cout, parts, nb_parts);
2714 cout << endl;
2715 }
2716
2717
2718 // Create the young symmetrizer based on the partition.
2719 // We do the very first tableau for this partition.
2720
2721 int *tableau;
2722
2723 tableau = NEW_int(n);
2724 for (i = 0; i < n; i++) {
2725 tableau[i] = i;
2726 }
2727 Y->young_symmetrizer(parts, nb_parts, tableau, elt1, elt2, h_alpha, verbose_level);
2728 FREE_int(tableau);
2729
2730
2731 if (f_v) {
2732 cout << "h_alpha =" << endl;
2733 Y->group_ring_element_print(Y->A, Y->S, h_alpha);
2734 cout << endl;
2735 }
2736
2737
2738 Y->group_ring_element_copy(Y->A, Y->S, h_alpha, elt4);
2739 Y->group_ring_element_mult(Y->A, Y->S, elt4, elt4, elt5);
2740
2741 if (f_v) {
2742 cout << "h_alpha * h_alpha=" << endl;
2743 Y->group_ring_element_print(Y->A, Y->S, elt5);
2744 cout << endl;
2745 }
2746
2747 int *Module_Base;
2748 int *base_cols;
2749 int rk;
2750
2751
2752 Y->create_module(h_alpha,
2753 Module_Base, base_cols, rk,
2754 verbose_level);
2755
2756 if (f_v) {
2757 cout << "Module_Basis=" << endl;
2758 Y->D->print_matrix(Module_Base, rk, Y->goi);
2759 }
2760
2761
2762 for (i = 0; i < rk; i++) {
2763 for (j = 0; j < Y->goi; j++) {
2764 Y->D->copy(Y->D->offset(Module_Base, i * Y->goi + j),
2765 Y->D->offset(Base, s * Y->goi + j), 0);
2766 }
2767 s++;
2768 }
2769 Len[cnt] = s - Fst[cnt];
2770 Fst[cnt + 1] = s;
2771
2772 Y->create_representations(Module_Base, base_cols, rk, verbose_level);
2773
2774
2775 FREE_int(Module_Base);
2776 FREE_int(base_cols);
2777
2778
2779 // create the next partition in exponential notation:
2780 if (!Combi.partition_next(part, n)) {
2781 break;
2782 }
2783 cnt++;
2784 }
2785
2786 if (f_v) {
2787 cout << "Basis of submodule=" << endl;
2788 Y->D->print_matrix(Base, s, Y->goi);
2789 }
2790
2791
2792 FREE_int(part);
2793 FREE_int(parts);
2794 FREE_int(Fst);
2795 FREE_int(Len);
2796 if (f_v) {
2797 cout << "before freeing Base" << endl;
2798 }
2799 FREE_int(Base);
2800 FREE_int(Base_inv);
2801 if (f_v) {
2802 cout << "before freeing Y" << endl;
2803 }
2804 FREE_OBJECT(Y);
2805 if (f_v) {
2806 cout << "before freeing elt1" << endl;
2807 }
2808 FREE_int(elt1);
2809 FREE_int(elt2);
2810 FREE_int(h_alpha);
2811 FREE_int(elt4);
2812 FREE_int(elt5);
2813 FREE_int(elt6);
2814 FREE_int(elt7);
2815 if (f_v) {
2816 cout << "algebra_global_with_action::young_symmetrizer done" << endl;
2817 }
2818}
2819
2821{
2822 int f_v = (verbose_level >= 1);
2823
2824 if (f_v) {
2825 cout << "algebra_global_with_action::young_symmetrizer_sym_4" << endl;
2826 }
2827 young *Y;
2828 int n = 4;
2829
2830 Y = NEW_OBJECT(young);
2831
2832 Y->init(n, verbose_level);
2833
2834
2835
2836 int *elt1, *elt2, *h_alpha, *elt4, *elt5, *elt6, *elt7;
2837
2838 Y->group_ring_element_create(Y->A, Y->S, elt1);
2839 Y->group_ring_element_create(Y->A, Y->S, elt2);
2840 Y->group_ring_element_create(Y->A, Y->S, h_alpha);
2841 Y->group_ring_element_create(Y->A, Y->S, elt4);
2842 Y->group_ring_element_create(Y->A, Y->S, elt5);
2843 Y->group_ring_element_create(Y->A, Y->S, elt6);
2844 Y->group_ring_element_create(Y->A, Y->S, elt7);
2845
2846
2847
2848 int *part;
2849 int *parts;
2850
2851 int *Base;
2852 int *Base_inv;
2853 int *Fst;
2854 int *Len;
2855 int cnt, s, i, j;
2856
2857 part = NEW_int(n);
2858 parts = NEW_int(n);
2859 Fst = NEW_int(Y->goi);
2860 Len = NEW_int(Y->goi);
2861 Base = NEW_int(Y->goi * Y->goi * Y->D->size_of_instance_in_int);
2862 Base_inv = NEW_int(Y->goi * Y->goi * Y->D->size_of_instance_in_int);
2863 s = 0;
2864 Fst[0] = 0;
2865
2866 // create the first partition in exponential notation:
2867 //partition_first(part, n);
2868 cnt = 0;
2869
2870 int Part[10][5] = {
2871 {4, -1, 0, 0, 0},
2872 {3, 1, -1, 0, 0},
2873 {3, 1, -1, 0, 0},
2874 {3, 1, -1, 0, 0},
2875 {2, 2, -1, 0, 0},
2876 {2, 2, -1, 0, 0},
2877 {2, 1, 1, -1, 0},
2878 {2, 1, 1, -1, 0},
2879 {2, 1, 1, -1, 0},
2880 {1, 1, 1, 1, -1},
2881 };
2882 int Tableau[10][4] = {
2883 {0,1,2,3},
2884 {0,1,2,3}, {0,1,3,2}, {0,2,3,1},
2885 {0,1,2,3}, {0,2,1,3},
2886 {0,1,2,3}, {0,2,1,3}, {0,3,1,2},
2887 {0,1,2,3}
2888 };
2889
2890 for(cnt = 0; cnt < 10; cnt++) {
2891 int nb_parts;
2892
2893 // turn the partition from exponential notation into the list of parts:
2894 // the large parts come first.
2895 nb_parts = 0;
2896 for (i = 0; i < 4; i++) {
2897 parts[nb_parts] = Part[cnt][i];
2898 if (parts[nb_parts] == -1) {
2899 break;
2900 }
2901 nb_parts++;
2902 }
2903
2904 if (f_v) {
2905 cout << "partition ";
2906 Int_vec_print(cout, parts, nb_parts);
2907 cout << endl;
2908 }
2909
2910
2911 // Create the young symmetrizer based on the partition.
2912 // We do the very first tableau for this partition.
2913
2914 Y->young_symmetrizer(parts, nb_parts, Tableau[cnt], elt1, elt2, h_alpha, verbose_level);
2915
2916
2917 if (f_v) {
2918 cout << "h_alpha =" << endl;
2919 Y->group_ring_element_print(Y->A, Y->S, h_alpha);
2920 cout << endl;
2921 }
2922
2923
2924 Y->group_ring_element_copy(Y->A, Y->S, h_alpha, elt4);
2925 Y->group_ring_element_mult(Y->A, Y->S, elt4, elt4, elt5);
2926
2927 if (f_v) {
2928 cout << "h_alpha * h_alpha=" << endl;
2929 Y->group_ring_element_print(Y->A, Y->S, elt5);
2930 cout << endl;
2931 }
2932
2933 int *Module_Base;
2934 int *base_cols;
2935 int rk;
2936
2937
2938 Y->create_module(h_alpha,
2939 Module_Base, base_cols, rk,
2940 verbose_level);
2941
2942 if (f_v) {
2943 cout << "Module_Basis=" << endl;
2944 Y->D->print_matrix(Module_Base, rk, Y->goi);
2945 }
2946
2947
2948 for (i = 0; i < rk; i++) {
2949 for (j = 0; j < Y->goi; j++) {
2950 Y->D->copy(Y->D->offset(Module_Base, i * Y->goi + j), Y->D->offset(Base, s * Y->goi + j), 0);
2951 }
2952 s++;
2953 }
2954 Len[cnt] = s - Fst[cnt];
2955 Fst[cnt + 1] = s;
2956
2957 Y->create_representations(Module_Base, base_cols, rk, verbose_level);
2958
2959
2960 FREE_int(Module_Base);
2961 FREE_int(base_cols);
2962
2963
2964 }
2965
2966 if (f_v) {
2967 cout << "Basis of submodule=" << endl;
2968 //Y->D->print_matrix(Base, s, Y->goi);
2969 Y->D->print_matrix_for_maple(Base, s, Y->goi);
2970 }
2971
2972 FREE_int(part);
2973 FREE_int(parts);
2974 FREE_int(Fst);
2975 FREE_int(Len);
2976 if (f_v) {
2977 cout << "before freeing Base" << endl;
2978 }
2979 FREE_int(Base);
2980 FREE_int(Base_inv);
2981 if (f_v) {
2982 cout << "before freeing Y" << endl;
2983 }
2984 FREE_OBJECT(Y);
2985 if (f_v) {
2986 cout << "before freeing elt1" << endl;
2987 }
2988 FREE_int(elt1);
2989 FREE_int(elt2);
2990 FREE_int(h_alpha);
2991 FREE_int(elt4);
2992 FREE_int(elt5);
2993 FREE_int(elt6);
2994 FREE_int(elt7);
2995 if (f_v) {
2996 cout << "algebra_global_with_action::young_symmetrizer_sym_4 done" << endl;
2997 }
2998}
2999
3000
3001
3003 ostream &ost, geometry::projective_space *P,
3004 actions::action *A_on_points, actions::action *A_on_lines,
3005 groups::strong_generators *gens, int size_limit_for_printing,
3006 int verbose_level)
3007{
3008 int f_v = (verbose_level >= 1);
3009
3010 if (f_v) {
3011 cout << "algebra_global_with_action::report_tactical_decomposition_by_automorphism_group" << endl;
3012 }
3013 int *Mtx;
3014 int i, j, h;
3017
3018 Mtx = NEW_int(P->N_points * P->N_lines);
3019 Int_vec_zero(Mtx, P->N_points * P->N_lines);
3020
3021 for (j = 0; j < P->N_lines; j++) {
3022 for (h = 0; h < P->k; h++) {
3023 i = P->Implementation->Lines[j * P->k + h];
3024 Mtx[i * P->N_lines + j] = 1;
3025 }
3026 }
3027
3028 Inc->init_by_matrix(P->N_points, P->N_lines, Mtx, 0 /* verbose_level*/);
3029
3030
3032
3033 int N;
3034
3035 if (f_v) {
3036 cout << "algebra_global_with_action::report_tactical_decomposition_by_automorphism_group "
3037 "allocating partitionstack" << endl;
3038 }
3039 N = Inc->nb_points() + Inc->nb_lines();
3040
3041 S.allocate(N, 0);
3042 // split off the column class:
3043 S.subset_continguous(Inc->nb_points(), Inc->nb_lines());
3044 S.split_cell(0);
3045
3046 #if 0
3047 // ToDo:
3048 S.split_cell_front_or_back(data, target_size,
3049 TRUE /* f_front */, 0 /* verbose_level*/);
3050 #endif
3051
3052
3053 int TDO_depth = N;
3054 //int TDO_ht;
3055
3056
3057 if (f_v) {
3058 cout << "algebra_global_with_action::report_tactical_decomposition_by_automorphism_group "
3059 "before Inc->compute_TDO_safe" << endl;
3060 }
3061 Inc->compute_TDO_safe(S, TDO_depth, verbose_level - 3);
3062 //TDO_ht = S.ht;
3063
3064
3065 if (S.ht < size_limit_for_printing) {
3066 ost << "The TDO decomposition is" << endl;
3068 ost, TRUE /* f_enter_math */,
3069 TRUE /* f_print_subscripts */, S);
3070 }
3071 else {
3072 ost << "The TDO decomposition is very large (with "
3073 << S.ht<< " classes).\\\\" << endl;
3074 }
3075
3076
3077 {
3078 groups::schreier *Sch_points;
3079 groups::schreier *Sch_lines;
3080 Sch_points = NEW_OBJECT(groups::schreier);
3081 Sch_points->init(A_on_points, verbose_level - 2);
3082 Sch_points->initialize_tables();
3083 Sch_points->init_generators(*gens->gens /* *generators */, verbose_level - 2);
3084 Sch_points->compute_all_point_orbits(0 /*verbose_level - 2*/);
3085
3086 if (f_v) {
3087 cout << "found " << Sch_points->nb_orbits
3088 << " orbits on points" << endl;
3089 }
3090 Sch_lines = NEW_OBJECT(groups::schreier);
3091 Sch_lines->init(A_on_lines, verbose_level - 2);
3092 Sch_lines->initialize_tables();
3093 Sch_lines->init_generators(*gens->gens /* *generators */, verbose_level - 2);
3094 Sch_lines->compute_all_point_orbits(0 /*verbose_level - 2*/);
3095
3096 if (f_v) {
3097 cout << "found " << Sch_lines->nb_orbits
3098 << " orbits on lines" << endl;
3099 }
3100 S.split_by_orbit_partition(Sch_points->nb_orbits,
3101 Sch_points->orbit_first, Sch_points->orbit_len, Sch_points->orbit,
3102 0 /* offset */,
3103 verbose_level - 2);
3105 Sch_lines->orbit_first, Sch_lines->orbit_len, Sch_lines->orbit,
3106 Inc->nb_points() /* offset */,
3107 verbose_level - 2);
3108 FREE_OBJECT(Sch_points);
3109 FREE_OBJECT(Sch_lines);
3110 }
3111
3112 if (S.ht < size_limit_for_printing) {
3113 ost << "The TDA decomposition is" << endl;
3115 ost, TRUE /* f_enter_math */,
3116 TRUE /* f_print_subscripts */, S);
3117 }
3118 else {
3119 ost << "The TDA decomposition is very large (with "
3120 << S.ht<< " classes).\\\\" << endl;
3121 }
3122
3123 FREE_int(Mtx);
3124 FREE_OBJECT(gens);
3125 FREE_OBJECT(Inc);
3126
3127 if (f_v) {
3128 cout << "algebra_global_with_action::report_tactical_decomposition_by_automorphism_group done" << endl;
3129 }
3130}
3131
3135 int d, int target_depth, int verbose_level)
3136{
3137 int f_v = (verbose_level >= 1);
3138
3139 if (f_v) {
3140 cout << "algebra_global_with_action::linear_codes_with_bounded_minimum_distance" << endl;
3141 }
3142
3145
3146
3147 Control->f_depth = TRUE;
3148 Control->depth = target_depth;
3149
3150
3151 if (f_v) {
3152 cout << "algebra_global_with_action::linear_codes_with_bounded_minimum_distance group set up, "
3153 "calling gen->init" << endl;
3154 cout << "LG->A2->A->f_has_strong_generators="
3155 << LG->A2->f_has_strong_generators << endl;
3156 }
3157
3159
3160 Poset->init_subset_lattice(LG->A_linear, LG->A_linear,
3161 LG->Strong_gens,
3162 verbose_level);
3163
3164
3165 int independence_value = d - 1;
3166
3168 independence_value,
3169 verbose_level);
3170
3171#if 0
3172 Poset->f_print_function = FALSE;
3173 Poset->print_function = print_code;
3174 Poset->print_function_data = this;
3175#endif
3176
3178 PC->initialize_and_allocate_root_node(Control, Poset,
3179 target_depth, verbose_level);
3180
3181 if (f_v) {
3182 cout << "algebra_global_with_action::linear_codes_with_bounded_minimum_distance before gen->main" << endl;
3183 }
3184
3185 int t0;
3187 int depth;
3188
3189 t0 = Os.os_ticks();
3190 depth = PC->main(t0,
3191 target_depth /*schreier_depth*/,
3192 TRUE /*f_use_invariant_subset_if_available*/,
3193 FALSE /*f_debug */,
3194 verbose_level);
3195 if (f_v) {
3196 cout << "algebra_global_with_action::linear_codes_with_bounded_minimum_distance depth = " << depth << endl;
3197 }
3198
3199 if (f_v) {
3200 cout << "algebra_global_with_action::linear_codes_with_bounded_minimum_distance done" << endl;
3201 }
3202}
3203
3206 std::string &element_description,
3207 std::string &label, int verbose_level)
3208{
3209 int f_v = (verbose_level >= 1);
3210 int *Elt;
3211 string prefix;
3212
3213 if (f_v) {
3214 cout << "algebra_global_with_action::centralizer_of_element label=" << label
3215 << " element_description=" << element_description << endl;
3216 }
3217
3218 prefix.assign(A->label);
3219 prefix.append("_elt_");
3220 prefix.append(label);
3221
3222 Elt = NEW_int(A->elt_size_in_int);
3223
3224 int *data;
3225 int data_len;
3226
3227
3228 Int_vec_scan(element_description, data, data_len);
3229
3230
3231 if (data_len != A->make_element_size) {
3232 cout << "data_len != A->make_element_size" << endl;
3233 exit(1);
3234 }
3235#if 0
3236 if (f_v) {
3237 cout << "algebra_global_with_action::centralizer_of_element Matrix:" << endl;
3238 int_matrix_print(data, 4, 4);
3239 }
3240#endif
3241
3242 A->make_element(Elt, data, 0 /* verbose_level */);
3243
3244 int o;
3245
3246 o = A->element_order(Elt);
3247 if (f_v) {
3248 cout << "algebra_global_with_action::centralizer_of_element Elt:" << endl;
3249 A->element_print_quick(Elt, cout);
3250 cout << "algebra_global_with_action::centralizer_of_element on points:" << endl;
3251 A->element_print_as_permutation(Elt, cout);
3252 //cout << "algebra_global_with_action::centralizer_of_element on lines:" << endl;
3253 //A2->element_print_as_permutation(Elt, cout);
3254 }
3255
3256 if (f_v) {
3257 cout << "algebra_global_with_action::centralizer_of_element "
3258 "the element has order " << o << endl;
3259 }
3260
3261
3262
3263 if (f_v) {
3264 cout << "algebra_global_with_action::centralizer_of_element "
3265 "before centralizer_using_MAGMA" << endl;
3266 }
3267
3269
3270 A->centralizer_using_MAGMA(prefix,
3271 S, Elt, gens, verbose_level);
3272
3273
3274 if (f_v) {
3275 cout << "algebra_global_with_action::centralizer_of_element "
3276 "after centralizer_using_MAGMA" << endl;
3277 }
3278
3279
3280 if (f_v) {
3281 cout << "generators for the centralizer are:" << endl;
3282 gens->print_generators_tex();
3283 }
3284
3285
3286 string fname;
3287
3288 fname.assign(prefix);
3289 fname.append("_centralizer.tex");
3290
3291
3292 {
3293 char title[1000];
3294 char author[1000];
3295
3296 snprintf(title, 1000, "Centralizer of element %s", label.c_str());
3297 //strcpy(author, "");
3298 author[0] = 0;
3299
3300
3301 {
3302 ofstream ost(fname);
3304
3305 L.head(ost,
3306 FALSE /* f_book*/,
3307 TRUE /* f_title */,
3308 title, author,
3309 FALSE /* f_toc */,
3310 FALSE /* f_landscape */,
3311 TRUE /* f_12pt */,
3312 TRUE /* f_enlarged_page */,
3313 TRUE /* f_pagenumbers */,
3314 NULL /* extra_praeamble */);
3315
3316
3317 if (f_v) {
3318 cout << "algebra_global_with_action::centralizer_of_element "
3319 "before report" << endl;
3320 }
3321 gens->print_generators_tex(ost);
3322
3323 if (f_v) {
3324 cout << "algebra_global_with_action::centralizer_of_element "
3325 "after report" << endl;
3326 }
3327
3328
3329 L.foot(ost);
3330
3331 }
3333
3334 if (f_v) {
3335 cout << "written file " << fname << " of size "
3336 << Fio.file_size(fname) << endl;
3337 }
3338 }
3339
3340
3341 FREE_int(data);
3342
3343 if (f_v) {
3344 cout << "algebra_global_with_action::centralizer_of_element done" << endl;
3345 }
3346}
3347
3350 std::string &element_description,
3351 std::string &label, int verbose_level)
3352{
3353 int f_v = (verbose_level >= 1);
3354 int *Elt;
3355 string prefix;
3356
3357 if (f_v) {
3358 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup label=" << label
3359 << " element_description=" << element_description << endl;
3360 }
3361
3362 prefix.assign("normalizer_of_");
3363 prefix.append(label);
3364 prefix.append("_in_");
3365 prefix.append(A->label);
3366
3367 Elt = NEW_int(A->elt_size_in_int);
3368
3369 int *data;
3370 int data_len;
3371
3372
3373 Int_vec_scan(element_description, data, data_len);
3374
3375
3376 if (data_len != A->make_element_size) {
3377 cout << "data_len != A->make_element_size" << endl;
3378 exit(1);
3379 }
3380#if 0
3381 if (f_v) {
3382 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup Matrix:" << endl;
3383 int_matrix_print(data, 4, 4);
3384 }
3385#endif
3386
3387 A->make_element(Elt, data, 0 /* verbose_level */);
3388
3389 int o;
3390
3391 o = A->element_order(Elt);
3392 if (f_v) {
3393 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup label=" << label
3394 << " element order=" << o << endl;
3395 }
3396
3397 if (f_v) {
3398 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup Elt:" << endl;
3399 A->element_print_quick(Elt, cout);
3400 cout << endl;
3401 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup on points:" << endl;
3402 A->element_print_as_permutation(Elt, cout);
3403 //cout << "algebra_global_with_action::centralizer_of_element on lines:" << endl;
3404 //A2->element_print_as_permutation(Elt, cout);
3405 }
3406
3407 if (f_v) {
3408 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup "
3409 "the element has order " << o << endl;
3410 }
3411
3412
3413
3414 if (f_v) {
3415 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup "
3416 "before normalizer_of_cyclic_group_using_MAGMA" << endl;
3417 }
3418
3420
3422 S, Elt, gens, verbose_level);
3423
3424
3425
3426 if (f_v) {
3427 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup "
3428 "after normalizer_of_cyclic_group_using_MAGMA" << endl;
3429 }
3430
3431
3432
3433 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup "
3434 "generators for the normalizer are:" << endl;
3435 gens->print_generators_tex();
3436
3437
3438 string fname;
3439
3440 fname.assign(prefix);
3441 fname.append(".tex");
3442
3443
3444 {
3445 char title[1000];
3446 char author[1000];
3447
3448 snprintf(title, 1000, "Normalizer of cyclic subgroup %s", label.c_str());
3449 //strcpy(author, "");
3450 author[0] = 0;
3451
3452
3453 {
3454 ofstream ost(fname);
3456
3457 L.head(ost,
3458 FALSE /* f_book*/,
3459 TRUE /* f_title */,
3460 title, author,
3461 FALSE /* f_toc */,
3462 FALSE /* f_landscape */,
3463 TRUE /* f_12pt */,
3464 TRUE /* f_enlarged_page */,
3465 TRUE /* f_pagenumbers */,
3466 NULL /* extra_praeamble */);
3467
3469 gens->group_order(go);
3470 ost << "The subgroup generated by " << endl;
3471 ost << "$$" << endl;
3472 A->element_print_latex(Elt, ost);
3473 ost << "$$" << endl;
3474 ost << "has order " << o << "\\\\" << endl;
3475 ost << "The normalizer has order " << go << "\\\\" << endl;
3476 if (f_v) {
3477 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup before report" << endl;
3478 }
3479 gens->print_generators_tex(ost);
3480
3481 if (f_v) {
3482 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup after report" << endl;
3483 }
3484
3485
3486 L.foot(ost);
3487
3488 }
3490
3491 if (f_v) {
3492 cout << "written file " << fname << " of size "
3493 << Fio.file_size(fname) << endl;
3494 }
3495 }
3496
3497
3498
3499
3500
3501 FREE_int(data);
3502 FREE_int(Elt);
3503 FREE_OBJECT(gens);
3504
3505 if (f_v) {
3506 cout << "algebra_global_with_action::normalizer_of_cyclic_subgroup done" << endl;
3507 }
3508}
3509
3512 int subgroup_order,
3513 std::string &label,
3514 int &nb_subgroups,
3517 int verbose_level)
3518{
3519 int f_v = (verbose_level >= 1);
3520 string prefix;
3521 char str[1000];
3522
3523 if (f_v) {
3524 cout << "algebra_global_with_action::find_subgroups label=" << label
3525 << " subgroup_order=" << subgroup_order << endl;
3526 }
3527 prefix.assign(label);
3528 sprintf(str, "_find_subgroup_of_order_%d", subgroup_order);
3529 prefix.append(str);
3530
3531
3532
3533 if (f_v) {
3534 cout << "algebra_global_with_action::find_subgroups "
3535 "before find_subgroup_using_MAGMA" << endl;
3536 }
3537
3538
3540 S, subgroup_order,
3541 nb_subgroups, H_gens, N_gens, verbose_level);
3542
3543
3544 if (f_v) {
3545 cout << "algebra_global_with_action::find_subgroups "
3546 "after find_subgroup_using_MAGMA" << endl;
3547 }
3548
3549
3550 //cout << "generators for the subgroup are:" << endl;
3551 //gens->print_generators_tex();
3552
3553
3554 if (f_v) {
3555 cout << "algebra_global_with_action::find_subgroups done" << endl;
3556 }
3557}
3558
3559
3563 int *&relative_order_table, int verbose_level)
3564{
3565 int f_v = (verbose_level >= 1);
3566 int *Elt1;
3567 int *Elt2;
3568 //int *Elt3;
3569 groups::sims *S;
3570 int i, drop_out_level, image, order;
3571
3572 if (f_v) {
3573 cout << "algebra_global_with_action::relative_order_vector_of_cosets" << endl;
3574 }
3575
3576 Elt1 = NEW_int(A->elt_size_in_int);
3577 Elt2 = NEW_int(A->elt_size_in_int);
3578 //Elt3 = NEW_int(A->elt_size_in_int);
3579
3580 relative_order_table = NEW_int(cosets->len);
3581
3582 S = SG->create_sims(0 /*verbose_level */);
3583 for (i = 0; i < cosets->len; i++) {
3584 A->element_move(cosets->ith(i), Elt1, 0);
3585 order = 1;
3586 while (TRUE) {
3587 if (S->strip(Elt1, Elt2, drop_out_level, image, 0 /*verbose_level*/)) {
3588 break;
3589 }
3590 A->element_mult(cosets->ith(i), Elt1, Elt2, 0);
3591 A->element_move(Elt2, Elt1, 0);
3592 order++;
3593 }
3594 relative_order_table[i] = order;
3595 }
3596
3597
3598 FREE_int(Elt1);
3599 FREE_int(Elt2);
3600
3601 if (f_v) {
3602 cout << "algebra_global_with_action::relative_order_vector_of_cosets done" << endl;
3603 }
3604}
3605
3608 int degree_of_poly,
3609 int f_recognize, std::string &recognize_text,
3610 int f_draw_tree, int draw_tree_idx,
3612 int verbose_level)
3613{
3614 int f_v = (verbose_level >= 1);
3615
3616
3617 if (f_v) {
3618 cout << "algebra_global_with_action::do_orbits_on_polynomials" << endl;
3619 }
3620
3622
3624
3625 O->init(LG,
3626 degree_of_poly,
3627 f_recognize, recognize_text,
3628 verbose_level);
3629
3630 if (f_draw_tree) {
3631
3632 string fname;
3633 char str[1000];
3634
3635
3636 sprintf(str, "_orbit_%d_tree", draw_tree_idx);
3637
3638 fname.assign(O->fname_base);
3639 fname.append(str);
3640
3641 O->Sch->draw_tree(fname,
3642 Opt,
3643 draw_tree_idx,
3644 FALSE /* f_has_point_labels */, NULL /* long int *point_labels*/,
3645 verbose_level);
3646 }
3647
3648 O->report(verbose_level);
3649
3650 FREE_OBJECT(O);
3651
3652
3653 if (f_v) {
3654 cout << "algebra_global_with_action::do_orbits_on_polynomials done" << endl;
3655 }
3656}
3657
3660 int degree_of_poly,
3661 int verbose_level)
3662{
3663 int f_v = (verbose_level >= 1);
3664 //int f_stabilizer = TRUE;
3665 //int f_draw_tree = TRUE;
3666
3667
3668 if (f_v) {
3669 cout << "algebra_global_with_action::representation_on_polynomials" << endl;
3670 }
3671
3672
3674 actions::action *A;
3675 //matrix_group *M;
3676 int n;
3677 //int degree;
3679
3680 A = LG->A_linear;
3682 A->group_order(go);
3683
3684 n = A->matrix_group_dimension();
3685
3686 if (f_v) {
3687 cout << "n = " << n << endl;
3688 }
3689
3690 if (f_v) {
3691 cout << "strong generators:" << endl;
3692 //A->Strong_gens->print_generators();
3694 }
3695
3697
3699
3700
3701 monomial_ordering_type Monomial_ordering_type = t_PART;
3702
3703
3704 HPD->init(F, n /* nb_var */, degree_of_poly,
3705 TRUE /* f_init_incidence_structure */,
3706 Monomial_ordering_type,
3707 verbose_level);
3708
3709 actions::action *A2;
3710
3713 HPD,
3714 FALSE /* f_induce_action */, NULL,
3715 verbose_level);
3716
3717 if (f_v) {
3718 cout << "created action A2" << endl;
3719 A2->print_info();
3720 }
3721
3722
3724 int *M;
3725 int nb_gens;
3726 int i;
3727
3728 A_on_HPD = A2->G.OnHP;
3729
3730 if (LG->f_has_nice_gens) {
3731 if (f_v) {
3732 cout << "algebra_global_with_action::representation_on_polynomials using nice generators" << endl;
3733 }
3734 LG->nice_gens->matrix_representation(A_on_HPD, M, nb_gens, verbose_level);
3735 }
3736 else {
3737 if (f_v) {
3738 cout << "algebra_global_with_action::representation_on_polynomials using strong generators" << endl;
3739 }
3740 LG->Strong_gens->gens->matrix_representation(A_on_HPD, M, nb_gens, verbose_level);
3741 }
3742
3743 for (i = 0; i < nb_gens; i++) {
3744 cout << "matrix " << i << " / " << nb_gens << ":" << endl;
3745 Int_matrix_print(M + i * A_on_HPD->dimension * A_on_HPD->dimension,
3746 A_on_HPD->dimension, A_on_HPD->dimension);
3747 }
3748
3749 for (i = 0; i < nb_gens; i++) {
3750 string fname;
3751 char str[1000];
3753
3754 fname.assign(LG->label);
3755 sprintf(str, "_rep_%d_%d.csv", degree_of_poly, i);
3756 fname.append(str);
3757 Fio.int_matrix_write_csv(fname, M + i * A_on_HPD->dimension * A_on_HPD->dimension,
3758 A_on_HPD->dimension, A_on_HPD->dimension);
3759 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
3760 }
3761 if (f_v) {
3762 cout << "algebra_global_with_action::representation_on_polynomials done" << endl;
3763 }
3764}
3765
3766
3767
3769 field_theory::finite_field *F, int n, std::string &coeffs_text, int verbose_level)
3770{
3771 int f_v = (verbose_level >= 1);
3772
3773 if (f_v) {
3774 cout << "algebra_global_with_action::do_eigenstuff_with_coefficients" << endl;
3775 }
3776 int *Data;
3777 int len;
3778
3779 Int_vec_scan(coeffs_text, Data, len);
3780 if (len != n * n) {
3781 cout << "len != n * n " << len << endl;
3782 exit(1);
3783 }
3784
3786
3787 A.do_eigenstuff(F, n, Data, verbose_level);
3788
3789 FREE_int(Data);
3790 if (f_v) {
3791 cout << "algebra_global_with_action::do_eigenstuff_with_coefficients done" << endl;
3792 }
3793}
3794
3796 field_theory::finite_field *F, int n, std::string &fname, int verbose_level)
3797{
3798 int f_v = (verbose_level >= 1);
3799
3800 if (f_v) {
3801 cout << "algebra_global_with_action::do_eigenstuff_from_file" << endl;
3802 }
3803
3805 int *Data;
3806 int mtx_m, mtx_n;
3807
3808 Fio.int_matrix_read_csv(fname, Data, mtx_m, mtx_n, verbose_level - 1);
3809 if (mtx_m != n) {
3810 cout << "mtx_m != n" << endl;
3811 exit(1);
3812 }
3813 if (mtx_n != n) {
3814 cout << "mtx_n != n" << endl;
3815 exit(1);
3816 }
3817
3819
3820 A.do_eigenstuff(F, n, Data, verbose_level);
3821
3822
3823 if (f_v) {
3824 cout << "algebra_global_with_action::do_eigenstuff_from_file done" << endl;
3825 }
3826}
3827
3828
3829
3830
3831
3832
3833
3835 actions::action *A2,
3836 groups::strong_generators *Strong_gens,
3837 int f_load_save,
3838 std::string &prefix,
3840 int verbose_level)
3841{
3842 int f_v = (verbose_level >= 1);
3843
3844 if (f_v) {
3845 cout << "algebra_global_with_action::orbits_on_points" << endl;
3846 }
3847 //cout << "computing orbits on points:" << endl;
3848
3849
3850 //orbits_on_something *Orb;
3851
3853
3854 if (f_v) {
3855 cout << "algebra_global_with_action::orbits_on_points before Orb->init" << endl;
3856 }
3857 Orb->init(
3858 A2,
3859 Strong_gens,
3860 f_load_save,
3861 prefix,
3862 verbose_level);
3863 if (f_v) {
3864 cout << "algebra_global_with_action::orbits_on_points after Orb->init" << endl;
3865 }
3866
3867
3868
3869
3870 if (f_v) {
3871 cout << "algebra_global_with_action::orbits_on_points done" << endl;
3872 }
3873}
3874
3877 int verbose_level)
3878{
3879 int f_v = (verbose_level >= 1);
3880
3881 if (f_v) {
3882 cout << "algebra_global_with_action::find_singer_cycle" << endl;
3883 }
3884 groups::sims *H;
3886
3887 SG = Any_group->get_strong_generators();
3888
3889 //G = LG->initial_strong_gens->create_sims(verbose_level);
3890 H = SG->create_sims(verbose_level);
3891
3892 if (f_v) {
3893 //cout << "group order G = " << G->group_order_int() << endl;
3894 cout << "group order H = " << H->group_order_lint() << endl;
3895 }
3896
3897 int *Elt;
3899 int i, d, q, cnt, ord, order;
3901
3902 if (!A1->is_matrix_group()) {
3903 cout << "group_theoretic_activity::find_singer_cycle needs matrix group" << endl;
3904 exit(1);
3905 }
3907
3908 M = A1->get_matrix_group();
3909 q = M->GFq->q;
3910 d = A1->matrix_group_dimension();
3911
3912 if (A1->is_projective()) {
3913 order = (NT.i_power_j(q, d) - 1) / (q - 1);
3914 }
3915 else {
3916 order = NT.i_power_j(q, d) - 1;
3917 }
3918 if (f_v) {
3919 cout << "algebra_global_with_action::find_singer_cycle looking for an "
3920 "element of order " << order << endl;
3921 }
3922
3923 Elt = NEW_int(A1->elt_size_in_int);
3924 H->group_order(go);
3925
3926 cnt = 0;
3927 for (i = 0; i < go.as_int(); i++) {
3928 H->element_unrank_lint(i, Elt);
3929
3930
3931 ord = A2->element_order(Elt);
3932
3933 #if 0
3934 cout << "Element " << setw(5) << i << " / "
3935 << go.as_int() << ":" << endl;
3936 A->element_print(Elt, cout);
3937 cout << endl;
3938 A->element_print_as_permutation(Elt, cout);
3939 cout << endl;
3940 #endif
3941
3942 if (ord != order) {
3943 continue;
3944 }
3945 if (!M->has_shape_of_singer_cycle(Elt)) {
3946 continue;
3947 }
3948 if (f_v) {
3949 cout << "Element " << setw(5) << i << " / "
3950 << go.as_int() << " = " << cnt << ":" << endl;
3951 A2->element_print(Elt, cout);
3952 cout << endl;
3953 A2->element_print_as_permutation(Elt, cout);
3954 cout << endl;
3955 }
3956 cnt++;
3957 }
3958 if (f_v) {
3959 cout << "we found " << cnt << " group elements of order " << order << endl;
3960 }
3961
3962 FREE_int(Elt);
3963 if (f_v) {
3964 cout << "algebra_global_with_action::find_singer_cycle done" << endl;
3965 }
3966}
3967
3970 int order, int verbose_level)
3971{
3972 int f_v = (verbose_level >= 1);
3973
3974 if (f_v) {
3975 cout << "algebra_global_with_action::search_element_of_order" << endl;
3976 }
3977 groups::sims *H;
3979
3980 SG = Any_group->get_strong_generators();
3981
3982 //G = LG->initial_strong_gens->create_sims(verbose_level);
3983 H = SG->create_sims(verbose_level);
3984
3985 //cout << "group order G = " << G->group_order_int() << endl;
3986 cout << "group order H = " << H->group_order_lint() << endl;
3987
3988 int *Elt;
3990 int i, cnt, ord;
3991
3992 Elt = NEW_int(A1->elt_size_in_int);
3993 H->group_order(go);
3994
3995 cnt = 0;
3996 for (i = 0; i < go.as_int(); i++) {
3997 H->element_unrank_lint(i, Elt);
3998
3999
4000 ord = A2->element_order(Elt);
4001
4002 #if 0
4003 cout << "Element " << setw(5) << i << " / "
4004 << go.as_int() << ":" << endl;
4005 A->element_print(Elt, cout);
4006 cout << endl;
4007 A->element_print_as_permutation(Elt, cout);
4008 cout << endl;
4009 #endif
4010
4011 if (ord != order) {
4012 continue;
4013 }
4014 if (f_v) {
4015 cout << "Element " << setw(5) << i << " / "
4016 << go.as_int() << " = " << cnt << ":" << endl;
4017 A2->element_print(Elt, cout);
4018 cout << endl;
4019 A2->element_print_as_permutation(Elt, cout);
4020 cout << endl;
4021 }
4022 cnt++;
4023 }
4024 if (f_v) {
4025 cout << "we found " << cnt << " group elements of order " << order << endl;
4026 }
4027
4028 FREE_int(Elt);
4029 if (f_v) {
4030 cout << "algebra_global_with_action::search_element_of_order done" << endl;
4031 }
4032}
4033
4036 int order_a, int order_b, int order_ab, int verbose_level)
4037{
4038 int f_v = (verbose_level >= 1);
4039
4040 if (f_v) {
4041 cout << "algebra_global_with_action::find_standard_generators" << endl;
4042 }
4043 groups::sims *H;
4045
4046 SG = Any_group->get_strong_generators();
4047
4048 H = SG->create_sims(verbose_level);
4049
4050 cout << "group order H = " << H->group_order_lint() << endl;
4051
4052 int *Elt_a;
4053 int *Elt_b;
4054 int *Elt_ab;
4056 int i, j, cnt, ord;
4057
4058 Elt_a = NEW_int(A1->elt_size_in_int);
4059 Elt_b = NEW_int(A1->elt_size_in_int);
4060 Elt_ab = NEW_int(A1->elt_size_in_int);
4061 H->group_order(go);
4062
4063 cnt = 0;
4064 for (i = 0; i < go.as_int(); i++) {
4065 H->element_unrank_lint(i, Elt_a);
4066
4067
4068 ord = A2->element_order(Elt_a);
4069
4070 #if 0
4071 cout << "Element " << setw(5) << i << " / "
4072 << go.as_int() << ":" << endl;
4073 A->element_print(Elt, cout);
4074 cout << endl;
4075 A->element_print_as_permutation(Elt, cout);
4076 cout << endl;
4077 #endif
4078
4079 if (ord != order_a) {
4080 continue;
4081 }
4082
4083 for (j = 0; j < go.as_int(); j++) {
4084 H->element_unrank_lint(j, Elt_b);
4085
4086
4087 ord = A2->element_order(Elt_b);
4088
4089 if (ord != order_b) {
4090 continue;
4091 }
4092
4093 A2->element_mult(Elt_a, Elt_b, Elt_ab, 0);
4094
4095 ord = A2->element_order(Elt_ab);
4096
4097 if (ord != order_ab) {
4098 continue;
4099 }
4100
4101 if (f_v) {
4102 cout << "a = " << setw(5) << i << ", b=" << setw(5) << j << " : " << cnt << ":" << endl;
4103 cout << "a=" << endl;
4104 A2->element_print(Elt_a, cout);
4105 cout << endl;
4106 A2->element_print_as_permutation(Elt_a, cout);
4107 cout << endl;
4108 cout << "b=" << endl;
4109 A2->element_print(Elt_b, cout);
4110 cout << endl;
4111 A2->element_print_as_permutation(Elt_b, cout);
4112 cout << endl;
4113 cout << "ab=" << endl;
4114 A2->element_print(Elt_ab, cout);
4115 cout << endl;
4116 A2->element_print_as_permutation(Elt_ab, cout);
4117 cout << endl;
4118 }
4119 cnt++;
4120 }
4121 }
4122 if (f_v) {
4123 cout << "we found " << cnt << " group elements with "
4124 "ord_a = " << order_a << " ord_b = " << order_b << " and ord_ab = " << order_ab << endl;
4125 }
4126
4127 FREE_int(Elt_a);
4128 FREE_int(Elt_b);
4129 FREE_int(Elt_ab);
4130 if (f_v) {
4131 cout << "algebra_global_with_action::find_standard_generators done" << endl;
4132 }
4133}
4134
4135
4136
4137
4138
4139}}}
4140
void copy(int *elt_from, int *elt_to, int verbose_level)
Definition: a_domain.cpp:275
void print_matrix_for_maple(int *A, int m, int n)
Definition: a_domain.cpp:789
void print_matrix(int *A, int m, int n)
Definition: a_domain.cpp:774
conjugacy class in GL(n,q) described using rational normal form
Definition: algebra.h:260
to list all conjugacy classes in GL(n,q)
Definition: algebra.h:455
void print_matrix_and_centralizer_order_latex(std::ostream &ost, gl_class_rep *R)
void init(int k, field_theory::finite_field *F, int verbose_level)
Definition: gl_classes.cpp:67
void make_classes(gl_class_rep *&R, int &nb_classes, int f_no_eigenvalue_one, int verbose_level)
Definition: gl_classes.cpp:471
void report(std::ostream &ost, int verbose_level)
void make_matrix_from_class_rep(int *Mtx, gl_class_rep *R, int verbose_level)
Definition: gl_classes.cpp:205
int find_class_rep(gl_class_rep *Reps, int nb_reps, gl_class_rep *R, int verbose_level)
void identify_matrix(int *Mtx, gl_class_rep *R, int *Basis, int verbose_level)
Definition: gl_classes.cpp:704
void perm_print_offset(std::ostream &ost, int *a, int n, int offset, int f_print_cycles_of_length_one, int f_cycle_length, int f_max_cycle_length, int max_cycle_length, int f_orbit_structure, void(*point_label)(std::stringstream &sstr, long int pt, void *data), void *point_label_data)
data structure for set partitions following Jeffrey Leon
void split_cell_front_or_back(int *set, int set_size, int f_front, int verbose_level)
void split_by_orbit_partition(int nb_orbits, int *orbit_first, int *orbit_len, int *orbit, int offset, int verbose_level)
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
Definition: sorting.cpp:1094
void lint_vec_heapsort_with_log(long int *v, long int *w, int len)
Definition: sorting.cpp:1981
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
a statistical analysis of data consisting of single integers
void print_file_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:338
void init(int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:72
void print_file_tex_we_are_in_math_mode(std::ostream &ost, int f_backwards)
Definition: tally.cpp:358
void print_array_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:471
void PG_element_rank_modified(int *v, int stride, int len, int &a)
void finite_field_init(int q, int f_without_tables, int verbose_level)
void init_override_polynomial(int q, std::string &poly, int f_without_tables, int verbose_level)
interface for various incidence geometries
Definition: geometry.h:1099
void get_and_print_column_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, data_structures::partitionstack &PStack)
void init_by_matrix(int m, int n, int *M, int verbose_level)
void compute_TDO_safe(data_structures::partitionstack &PStack, int depth, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
projective_space_implementation * Implementation
Definition: geometry.h:1940
options for drawing an object of type layered_graph
Definition: graphics.h:457
void mult_vector_from_the_left(int *v, int *A, int *vA, int m, int n)
int Gauss_int(int *A, int f_special, int f_complete, int *base_cols, int f_P, int *P, int m, int n, int Pn, int verbose_level)
void random_invertible_matrix(int *M, int k, int verbose_level)
void transpose_matrix(int *A, int *At, int ma, int na)
void matrix_get_kernel(int *M, int m, int n, int *base_cols, int nb_base_cols, int &kernel_m, int &kernel_n, int *kernel, int verbose_level)
void int_matrix_write_csv(std::string &fname, int *M, int m, int n)
Definition: file_io.cpp:1300
void lint_matrix_write_csv(std::string &fname, long int *M, int m, int n)
Definition: file_io.cpp:1323
void int_matrix_read_csv(std::string &fname, int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1477
void print_integer_matrix_tex_block_by_block(std::ostream &ost, int *p, int m, int n, int block_width)
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)
homogeneous polynomials of a given degree in a given number of variables over a finite field GF(q)
Definition: ring_theory.h:88
void init(field_theory::finite_field *F, int nb_vars, int degree, int f_init_incidence_structure, monomial_ordering_type Monomial_ordering_type, int verbose_level)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
domain of polynomials in one variable over a finite field
Definition: ring_theory.h:691
int substitute_scalar_in_polynomial(unipoly_object &p, int scalar, int verbose_level)
void create_object_by_rank(unipoly_object &p, long int rk, const char *file, int line, int verbose_level)
void characteristic_polynomial(int *Mtx, int k, unipoly_object &char_poly, int verbose_level)
void print_object(unipoly_object p, std::ostream &ost)
void m_ii(int i, int a)
Definition: discreta.h:824
DISCRETA base class. All DISCRETA classes are derived from this class.
Definition: discreta.h:382
void mult(discreta_base &x, discreta_base &y)
Definition: base.cpp:367
discreta_base & power_int(int l)
Definition: base.cpp:447
discreta_matrix & m_mn(int m, int n)
void smith_normal_form(discreta_matrix &P, discreta_matrix &Pv, discreta_matrix &Q, discreta_matrix &Qv, int verbose_level)
discreta_matrix & m_mn_n(int m, int n)
void m_iji(int i, int j, int a)
Definition: discreta.h:1099
DISCRETA class for influencing arithmetic operations.
Definition: discreta.h:1360
DISCRETA integer class.
Definition: discreta.h:667
int compare_with(discreta_base &a)
Definition: integer.cpp:134
DISCRETA class for polynomials in one variable.
Definition: discreta.h:1236
void Singer(int p, int f, int verbose_level)
Definition: unipoly.cpp:564
void get_an_irreducible_polynomial(int f, int verbose_level)
Definition: unipoly.cpp:618
void evaluate_at(discreta_base &x, discreta_base &y)
Definition: unipoly.cpp:662
DISCRETA class related to class domain.
Definition: discreta.h:1413
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 centralizer_using_MAGMA(std::string &prefix, groups::sims *G, int *Elt, groups::strong_generators *&gens, int verbose_level)
action * restricted_action(long int *points, int nb_points, int verbose_level)
void element_print_quick(void *elt, std::ostream &ost)
Definition: action_cb.cpp:353
void init_general_linear_group(int n, field_theory::finite_field *F, int f_semilinear, int f_basis, int f_init_sims, data_structures_groups::vector_ge *&nice_gens, int verbose_level)
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 element_mult(void *a, void *b, void *ab, int verbose_level)
Definition: action_cb.cpp:315
void normalizer_of_cyclic_group_using_MAGMA(std::string &fname_magma_prefix, groups::sims *G, int *Elt, groups::strong_generators *&gens_N, int verbose_level)
void element_print_for_make_element(void *elt, std::ostream &ost)
Definition: action_cb.cpp:409
void find_subgroups_using_MAGMA(std::string &prefix, groups::sims *override_Sims, int subgroup_order, int &nb_subgroups, groups::strong_generators *&H_gens, groups::strong_generators *&N_gens, int verbose_level)
groups::strong_generators * Strong_gens
Definition: actions.h:130
void init_projective_group(int n, field_theory::finite_field *F, int f_semilinear, int f_basis, int f_init_sims, data_structures_groups::vector_ge *&nice_gens, int verbose_level)
void element_invert(void *a, void *av, int verbose_level)
Definition: action_cb.cpp:322
void element_one(void *elt, int verbose_level)
Definition: action_cb.cpp:224
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
void make_element(int *Elt, int *data, int verbose_level)
Definition: action.cpp:1875
void element_move(void *a, void *b, int verbose_level)
Definition: action_cb.cpp:335
void induced_action_on_homogeneous_polynomials(action *A_old, ring_theory::homogeneous_polynomial_domain *HPD, int f_induce_action, groups::sims *old_G, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
Definition: action.cpp:2223
void induced_action_by_conjugation(groups::sims *old_G, groups::sims *Base_group, int f_ownership, int f_basis, int verbose_level)
groups::matrix_group * get_matrix_group()
Definition: action.cpp:2986
groups::sims * create_sims_from_generators_with_target_group_order_lint(data_structures_groups::vector_ge *gens, long int target_go, int verbose_level)
void element_print_as_permutation(void *elt, std::ostream &ost)
Definition: action_cb.cpp:421
groups::sims * create_sims_for_centralizer_of_matrix(int *Mtx, int verbose_level)
long int element_image_of(long int a, void *elt, int verbose_level)
Definition: action_cb.cpp:198
void print(std::ostream &ost, void *elt)
Definition: action_cb.cpp:131
void matrix_representation(induced_actions::action_on_homogeneous_polynomials *A_on_HPD, int *&M, int &nb_gens, int verbose_level)
Definition: vector_ge.cpp:1004
void write_to_csv_file_coded(std::string &fname, int verbose_level)
Definition: vector_ge.cpp:723
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
data_structures_groups::vector_ge * nice_gens
Definition: groups.h:266
a matrix group over a finite field in projective, vector space or affine action
Definition: groups.h:318
compute orbits of a group in a given action; allows file io
Definition: groups.h:492
void init(actions::action *A, strong_generators *SG, int f_load_save, std::string &prefix, 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 draw_tree(std::string &fname, graphics::layered_graph_draw_options *Opt, int orbit_no, int f_has_point_labels, long int *point_labels, 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 transporter_from_point_to_orbit_rep(int pt, int &orbit_idx, int *Elt, int verbose_level)
Definition: schreier.cpp:760
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 extract_strong_generators_in_order(data_structures_groups::vector_ge &SG, int *tl, int verbose_level)
Definition: sims.cpp:1704
long int mult_by_rank(long int rk_a, long int rk_b, int verbose_level)
void regular_representation(int *Elt, int *perm, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
Definition: sims.cpp:951
void element_unrank_lint(long int rk, int *Elt, int verbose_level)
Definition: sims.cpp:1326
int strip(int *elt, int *residue, int &drop_out_level, int &image, int verbose_level)
Definition: sims_main.cpp:433
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
void init_centralizer_of_matrix_general_linear(actions::action *A_projective, actions::action *A_general_linear, int *Mtx, int verbose_level)
void init_centralizer_of_matrix(actions::action *A, int *Mtx, int verbose_level)
void init_group_extension(strong_generators *subgroup, int *data, int index, int verbose_level)
data_structures_groups::vector_ge * gens
Definition: groups.h:1708
void group_order(ring_theory::longinteger_object &go)
induced action on the set of homogeneous polynomials over a finite field
orbit of sets using a Schreier tree, used in packing::make_spread_table
Definition: orbits.h:106
void make_table_of_coset_reps(data_structures_groups::vector_ge *&Coset_reps, int verbose_level)
void get_table_of_orbits_and_hash_values(long int *&Table, int &orbit_length, int &set_size, int verbose_level)
void get_table_of_orbits(long int *&Table, int &orbit_length, int &set_size, 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 initialize_and_allocate_root_node(poset_classification_control *PC_control, poset_with_group_action *Poset, int depth, int verbose_level)
int main(int t0, int schreier_depth, int f_use_invariant_subset_if_available, int f_debug, int verbose_level)
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void(* print_function)(std::ostream &ost, int len, long int *S, void *data)
void report_tactical_decomposition_by_automorphism_group(std::ostream &ost, geometry::projective_space *P, actions::action *A_on_points, actions::action *A_on_lines, groups::strong_generators *gens, int size_limit_for_printing, int verbose_level)
void relative_order_vector_of_cosets(actions::action *A, groups::strong_generators *SG, data_structures_groups::vector_ge *cosets, int *&relative_order_table, int verbose_level)
void A5_in_PSL_2_q(int q, layer2_discreta::discreta_matrix &A, layer2_discreta::discreta_matrix &B, layer2_discreta::domain *dom_GFq, int verbose_level)
void do_orbits_on_polynomials(groups::linear_group *LG, int degree_of_poly, int f_recognize, std::string &recognize_text, int f_draw_tree, int draw_tree_idx, graphics::layered_graph_draw_options *Opt, int verbose_level)
void create_subgroups(groups::strong_generators *SG, long int *the_set, int set_size, groups::sims *S, actions::action *A_conj, groups::schreier *Classes, data_structures_groups::vector_ge *Transporter, int verbose_level)
void search_element_of_order(any_group *Any_group, actions::action *A1, actions::action *A2, int order, int verbose_level)
void do_identify_one(int q, int d, int f_no_eigenvalue_one, int elt_idx, int verbose_level)
void find_singer_cycle(any_group *Any_group, actions::action *A1, actions::action *A2, int verbose_level)
void do_eigenstuff_with_coefficients(field_theory::finite_field *F, int n, std::string &coeffs_text, int verbose_level)
void compute_regular_representation(actions::action *A, groups::sims *S, data_structures_groups::vector_ge *SG, int *&perm, int verbose_level)
void representation_on_polynomials(groups::linear_group *LG, int degree_of_poly, int verbose_level)
void do_eigenstuff_from_file(field_theory::finite_field *F, int n, std::string &fname, int verbose_level)
void do_eigenstuff(field_theory::finite_field *F, int size, int *Data, int verbose_level)
void do_normal_form(int q, int d, int f_no_eigenvalue_one, int *data, int data_sz, 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 A5_in_PSL_2_q_easy(int q, layer2_discreta::discreta_matrix &A, layer2_discreta::discreta_matrix &B, layer2_discreta::domain *dom_GFq, 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 A5_in_PSL_2_q_hard(int q, layer2_discreta::discreta_matrix &A, layer2_discreta::discreta_matrix &B, layer2_discreta::domain *dom_GFq, int verbose_level)
void presentation(actions::action *A, groups::sims *S, int goi, data_structures_groups::vector_ge *gens, int *primes, int verbose_level)
void linear_codes_with_bounded_minimum_distance(poset_classification::poset_classification_control *Control, groups::linear_group *LG, int d, int target_depth, 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 group_table(int q, int d, int f_poly, std::string &poly, int f_no_eigenvalue_one, int verbose_level)
void trace(layer2_discreta::discreta_matrix &A, layer2_discreta::discreta_base &tr)
void do_random(int q, int d, int f_no_eigenvalue_one, int verbose_level)
void conjugacy_classes_based_on_normal_forms(actions::action *A, groups::sims *override_Sims, std::string &label, std::string &label_tex, 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 matrix_convert_to_numerical(layer2_discreta::discreta_matrix &A, int *AA, int q)
void do_identify_all(int q, int d, int f_no_eigenvalue_one, int verbose_level)
void centralizer_of_element(actions::action *A, groups::sims *S, std::string &element_description, std::string &label, int verbose_level)
void classes_GL(field_theory::finite_field *F, int d, int f_no_eigenvalue_one, 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 find_standard_generators(any_group *Any_group, actions::action *A1, actions::action *A2, int order_a, int order_b, int order_ab, int verbose_level)
a wrapper for linear_group and permutation_group_create
groups::strong_generators * get_strong_generators()
Definition: any_group.cpp:2287
orbits of a group on polynomials using Schreier orbits
void init(groups::linear_group *LG, int degree_of_poly, int f_recognize, std::string &recognize_text, int verbose_level)
The Young representations of the symmetric group.
void create_module(int *h_alpha, int *&Base, int *&base_cols, int &rk, int verbose_level)
Definition: young.cpp:215
void group_ring_element_mult(actions::action *A, groups::sims *S, int *elt1, int *elt2, int *elt3)
Definition: young.cpp:1010
void init(int n, int verbose_level)
Definition: young.cpp:153
void create_representations(int *Base, int *Base_inv, int rk, int verbose_level)
Definition: young.cpp:306
void group_ring_element_print(actions::action *A, groups::sims *S, int *elt)
Definition: young.cpp:982
void group_ring_element_copy(actions::action *A, groups::sims *S, int *elt_from, int *elt_to)
Definition: young.cpp:991
void young_symmetrizer(int *row_parts, int nb_row_parts, int *tableau, int *elt1, int *elt2, int *elt3, int verbose_level)
Definition: young.cpp:515
void group_ring_element_create(actions::action *A, groups::sims *S, int *&elt)
Definition: young.cpp:966
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define FREE_OBJECTS(p)
Definition: foundations.h:652
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define Int_vec_print_integer_matrix_width(A, B, C, D, E, F)
Definition: foundations.h:691
#define 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
domain * allocate_finite_field_domain(int q, int verbose_level)
Definition: domain.cpp:378
int finite_field_domain_primitive_root()
Definition: domain.cpp:275
void free_finite_field_domain(domain *dom)
Definition: domain.cpp:415
the orbiter library for the classification of combinatorial objects
induced_actions::action_on_homogeneous_polynomials * OnHP