Orbiter 2022
Combinatorial Objects
recoordinatize.cpp
Go to the documentation of this file.
1// recoordinatize.cpp
2//
3// Anton Betten
4// November 17, 2009
5//
6// moved out of translation_plane.cpp: 4/16/2013
7// moved to TOP_LEVEL: 11/2/2013
8//
9//
10//
11
12#include "orbiter.h"
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer5_applications {
19namespace spreads {
20
21
23{
24
25 n = k = q = 0;
26
27 Grass = NULL;
28 F = NULL;
29 A = NULL;
30 A2 = NULL;
33 nCkq = 0;
36
37 //fname_live_points
38
40 M = M1 = AA = AAv = TT = TTv = B = C = N = Elt = NULL;
41
43 A0 = NULL;
44 A0_linear = NULL;
45 gens2 = NULL;
46
47 live_points = NULL;
49
50 //null();
51}
52
53
55{
56 freeself();
57}
58
60{
61}
62
64{
66 FREE_int(M);
67 FREE_int(M1);
68 FREE_int(AA);
70 FREE_int(TT);
72 FREE_int(B);
73 FREE_int(C);
74 FREE_int(N);
76 }
77 if (A0) {
79 }
80 if (gens2) {
82 }
83
84 if (live_points) {
86 }
87 null();
88}
89
90void recoordinatize::init(int n, int k,
94 int f_projective, int f_semilinear,
95 int (*check_function_incremental)(int len,
96 long int *S, void *data, int verbose_level),
97 void *check_function_incremental_data,
98 int verbose_level)
99{
100 int f_v = (verbose_level >= 1);
102
103 if (f_v) {
104 cout << "recoordinatize::init" << endl;
105 }
106
120 //recoordinatize::fname_live_points.assign(fname_live_points);
121 nCkq = Combi.generalized_binomial(n, k, q);
122
123#if 0
124 if (f_v) {
125 cout << "recoordinatize::init n=" << n << " k=" << k << " fname_live_points=" << fname_live_points << endl;
126 }
127#endif
128
129
130 M = NEW_int((3 * k) * n);
131 M1 = NEW_int((3 * k) * n);
132 AA = NEW_int(n * n);
133 AAv = NEW_int(n * n);
134 TT = NEW_int(k * k);
135 TTv = NEW_int(k * k);
136 B = NEW_int(n * n);
137 C = NEW_int(n * n);
138 N = NEW_int((3 * k) * n);
141 if (f_v) {
142 cout << "recoordinatize::init done" << endl;
143 }
144}
145
147 long int i1, long int i2, long int i3, int verbose_level)
148{
149 int f_v = (verbose_level >= 1);
150 int f_vv = FALSE;//(verbose_level >= 3);
151 int i, j;
152 long int j1, j2, j3;
153
154 if (f_v) {
155 cout << "recoordinatize::do_recoordinatize "
156 << i1 << "," << i2 << "," << i3 << endl;
157 }
158 Grass->unrank_lint_here(M, i1, 0 /*verbose_level - 4*/);
159 Grass->unrank_lint_here(M + k * n, i2, 0 /*verbose_level - 4*/);
160 Grass->unrank_lint_here(M + 2 * k * n, i3, 0 /*verbose_level - 4*/);
161 if (f_vv) {
162 cout << "M:" << endl;
164 }
165 Int_vec_copy(M, AA, n * n);
166 F->Linear_algebra->matrix_inverse(AA, AAv, n, 0 /*verbose_level - 1*/);
167 if (f_vv) {
168 cout << "AAv:" << endl;
170 }
172 0 /* verbose_level */);
173 if (f_vv) {
174 cout << "N:" << endl;
176 }
177
178 for (i = 0; i < k; i++) {
179 for (j = 0; j < k; j++) {
180 TT[i * k + j] = N[2 * k * n + i * n + j];
181 }
182 }
183 if (f_vv) {
184 cout << "TT:" << endl;
186 }
187 F->Linear_algebra->matrix_inverse(TT, TTv, k, 0 /*verbose_level - 1*/);
188 if (f_vv) {
189 cout << "TTv:" << endl;
191 }
192
193 Int_vec_zero(B, n * n);
194 for (i = 0; i < k; i++) {
195 for (j = 0; j < k; j++) {
196 B[i * n + j] = TTv[i * k + j];
197 }
198 }
199 for (i = 0; i < k; i++) {
200 for (j = 0; j < k; j++) {
201 TT[i * k + j] = N[2 * k * n + i * n + k + j];
202 }
203 }
204 if (f_vv) {
205 cout << "TT:" << endl;
207 }
208 F->Linear_algebra->matrix_inverse(TT, TTv, k, 0 /*verbose_level - 1*/);
209 if (f_vv) {
210 cout << "TTv:" << endl;
212 }
213 for (i = 0; i < k; i++) {
214 for (j = 0; j < k; j++) {
215 B[(k + i) * n + k + j] = TTv[i * k + j];
216 }
217 }
218 if (f_vv) {
219 cout << "B:" << endl;
221 B, n, n, n, F->log10_of_q + 1);
222 }
223
224
225 F->Linear_algebra->mult_matrix_matrix(AAv, B, C, n, n, n, 0 /* verbose_level */);
226 if (f_vv) {
227 cout << "C:" << endl;
229 }
230
231 F->Linear_algebra->mult_matrix_matrix(M, C, M1, 3 * k, n, n, 0 /* verbose_level */);
232 if (f_vv) {
233 cout << "M1:" << endl;
235 M1, 3 * k, n, n, F->log10_of_q + 1);
236 }
237 j1 = Grass->rank_lint_here(M1, 0 /*verbose_level - 4*/);
238 j2 = Grass->rank_lint_here(M1 + k * n, 0 /*verbose_level - 4*/);
239 j3 = Grass->rank_lint_here(M1 + 2 * k * n, 0 /*verbose_level - 4*/);
240 if (f_v) {
241 cout << "j1=" << j1 << " j2=" << j2 << " j3=" << j3 << endl;
242 }
243
244 A->make_element(Elt, C, 0);
245 if (f_vv) {
246 cout << "recoordinatize::do_recoordinatize "
247 "transporter:" << endl;
248 A->element_print(Elt, cout);
249 }
250 if (f_v) {
251 cout << "recoordinatize::do_recoordinatize done" << endl;
252 }
253}
254
255void recoordinatize::compute_starter(long int *&S, int &size,
256 groups::strong_generators *&Strong_gens, int verbose_level)
257{
258 int f_v = (verbose_level >= 1);
259
260
261 if (f_v) {
262 cout << "recoordinatize::compute_starter" << endl;
263 cout << "verbose_level = " << verbose_level << endl;
264 }
265
266
267
268 if (f_v) {
269 cout << "recoordinatize::compute_starter before make_first_three" << endl;
270 }
271 make_first_three(starter_j1, starter_j2, starter_j3, verbose_level - 1);
272 if (f_v) {
273 cout << "recoordinatize::compute_starter after make_first_three" << endl;
274 }
275
276 // initialize S with the vector (j1,j2,j3):
277 size = 3;
278 S = NEW_lint(size);
279
280 S[0] = starter_j1;
281 S[1] = starter_j2;
282 S[2] = starter_j3;
283
284
285 if (f_v) {
286 cout << "recoordinatize::compute_starter "
287 "before stabilizer_of_first_three" << endl;
288 }
289 stabilizer_of_first_three(Strong_gens, verbose_level - 1);
290 if (f_v) {
291 cout << "recoordinatize::compute_starter "
292 "after stabilizer_of_first_three" << endl;
293 }
294
295
296
297
298 if (f_v) {
299 cout << "recoordinatize::compute_starter "
300 "before compute_live_points" << endl;
301 }
302 compute_live_points(verbose_level - 10);
303 if (f_v) {
304 cout << "recoordinatize::compute_starter "
305 "after compute_live_points" << endl;
306 }
307
308
309 if (f_v) {
310 cout << "recoordinatize::compute_starter finished" << endl;
311 cout << "we found " << nb_live_points << " live points" << endl;
312 }
313
314}
315
317 groups::strong_generators *&Strong_gens, int verbose_level)
318{
319 int f_v = (verbose_level >= 1);
321
322 ring_theory::longinteger_object target_go, six, target_go2, go, go_linear;
324
325 if (f_v) {
326 cout << "recoordinatize::stabilizer_of_first_three" << endl;
327 }
328
332
334
335
336 if (f_v) {
337 cout << "recoordinatize::stabilizer_of_first_three "
338 "before A0->init_matrix_group" << endl;
339 }
342 TRUE /* f_basis */, TRUE /* f_init_sims */,
343 nice_gens,
344 0 /* verbose_level */);
345 FREE_OBJECT(nice_gens);
346
347 A0->group_order(target_go);
348 if (f_v) {
349 cout << "recoordinatize::stabilizer_of_first_three "
350 "target_go=" << target_go
351 << " = order of PGGL(" << k << "," << q << ")" << endl;
352 cout << "action A0 created: ";
353 A0->print_info();
354 }
355
357 FALSE /*f_semilinear*/,
358 TRUE /*f_basis*/, TRUE /* f_init_sims */,
359 nice_gens,
360 0/*verbose_level - 2*/);
361 FREE_OBJECT(nice_gens);
362
363 A0_linear->group_order(go_linear);
364 if (f_v) {
365 cout << "recoordinatize::stabilizer_of_first_three "
366 "order of PGL(" << k << "," << q << ") is "
367 << go_linear << endl;
368 cout << "action A0_linear created: ";
370 }
371
372
373
374
375 six.create(6, __FILE__, __LINE__);
376 D.mult(target_go, six, target_go2);
377 if (f_v) {
378 cout << "recoordinatize::stabilizer_of_first_three "
379 "target_go2=" << target_go2
380 << " = target_go times 6" << endl;
381 }
382
383
384
385 gens2->init(A, verbose_level - 2);
386
387
388 if (f_v) {
389 cout << "recoordinatize::stabilizer_of_first_three "
390 "before make_generators_stabilizer_of_three_components" << endl;
391 }
392
394
396 A /* A_PGL_n_q */,
397 A0 /* A_PGL_k_q */,
398 k, gens2, verbose_level - 1);
399
400 if (f_v) {
401 cout << "recoordinatize::stabilizer_of_first_three "
402 "after make_generators_stabilizer_of_three_components" << endl;
403 }
404
405
406 if (f_v) {
407 cout << "recoordinatize::stabilizer_of_first_three "
408 "before generators_to_strong_generators" << endl;
409 }
410
411
413 TRUE /* f_target_go */, target_go2,
414 gens2, Strong_gens, verbose_level - 1);
415
416
417 if (f_v) {
418 cout << "recoordinatize::stabilizer_of_first_three "
419 "done" << endl;
420 }
421}
422
423
425{
426 int f_v = (verbose_level >= 1);
427
428 if (f_v) {
429 cout << "recoordinatize::compute_live_points" << endl;
430 }
431
432
433 //string fname;
434
435
436#if 0
437 int f_path_select = TRUE;
438 int select_value;
439 int len;
440
441
442 len = i_power_j(Fq->q, Mtx->n) - 1;
443 for (select_value = 1; select_value < len; select_value++) {
444 if (f_path_select) {
445 sprintf(fname, "live_points_%d.txt", select_value);
446 }
447 else {
448 sprintf(fname, "live_points.txt");
449 }
450 if (file_size(fname) > 1) {
451 cout << "reading live points from file "
452 << fname << endl;
453 read_set_from_file(fname,
454 live_points, nb_live_points, verbose_level);
455 cout << "reading live points from file "
456 << fname << " done" << endl;
457 return;
458 }
459
460
461
462
463 if (f_v) {
464 cout << "recoordinatize::compute_live_points "
465 "checking all " << gos * Fq->q
466 << " elements in GL(" << k << "," << q << ")" << endl;
467 cout << "order of PGL(" << k << "," << q << ")=" << gos << endl;
468 }
469
470#endif
471
472
473 // we wish to run through the elements of GL(k,q).
474 // instead, we run through PGL(k,q) and multiply by nonzero scalars:
475
476#if 0
477
478 Mtx->matrices_without_eigenvector_one(
480 f_path_select, select_value, verbose_level);
481 // ToDo: need to change the ranks from matrices to subspaces !!!
482#else
483
484
485#if 0
486 file_io Fio;
487
488 if (Fio.file_size(fname_live_points) > 1) {
489 if (f_v) {
490 cout << "recoordinatize::compute_live_points "
491 "reading live points from file " << fname_live_points << endl;
492 }
493 Fio.read_set_from_file(fname_live_points,
494 live_points, nb_live_points, verbose_level);
495 if (f_v) {
496 cout << "recoordinatize::compute_live_points "
497 "we found " << nb_live_points << " live points" << endl;
498 }
499 return;
500 }
501 else {
502 if (f_v) {
503 cout << "recoordinatize::compute_live_points "
504 "before compute_live_points_low_level" << endl;
505 }
507 live_points, nb_live_points, verbose_level - 1);
508 if (f_v) {
509 cout << "recoordinatize::compute_live_points "
510 "after compute_live_points_low_level" << endl;
511 }
512
513 if (f_v) {
514 cout << "recoordinatize::compute_live_points "
515 "before Fio.write_set_to_file" << endl;
516 }
517 Fio.write_set_to_file(fname_live_points,
518 live_points, nb_live_points, verbose_level);
519 if (f_v) {
520 cout << "recoordinatize::compute_live_points "
521 "written file " << fname_live_points << endl;
522 }
523 }
524#else
525 if (f_v) {
526 cout << "recoordinatize::compute_live_points "
527 "before compute_live_points_low_level" << endl;
528 }
530 live_points, nb_live_points, verbose_level - 1);
531 if (f_v) {
532 cout << "recoordinatize::compute_live_points "
533 "after compute_live_points_low_level" << endl;
534 }
535#endif
536
537#if 0
538
539 sprintf(fname, "live_points.txt");
540 if (file_size(fname) > 1) {
541 cout << "reading live points from file " << fname << endl;
542 read_set_from_file(fname, live_points, nb_live_points, verbose_level);
543 cout << "reading live points from file " << fname << " done" << endl;
544 return;
545 }
546 else {
547 if (f_v) {
548 cout << "recoordinatize::compute_live_points "
549 "before Mtx->matrices_without_eigenvector_one" << endl;
550 }
551 Mtx->matrices_without_eigenvector_one(
553 FALSE /* f_path_select */, 0 /*select_value*/, verbose_level);
554
555 if (f_v) {
556 cout << "recoordinatize::compute_live_points "
557 "after Mtx->matrices_without_eigenvector_one" << endl;
558 }
559
560 int_vec_heapsort(live_points, nb_live_points);
561
562 write_set_to_file(fname,
563 live_points, nb_live_points, verbose_level);
564 if (f_v) {
565 cout << "recoordinatize::compute_live_points "
566 "written file " << fname << endl;
567 }
568 }
569
570#endif
571
572
573#if 0
574 if (FALSE) {
575 for (h = 0; h < nb_live_points; h++) {
576 cout << "live point " << h << " is point " << live_points[h] << ":" << endl;
577 Grass->unrank_int(live_points[h], 0);
578 print_integer_matrix_width(cout, Grass->M, k, n, n, F->log10_of_q + 1);
579 cout << endl;
580 for (i = 0; i < k; i++) {
581 for (j = 0; j < k; j++) {
582 Elt1[i * k + j] = Grass->M[i * n + k + j];
583 }
584 }
585 a = A0_linear->Sims->element_rank_int(Elt1);
586 cout << "rank in A0 is " << a << endl;
587 //A0->element_print(Elt1, cout);
588 }
589 }
590
591 cout << "they are:" << endl;
592 for (i = 0; i < nb_live_points; i++) {
593 cout << setw(5) << i << " : " << setw(10) << live_points[i] << endl;
594 }
595#endif
596
597 if (f_v) {
598 cout << "recoordinatize::compute_live_points done" << endl;
599 }
600}
601
603 long int *&live_points, int &nb_live_points, int verbose_level)
604{
605 int f_v = (verbose_level >= 1);
606 int f_vv = (verbose_level >= 2);
607
610 long int SS[4];
611 int *Elt1;
612
613 int cnt, z;
614 int cnt_mod = 1000;
616 long int gos;
617 long int i, j, h, a;
619
620
621 if (f_v) {
622 cout << "recoordinatize::compute_live_points_low_level" << endl;
623 }
624
625
626 Mtx = A0->G.matrix_grp;
627 Fq = Mtx->GFq;
628
629 SS[0] = starter_j1;
630 SS[1] = starter_j2;
631 SS[2] = starter_j3;
632
633 Elt1 = NEW_int(A->elt_size_in_int);
634
635
636 if (f_v) {
637 cout << "recoordinatize::compute_live_points_low_level "
638 "nCkq = " << nCkq << endl;
639 }
641 nb_live_points = 0;
642
643 A0_linear->group_order(go_linear);
644 gos = go_linear.as_lint();
645
646 cnt = 0;
647 for (h = 0; h < gos; h++) {
648 for (z = 1; z < q; z++, cnt++) {
649 if (f_vv) {
650 if ((cnt % cnt_mod) == 0 && cnt) {
651 cout << "recoordinatize::compute_live_points_low_level"
652 << cnt << " iterations, h=" << h << " found "
653 << nb_live_points << " points so far" << endl;
654 }
655 }
657 Fq->PG_element_normalize(Elt1, 1, k * k);
658 if (f_vv && (cnt % cnt_mod) == 0 && cnt) {
659 cout << "recoordinatize::compute_live_points_low_level "
660 "element " << cnt << " = " << h
661 << ", normalized:" << endl;
662 A0->element_print(Elt1, cout);
663 }
664 for (i = 0; i < k * k; i++) {
665 Elt1[i] = Fq->mult(Elt1[i], z);
666 }
667 if (f_v && (cnt % cnt_mod) == 0 && cnt) {
668 cout << "recoordinatize::compute_live_points_low_level "
669 "element " << cnt << " = " << h
670 << ", multiplied by z=" << z << ":" << endl;
672 Elt1, k, k, k, F->log10_of_q + 1);
673 }
674
675 // make the k x n matrix ( I_k | Elt1 )
676 Int_vec_zero(Grass->M, k * n);
677 for (i = 0; i < k; i++) {
678 Grass->M[i * n + i] = 1;
679 }
680 for (i = 0; i < k; i++) {
681 for (j = 0; j < k; j++) {
682 Grass->M[i * n + k + j] = Elt1[i * k + j];
683 }
684 }
685 if (f_vv && (cnt % cnt_mod) == 0) {
686 cout << "recoordinatize::compute_live_points_low_level "
687 "element " << h << ":" << endl;
689 }
690 if (FALSE || ((h & ((1 << 15) - 1)) == 0 && z == 1)) {
691 cout << h << " / " << gos
692 << " nb_live_points=" << nb_live_points << endl;
694 }
695 a = Grass->rank_lint(0);
696 SS[3] = a;
697 if (f_vv && (cnt % cnt_mod) == 0 && cnt) {
698 cout << "has rank " << a << endl;
699 }
700 if ((*check_function_incremental)(4, SS,
702 0/*verbose_level - 4*/)) {
703 if (f_vv && (cnt % cnt_mod) == 0 && cnt) {
704 cout << "recoordinatize::compute_live_points_low_level "
705 "element " << cnt << " = " << h << ", "
706 << z << " subspace rank " << a
707 << " is accepted as live point no "
708 << nb_live_points << endl;
709 }
711 }
712 else {
713 if (f_vv && (cnt % cnt_mod) == 0) {
714 cout << "recoordinatize::compute_live_points_low_level "
715 "element " << cnt << " = " << h << ", "
716 << z << " subspace rank " << a
717 << " is not accepted" << endl;
718 }
719 }
720 }
721 }
722#endif
723
724 if (f_v) {
725 cout << "recoordinatize::compute_live_points_low_level "
726 "we found " << nb_live_points << " live points" << endl;
727 }
728 if (f_v) {
729 cout << "recoordinatize::compute_live_points_low_level "
730 "sorting" << endl;
731 }
732
734 if (f_v) {
735 cout << "recoordinatize::compute_live_points_low_level done" << endl;
736 }
737}
738
740 long int &j1, long int &j2, long int &j3, int verbose_level)
741{
742 int f_v = (verbose_level >= 1);
743
744 if (f_v) {
745 cout << "recoordinatize::make_first_three" << endl;
746 }
747
748
749 j1 = Grass->make_special_element_zero(0 /* verbose_level */);
750 j2 = Grass->make_special_element_infinity(0 /* verbose_level */);
751 j3 = Grass->make_special_element_one(0 /* verbose_level */);
752
753 if (f_v) {
754 cout << "recoordinatize::make_first_three j1=" << j1 << " j2=" << j2 << " j3=" << j3 << endl;
755 }
756
757 if (f_v) {
758 cout << "recoordinatize::make_first_three done" << endl;
759 }
760}
761
762}}}
763
a collection of functions related to sorted vectors
to rank and unrank subspaces of a fixed dimension in F_q^n
Definition: geometry.h:892
long int make_special_element_infinity(int verbose_level)
Definition: grassmann.cpp:1351
long int make_special_element_one(int verbose_level)
Definition: grassmann.cpp:1321
long int rank_lint_here(int *Mtx, int verbose_level)
Definition: grassmann.cpp:275
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
long int make_special_element_zero(int verbose_level)
Definition: grassmann.cpp:1292
void mult_matrix_matrix(int *A, int *B, int *C, int m, int n, int o, int verbose_level)
void matrix_inverse(int *A, int *Ainv, int n, int verbose_level)
domain to compute with objects of type longinteger
Definition: ring_theory.h:240
void mult(longinteger_object &a, longinteger_object &b, longinteger_object &c)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
void create(long int i, const char *file, int line)
global functions related to group actions
Definition: actions.h:1015
void make_generators_stabilizer_of_three_components(action *A_PGL_n_q, action *A_PGL_k_q, int k, data_structures_groups::vector_ge *gens, int verbose_level)
a permutation group in a fixed action.
Definition: actions.h:99
void element_print(void *elt, std::ostream &ost)
Definition: action_cb.cpp:347
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 make_element(int *Elt, int *data, int verbose_level)
Definition: action.cpp:1875
void group_order(ring_theory::longinteger_object &go)
Definition: action.cpp:2223
void generators_to_strong_generators(int f_target_go, ring_theory::longinteger_object &target_go, data_structures_groups::vector_ge *gens, groups::strong_generators *&Strong_gens, int verbose_level)
void init(actions::action *A, int verbose_level)
Definition: vector_ge.cpp:55
a matrix group over a finite field in projective, vector space or affine action
Definition: groups.h:318
void element_unrank_lint(long int rk, int *Elt, int verbose_level)
Definition: sims.cpp:1326
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
void do_recoordinatize(long int i1, long int i2, long int i3, int verbose_level)
void compute_starter(long int *&S, int &size, groups::strong_generators *&Strong_gens, int verbose_level)
int(* check_function_incremental)(int len, long int *S, void *check_function_incremental_data, int verbose_level)
Definition: spreads.h:36
void stabilizer_of_first_three(groups::strong_generators *&Strong_gens, int verbose_level)
void compute_live_points_low_level(long int *&live_points, int &nb_live_points, int verbose_level)
void make_first_three(long int &j1, long int &j2, long int &j3, int verbose_level)
data_structures_groups::vector_ge * gens2
Definition: spreads.h:59
void init(int n, int k, field_theory::finite_field *F, geometry::grassmann *Grass, actions::action *A, actions::action *A2, int f_projective, int f_semilinear, int(*check_function_incremental)(int len, long int *S, void *data, int verbose_level), void *check_function_incremental_data, int verbose_level)
#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 TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
the orbiter library for the classification of combinatorial objects