Orbiter 2022
Combinatorial Objects
klein_correspondence.cpp
Go to the documentation of this file.
1// klein_correspondence.cpp
2//
3// Anton Betten
4//
5// January 1, 2016
6
7#include "foundations.h"
8
9using namespace std;
10
11
12namespace orbiter {
13namespace layer1_foundations {
14namespace geometry {
15
16
18{
19 null();
20}
21
23{
24 freeself();
25}
26
28{
29 P3 = NULL;
30 P5 = NULL;
31 Gr63 = NULL;
32 Gr62 = NULL;
34 Form = NULL;
35 //Line_to_point_on_quadric = NULL;
36 //Point_on_quadric_to_line = NULL;
37 //Point_on_quadric_embedded_in_P5 = NULL;
38 //coordinates_of_quadric_points = NULL;
39 //Pt_rk = NULL;
40}
41
43{
44 if (P3) {
46 }
47 if (P5) {
49 }
50 if (Gr63) {
52 }
53 if (Gr62) {
55 }
56 if (Form) {
58 }
59#if 0
60 if (Line_to_point_on_quadric) {
61 FREE_lint(Line_to_point_on_quadric);
62 }
63 if (Point_on_quadric_to_line) {
64 FREE_lint(Point_on_quadric_to_line);
65 }
66#endif
67#if 0
68 if (Point_on_quadric_embedded_in_P5) {
69 FREE_lint(Point_on_quadric_embedded_in_P5);
70 }
71#endif
72#if 0
73 if (coordinates_of_quadric_points) {
74 FREE_int(coordinates_of_quadric_points);
75 }
76 if (Pt_rk) {
77 FREE_int(Pt_rk);
78 }
79#endif
80}
81
85 int verbose_level)
86{
87 int f_v = (verbose_level >= 1);
88 //int f_vv = (verbose_level >= 2);
89 int d = 6;
90 int h, u, v;
92
93 if (f_v) {
94 cout << "klein_correspondence::init" << endl;
95 }
96
99 q = F->q;
100
101
102 nb_Pts = O->nb_points;
103
105
106 if (f_v) {
107 cout << "klein_correspondence::init before P3->projective_space_init" << endl;
108 }
110 FALSE /* f_init_incidence_structure */,
111 verbose_level - 2);
112
114
115 if (f_v) {
116 cout << "klein_correspondence::init before P5->projective_space_init" << endl;
117 }
119 FALSE /* f_init_incidence_structure */,
120 verbose_level - 2);
121 if (f_v) {
122 cout << "klein_correspondence::after after P5->projective_space_init" << endl;
123 }
124
125
128
129 Gr63->init(6, 3, F, 0 /* verbose_level */);
130 Gr62->init(6, 2, F, 0 /* verbose_level */);
131
134
135 Combi.q_binomial(la, d, 2, q, 0 /* verbose_level */);
136
138
139
140 Form = NEW_int(d * d);
141 Int_vec_zero(Form, d * d);
142 // the matrix with blocks
143 // [0 1]
144 // [1 0]
145 // along the diagonal:
146 for (h = 0; h < 3; h++) {
147 u = 2 * h + 0;
148 v = 2 * h + 1;
149 Form[u * d + v] = 1;
150 Form[v * d + u] = 1;
151 }
152 if (f_v) {
153 cout << "klein_correspondence::init Form matrix:" << endl;
154 Int_matrix_print(Form, d, d);
155 }
156#if 0
157 if (f_v) {
158 cout << "klein_correspondence::init before allocate "
159 "Line_to_point_on_quadric P3->N_lines="
160 << P3->N_lines << endl;
161 }
162 Line_to_point_on_quadric = NEW_lint(P3->N_lines);
163 if (f_v) {
164 cout << "klein_correspondence::init before allocate "
165 "Point_on_quadric_to_line P3->N_lines="
166 << P3->N_lines << endl;
167 }
168 Point_on_quadric_to_line = NEW_lint(P3->N_lines);
169 if (f_v) {
170 cout << "klein_correspondence::init before allocate "
171 "Point_on_quadric_embedded_in_P5 P3->N_lines="
172 << P3->N_lines << endl;
173 }
174 //Point_on_quadric_embedded_in_P5 = NEW_lint(P3->N_lines);
175#endif
176
177#if 0
178 int basis_line[8]; // [2 * 4]
179 int v6[6];
180 int *x4, *y4, a, b, c, val;
181 long int i, j;
182 long int N100;
183 long int point_rk, line_rk;
184
185 //basis_line = NEW_int(8);
186 for (i = 0; i < P3->N_lines; i++) {
187 Point_on_quadric_to_line[i] = -1;
188 }
189 if (f_v) {
190 cout << "klein_correspondence::init computing "
191 "Line_to_point_on_quadric[] / Point_on_quadric_to_line[]" << endl;
192 }
193
194 N100 = P3->N_lines / 100;
195 for (i = 0; i < P3->N_lines; i++) {
196
197 if ((i % N100) == 0) {
198 cout << "klein_correspondence::init at " << i << " which is " << (double) i / (double) N100 << "%" << endl;
199 }
200 P3->unrank_line(basis_line, i);
201 x4 = basis_line;
202 y4 = basis_line + 4;
203 v6[0] = F->Pluecker_12(x4, y4);
204 v6[1] = F->Pluecker_34(x4, y4);
205 v6[2] = F->Pluecker_13(x4, y4);
206 v6[3] = F->Pluecker_42(x4, y4);
207 v6[4] = F->Pluecker_14(x4, y4);
208 v6[5] = F->Pluecker_23(x4, y4);
209 a = F->mult(v6[0], v6[1]);
210 b = F->mult(v6[2], v6[3]);
211 c = F->mult(v6[4], v6[5]);
212 val = F->add3(a, b, c);
213 //cout << "a=" << a << " b=" << b << " c=" << c << endl;
214 //cout << "val=" << val << endl;
215 if (val) {
216 cout << "klein_correspondence::init point does "
217 "not lie on quadric" << endl;
218 exit(1);
219 }
220 //j = P5->rank_point(v6);
221 j = O->rank_point(v6, 1, 0 /* verbose_level */);
222 if (FALSE) {
223 cout << "klein_correspondence::init i=" << i
224 << " / " << P3->N_lines << " v6 : ";
225 int_vec_print(cout, v6, 6);
226 cout << " : j=" << j << endl;
227 }
228 if (Point_on_quadric_to_line[j] != -1) {
229 cout << "Something is wrong with "
230 "Point_on_quadric_to_line: Point_on_quadric_to_line[j] != -1" << endl;
231 exit(1);
232 }
233
234 point_rk = line_to_point_on_quadric(i, verbose_level);
235 if (point_rk != j) {
236 cout << "klein_correspondence::init point_rk != j" << endl;
237 exit(1);
238 }
239 line_rk = point_on_quadric_to_line(point_rk, verbose_level);
240 if (line_rk != i) {
241 cout << "klein_correspondence::init line_rk != i" << endl;
242 exit(1);
243 }
244
245 Line_to_point_on_quadric[i] = j;
246 Point_on_quadric_to_line[j] = i;
247 }
248 for (i = 0; i < P3->N_lines; i++) {
249 if (Point_on_quadric_to_line[i] == -1) {
250 cout << "Something is wrong with "
251 "Point_on_quadric_to_line" << endl;
252 cout << "Point_on_quadric_to_line[i] == -1" << endl;
253 cout << "i=" << i << endl;
254 exit(1);
255 }
256 }
257#endif
258
259
260#if 0
261 if (f_v) {
262 cout << "klein_correspondence::init computing "
263 "Point_on_quadric_embedded_in_P5[]" << endl;
264 }
265 for (i = 0; i < P3->N_lines; i++) {
266 O->unrank_point(v6, 1, i, 0);
267 Point_on_quadric_embedded_in_P5[i] = P5->rank_point(v6);
268 }
269#endif
270
271
272#if 0
273 if (f_v) {
274 cout << "klein_correspondence::init before coordinates_"
275 "of_quadric_points P3->N_lines * d="
276 << P3->N_lines * d << endl;
277 }
278 coordinates_of_quadric_points = NEW_int(P3->N_lines * d);
279
280
281 if (f_v) {
282 cout << "klein_correspondence::init before allocate "
283 "Pt_rk P3->N_lines=" << P3->N_lines << endl;
284 }
285 Pt_rk = NEW_int(P3->N_lines);
286
287 if (f_v) {
288 cout << "klein_correspondence::init after allocate "
289 "Pt_rk P3->N_lines=" << P3->N_lines << endl;
290 cout << "klein_correspondence::init computing Pt_rk[]" << endl;
291 }
292 for (i = 0; i < P3->N_lines; i++) {
294 coordinates_of_quadric_points + i * d, 1, i, 0);
295 int_vec_copy(
296 coordinates_of_quadric_points + i * d, v6, 6);
297 F->PG_element_rank_modified(v6, 1, d, a);
298 Pt_rk[i] = a;
299 }
300 if (f_v) {
301 cout << "klein_correspondence::init computing Pt_rk[] done" << endl;
302 }
303
304 if (f_vv) {
305 cout << "Points on the Klein quadric:" << endl;
306 if (nb_Pts < 50) {
307 for (i = 0; i < nb_Pts; i++) {
308 P3->unrank_line(basis_line, i);
309
310 cout << i << " & " << endl;
311 cout << "\\left[" << endl;
312 cout << "\\begin{array}{cccc}" << endl;
313 for (u = 0; u < 2; u++) {
314 for (v = 0; v < 4; v++) {
315 cout << basis_line[u * 4 + v] << " ";
316 if (v < 4 - 1) {
317 cout << "&";
318 }
319 }
320 cout << "\\\\" << endl;
321 }
322 cout << "\\end{array}" << endl;
323 cout << "\\right] & " << endl;
324 int_vec_print(cout,
325 coordinates_of_quadric_points + i * d, d);
326 //cout << " : " << Pt_rk[i] << endl;
327 cout << "\\\\" << endl;
328 }
329 }
330 else {
331 cout << "too many points to print" << endl;
332 }
333 }
334#endif
335
336 nb_pts_PG = Gg.nb_PG_elements(d - 1, q);
337 if (f_v) {
338 cout << "klein_correspondence::init nb_pts_PG = " << nb_pts_PG << endl;
339 }
340
341#if 0
342 // this array is only used by REGULAR_PACKING
343 if (f_v) {
344 cout << "klein_correspondence::init before "
345 "allocate Pt_idx nb_pts_P=" << nb_pts_PG << endl;
346 }
347 Pt_idx = NEW_int(nb_pts_PG);
348 for (i = 0; i < nb_pts_PG; i++) {
349 Pt_idx[i] = -1;
350 }
351 for (i = 0; i < nb_Pts; i++) {
352 a = Pt_rk[i];
353 Pt_idx[a] = i;
354 }
355#endif
356
357
358 if (f_v) {
359 cout << "klein_correspondence::init done" << endl;
360 }
361}
362
364 long int *lines_in_PG3, int nb_lines,
366 long int **&Pts_on_plane,
367 int *&nb_pts_on_plane,
368 int &nb_planes,
369 int verbose_level)
370{
371 int f_v = (verbose_level >= 1);
372 int f_vv = (verbose_level >= 2);
373 long int *pts;
374 int i;
375
376 if (f_v) {
377 cout << "klein_correspondence::plane_intersections" << endl;
378 }
379 pts = NEW_lint(nb_lines);
380
382 lines_in_PG3, nb_lines, pts, 0/*verbose_level*/);
383
384 P5->plane_intersection_type_fast(Gr63, pts, nb_lines,
385 R, Pts_on_plane, nb_pts_on_plane, nb_planes,
386 verbose_level - 3);
387
388
389 if (f_vv) {
390 cout << "klein_correspondence::plane_intersections: "
391 "We found " << nb_planes << " planes." << endl;
392#if 1
393 for (i = 0; i < nb_planes; i++) {
394 cout << setw(3) << i << " : " << R[i]
395 << " : " << setw(5) << nb_pts_on_plane[i] << " : ";
396 Lint_vec_print(cout, Pts_on_plane[i], nb_pts_on_plane[i]);
397 cout << endl;
398 }
399#endif
400 }
401
402 FREE_lint(pts);
403 if (f_v) {
404 cout << "klein_correspondence::plane_intersections done" << endl;
405 }
406}
407
409{
410 int v6[6];
411 long int r;
412
413 O->unrank_point(v6, 1, pt, 0);
414 r = P5->rank_point(v6);
415 return r;
416}
417
418long int klein_correspondence::line_to_point_on_quadric(long int line_rk, int verbose_level)
419{
420 int f_v = (verbose_level >= 1);
421
422 if (f_v) {
423 cout << "klein_correspondence::line_to_point_on_quadric" << endl;
424 }
425 int v6[6];
426 long int point_rk;
427
428 line_to_Pluecker(line_rk, v6, verbose_level);
429
430 point_rk = O->rank_point(v6, 1, 0 /* verbose_level */);
431 if (FALSE) {
432 cout << "klein_correspondence::line_to_point_on_quadric line_rk=" << line_rk
433 << " / " << P3->N_lines << " v6 : ";
434 Int_vec_print(cout, v6, 6);
435 cout << " : point_rk=" << point_rk << endl;
436 }
437
438 if (f_v) {
439 cout << "klein_correspondence::line_to_point_on_quadric done" << endl;
440 }
441 return point_rk;
442}
443
444void klein_correspondence::line_to_Pluecker(long int line_rk, int *v6, int verbose_level)
445{
446 int f_v = (verbose_level >= 1);
447
448 if (f_v) {
449 cout << "klein_correspondence::line_to_Pluecker" << endl;
450 }
451 int basis_line[8]; // [2 * 4]
452 int *x4, *y4, a, b, c, val;
453
454 P3->unrank_line(basis_line, line_rk);
455 x4 = basis_line;
456 y4 = basis_line + 4;
457 v6[0] = F->Linear_algebra->Pluecker_12(x4, y4);
458 v6[1] = F->Linear_algebra->Pluecker_34(x4, y4);
459 v6[2] = F->Linear_algebra->Pluecker_13(x4, y4);
460 v6[3] = F->Linear_algebra->Pluecker_42(x4, y4);
461 v6[4] = F->Linear_algebra->Pluecker_14(x4, y4);
462 v6[5] = F->Linear_algebra->Pluecker_23(x4, y4);
463 a = F->mult(v6[0], v6[1]);
464 b = F->mult(v6[2], v6[3]);
465 c = F->mult(v6[4], v6[5]);
466 val = F->add3(a, b, c);
467 //cout << "a=" << a << " b=" << b << " c=" << c << endl;
468 //cout << "val=" << val << endl;
469 if (val) {
470 cout << "klein_correspondence::line_to_Pluecker point does "
471 "not lie on quadric" << endl;
472 exit(1);
473 }
474 //j = P5->rank_point(v6);
475 if (f_v) {
476 cout << "klein_correspondence::line_to_Pluecker done" << endl;
477 }
478}
479
480long int klein_correspondence::point_on_quadric_to_line(long int point_rk, int verbose_level)
481{
482 int f_v = (verbose_level >= 1);
483
484 if (f_v) {
485 cout << "klein_correspondence::point_on_quadric_to_line" << endl;
486 }
487 int v6[6];
488 int basis_line[8]; // [2 * 4]
489 long int line_rk = 0;
490
491 O->unrank_point(v6, 1, point_rk, 0);
492 if (f_v) {
493 cout << "klein_correspondence::point_on_quadric_to_line v6=";
494 Int_vec_print(cout, v6, 6);
495 cout << endl;
496 }
497
498 Pluecker_to_line(v6, basis_line, verbose_level);
499
500 line_rk = P3->rank_line(basis_line);
501 if (f_v) {
502 cout << "klein_correspondence::point_on_quadric_to_line "
503 "point_rk=" << point_rk << " line_rk=" << line_rk << " done" << endl;
504 }
505 if (line_rk >= P3->N_lines) {
506 cout << "klein_correspondence::point_on_quadric_to_line "
507 "line_rk >= P3->N_lines" << endl;
508 exit(1);
509 }
510
511 if (f_v) {
512 cout << "klein_correspondence::point_on_quadric_to_line done" << endl;
513 }
514 return line_rk;
515}
516
517void klein_correspondence::Pluecker_to_line(int *v6, int *basis_line, int verbose_level)
518{
519 //verbose_level = 1;
520 int f_v = (verbose_level >= 1);
521 int p12, p34, p13, p24, p14, p23;
522 int v[6];
523
524 if (f_v) {
525 cout << "klein_correspondence::Pluecker_to_line" << endl;
526 }
527
528 p12 = v6[0];
529 p34 = v6[1];
530 p13 = v6[2];
531 p24 = F->negate(v6[3]);
532 p14 = v6[4];
533 p23 = v6[5];
534
535 v[0] = p12;
536 v[1] = p13;
537 v[2] = p14;
538 v[3] = p23;
539 v[4] = p24;
540 v[5] = p34;
541
543 v,
544 basis_line, verbose_level);
545
546
547 if (f_v) {
548 cout << "klein_correspondence::Pluecker_to_line done" << endl;
549 }
550}
551
552long int klein_correspondence::Pluecker_to_line_rk(int *v6, int verbose_level)
553{
554 //verbose_level = 1;
555 int f_v = (verbose_level >= 1);
556 int basis_line[8];
557 long int line_rk;
558
559 if (f_v) {
560 cout << "klein_correspondence::Pluecker_to_line_rk" << endl;
561 }
562
563 Pluecker_to_line(v6, basis_line, 0 /*verbose_level*/);
564
565 line_rk = P3->rank_line(basis_line);
566
567
568 if (f_v) {
569 cout << "klein_correspondence::Pluecker_to_line_rk done" << endl;
570 }
571
572 return line_rk;
573}
574
575
576void klein_correspondence::exterior_square_to_line(int *v, int *basis_line, int verbose_level)
577{
578 //verbose_level = 1;
579 int f_v = (verbose_level >= 1);
580 int p12, p13, p14, p23, p24, p34;
581 int x2, x3, x4;
582 int y2, y3, y4;
583
584 if (f_v) {
585 cout << "klein_correspondence::exterior_square_to_line" << endl;
586 }
587
588 p12 = v[0];
589 p13 = v[1];
590 p14 = v[2];
591 p23 = v[3];
592 p24 = v[4];
593 p34 = v[5];
594
595
596 Int_vec_zero(basis_line, 8);
597
598 if (p12 == 0 && p13 == 0 && p14 == 0) {
599 // this means that x1 = 0
600 if (f_v) {
601 cout << "klein_correspondence::exterior_square_to_line x1=0" << endl;
602 }
603
604 if (p23 == 0 && p24 == 0) {
605 basis_line[2] = basis_line[7] = 1;
606 }
607 else {
608 y3 = p23;
609 y4 = p24;
610 if (y3) {
611 x4 = F->negate(F->a_over_b(p34, y3));
612 basis_line[1] = 1;
613 basis_line[3] = x4;
614 basis_line[6] = p23;
615 basis_line[7] = p24;
616 }
617 else {
618 x3 = F->a_over_b(p34, y4);
619 basis_line[1] = 1;
620 basis_line[2] = x3;
621 basis_line[7] = 1;
622 }
623 }
624 }
625 else {
626 // at least one of p12, p13, p14 is nonzero,
627 // which means that x1 \neq 0
628 if (f_v) {
629 cout << "klein_correspondence::exterior_square_to_line x1=1" << endl;
630 }
631
632 y2 = p12;
633 y3 = p13;
634 y4 = p14;
635 if (y2 == 0 && y3 == 0) {
636 basis_line[0] = 1;
637 basis_line[1] = p24;
638 basis_line[2] = p34;
639 basis_line[7] = 1;
640 }
641 else {
642 if (p12) {
643 x3 = F->negate(F->a_over_b(p23, p12));
644 x4 = F->negate(F->a_over_b(p24, p12));
645 basis_line[0] = 1;
646 basis_line[2] = x3;
647 basis_line[3] = x4;
648 basis_line[5] = p12;
649 basis_line[6] = p13;
650 basis_line[7] = y4;
651 }
652 else {
653 x2 = F->a_over_b(p23, p13);
654 x4 = F->negate(F->a_over_b(p34, p13));
655 basis_line[0] = 1;
656 basis_line[1] = x2;
657 basis_line[3] = x4;
658 basis_line[6] = p13;
659 basis_line[7] = y4;
660 }
661 }
662
663 }
664 if (f_v) {
665 cout << "klein_correspondence::exterior_square_to_line done" << endl;
666 }
667
668}
669
670
671
673 std::vector<long int> &External_lines, int verbose_level)
674{
675
676 int f_v = (verbose_level >= 1);
677 //int f_vv = (verbose_level >= 2);
678 int i, j;
679 int d = 6;
680 int *LineMtx;
681 long int *Line;
682 int nb_points_covered;
683
684 if (f_v) {
685 cout << "klein_correspondence::compute_external_lines" << endl;
686 }
687
688
689 LineMtx = NEW_int(2 * d);
690
691 if (f_v) {
692 cout << "klein_correspondence::compute_external_lines "
693 "nb_lines_orthogonal=" << nb_lines_orthogonal << endl;
694 }
695
696 nb_points_covered = Gr62->nb_points_covered(0 /* verbose_level */);
697
698 if (f_v) {
699 cout << "klein_correspondence::compute_external_lines "
700 "nb_points_covered=" << nb_points_covered << endl;
701 }
702
703 Line = NEW_lint(nb_points_covered);
704
705 if (f_v) {
706 cout << "klein_correspondence::compute_external_lines "
707 "computing external lines:" << endl;
708 }
709 int pt, a, b, c, val;
710 int v6[6];
711
712 // make a list of all external lines to the Klein quadric:
713 for (i = 0; i < nb_lines_orthogonal; i++) {
714 Gr62->unrank_lint_here(LineMtx, i, 0 /*verbose_level*/);
715 Gr62->points_covered(Line, 0 /* verbose_level */);
716 for (j = 0; j < nb_points_covered; j++) {
717 pt = Line[j];
718 F->PG_element_unrank_modified(v6, 1, 6, pt);
719 //K->O->unrank_point(v6, 1, pt, 0);
720 a = F->mult(v6[0], v6[1]);
721 b = F->mult(v6[2], v6[3]);
722 c = F->mult(v6[4], v6[5]);
723 val = F->add3(a, b, c);
724
725 if (val == 0) {
726 break; // we found a point on the quadric, break off
727 }
728 }
729 if (j == nb_points_covered) {
730 External_lines.push_back(i);
731 }
732 }
733 if (f_v) {
734 cout << "klein_correspondence::compute_external_lines "
735 "We found " << External_lines.size()
736 << " external lines" << endl;
737 }
738
739 FREE_int(LineMtx);
740 FREE_lint(Line);
741
742 if (f_v) {
743 cout << "klein_correspondence::compute_external_lines done" << endl;
744 }
745
746}
747
749 spread_tables *T,
750 std::vector<long int> &External_lines,
751 long int *&spread_to_external_line_idx,
752 long int *&external_line_to_spread,
753 int verbose_level)
754// spread_to_external_line_idx[i] is index into External_lines
755// corresponding to regular spread i
756// external_line_to_spread[i] is the index of the
757// regular spread of PG(3,q) in table T associated with
758// External_lines[i]
759{
760 int f_v = (verbose_level >= 1);
761
762 if (f_v) {
763 cout << "klein_correspondence::identify_external_lines_and_spreads" << endl;
764 }
765 int i, j, rk, idx;
766 long int a, b;
767 int N100;
768 int d = 6;
769 int *basis_elliptic_quadric;
770 int *basis;
771 int *basis_external_line;
773
774 spread_to_external_line_idx = NEW_lint(T->nb_spreads);
775 external_line_to_spread = NEW_lint(External_lines.size());
776
777 basis_elliptic_quadric = NEW_int(T->spread_size * d);
778 basis = NEW_int(d * d);
779
780 basis_external_line = NEW_int(2 * d);
781
782 for (i = 0; i < External_lines.size(); i++) {
783 external_line_to_spread[i] = -1;
784 }
785
786 N100 = (T->nb_spreads / 100) + 1;
787 for (i = 0; i < T->nb_spreads; i++) {
788
789 if ((i % N100) == 0) {
790 cout << "klein_correspondence::identify_external_lines_and_spreads "
791 "progress " << ((double)i / N100) << " %" << endl;
792 }
793 for (j = 0; j < T->spread_size; j++) {
794 a = T->spread_table[i * T->spread_size + j];
795 b = line_to_point_on_quadric(a, 0 /* verbose_level */);
796
797 O->unrank_point(basis_elliptic_quadric + j * d, 1, b, 0);
798 }
799 if (FALSE) {
800 cout << "klein_correspondence::identify_external_lines_and_spreads"
801 "spread " << i
802 << " the elliptic quadric space" << endl;
803 Int_matrix_print(basis_elliptic_quadric,
804 T->spread_size, d);
805 }
806 rk = F->Linear_algebra->Gauss_easy(basis_elliptic_quadric, T->spread_size, d);
807 if (rk != 4) {
808 cout << "klein_correspondence::identify_external_lines_and_spreads "
809 "spread " << i << " the elliptic quadric space "
810 "does not have rank 4" << endl;
811 exit(1);
812 }
813 Int_vec_copy(basis_elliptic_quadric, basis, 4 * d);
814 F->Linear_algebra->perp(d, 4, basis, Form, 0 /* verbose_level */);
816 basis + 4 * d,
817 basis_external_line,
818 2 * d);
819 a = P5->rank_line(basis_external_line);
820 if (!Sorting.vector_lint_search(External_lines, a, idx, 0 /*verbose_level*/)) {
821 cout << "klein_correspondence::identify_external_lines_and_spreads spread "
822 " cannot find the external line i = " << i << endl;
823 exit(1);
824 }
825 spread_to_external_line_idx[i] = idx;
826 external_line_to_spread[idx] = i;
827 }
828
829#if 0
830 for (i = 0; i < External_lines.size(); i++) {
831 if (external_line_to_spread[i] == -1) {
832 cout << "klein_correspondence::identify_external_lines_and_spreads "
833 "something is wrong with the correspondence" << endl;
834 exit(1);
835 }
836 }
837#endif
838
839 FREE_int(basis_elliptic_quadric);
840 FREE_int(basis);
841 FREE_int(basis_external_line);
842
843 if (f_v) {
844 cout << "klein_correspondence::identify_external_lines_and_spreads done" << endl;
845 }
846
847}
848
849
850void klein_correspondence::reverse_isomorphism(int *A6, int *A4, int verbose_level)
851{
852 int f_v = (verbose_level >= 1);
853 //int A6_copy[36];
854 int X[16];
855 int Xv[16];
856 int Y[16];
857 int Z[16];
858 int Yv[16];
859 int Zv[16];
860 int XYv[16];
861 int XZv[16];
862 int D[16];
863 //int i, u1, u2;
864
865 if (f_v) {
866 cout << "klein_correspondence::reverse_isomorphism" << endl;
867 }
868
869 if (f_v) {
870 cout << "A6=" << endl;
871 Int_matrix_print(A6, 6, 6);
872 }
873
874
875#if 0
876 int Basis1[] = {
877 1,0,0,0,0,0,
878 0,1,0,0,0,0,
879 0,0,1,0,0,0,
880 0,0,0,1,0,0,
881 0,0,0,0,1,0,
882 0,0,0,0,0,1,
883 };
884 int Basis2[36];
885 int Image[36];
886 int Image2[36];
887 int v[6];
888 int w[6];
889 sorting Sorting;
890
891 for (i = 0; i < 6; i++) {
892 F->wedge_to_klein(Basis1 + i * 6, Basis2 + i * 6);
893 }
894
895 F->mult_matrix_matrix(Basis2, A6, Image, 6, 6, 6, 0 /* verbose_level*/);
896 for (i = 0; i < 6; i++) {
897 F->klein_to_wedge(Image + i * 6, Image2 + i * 6);
898 }
899#endif
900
901#if 0
902 int_vec_copy(A6, A6_copy, 36);
903
904#if 0
905 for (i = 0; i < 6; i++) {
906 u1 = A6_copy[3 * 6 + i];
907 u2 = F->negate(u1);
908 A6_copy[3 * 6 + i] = u2;
909 }
910
911 for (i = 0; i < 6; i++) {
912 u1 = A6_copy[i * 6 + 3];
913 u2 = F->negate(u1);
914 A6_copy[i * 6 + 3] = u2;
915 }
916#endif
917 if (f_v) {
918 cout << "A6_copy=" << endl;
919 int_matrix_print(A6_copy, 6, 6);
920 }
921#endif
922
923 // 12,34:
924 exterior_square_to_line(A6, X, 0 /* verbose_level*/);
925 exterior_square_to_line(A6 + 5 * 6, X + 8, 0 /* verbose_level*/);
926
927 // 13,24
928 exterior_square_to_line(A6 + 1 * 6, Y, 0 /* verbose_level*/);
929 exterior_square_to_line(A6 + 4 * 6, Y + 8, 0 /* verbose_level*/);
930
931 // 14,23
932 exterior_square_to_line(A6 + 2 * 6, Z, 0 /* verbose_level*/);
933 exterior_square_to_line(A6 + 3 * 6, Z + 8, 0 /* verbose_level*/);
934
935 if (f_v) {
936 cout << "X=" << endl;
937 Int_matrix_print(X, 4, 4);
938 cout << "Y=" << endl;
939 Int_matrix_print(Y, 4, 4);
940 cout << "Z=" << endl;
941 Int_matrix_print(Z, 4, 4);
942 }
943
944 F->Linear_algebra->invert_matrix(X, Xv, 4, 0 /* verbose_level*/);
945 F->Linear_algebra->invert_matrix(Y, Yv, 4, 0 /* verbose_level*/);
946 F->Linear_algebra->invert_matrix(Z, Zv, 4, 0 /* verbose_level*/);
947 //F->invert_matrix(A, Av, 4, 0 /* verbose_level*/);
948
949 if (f_v) {
950 cout << "Xv=" << endl;
951 Int_matrix_print(Xv, 4, 4);
952 cout << "Yv=" << endl;
953 Int_matrix_print(Yv, 4, 4);
954 cout << "Zv=" << endl;
955 Int_matrix_print(Zv, 4, 4);
956 }
957
958 F->Linear_algebra->mult_matrix_matrix(X, Yv, XYv, 4, 4, 4, 0 /* verbose_level*/);
959
960 if (f_v) {
961 cout << "XYv=" << endl;
962 Int_matrix_print(XYv, 4, 4);
963 }
964
965 F->Linear_algebra->mult_matrix_matrix(X, Zv, XZv, 4, 4, 4, 0 /* verbose_level*/);
966
967 if (f_v) {
968 cout << "XZv=" << endl;
969 Int_matrix_print(XZv, 4, 4);
970 }
971
972 //int a, b, c, d, e, f, g, h;
973
974 int M[16 * 8];
975
976 Int_vec_zero(M, 16 * 8);
977
978 M[0 * 8 + 0] = XYv[0 * 4 + 2];
979 M[0 * 8 + 1] = XYv[1 * 4 + 2];
980 M[1 * 8 + 0] = XYv[0 * 4 + 3];
981 M[1 * 8 + 1] = XYv[1 * 4 + 3];
982 M[2 * 8 + 4] = XYv[2 * 4 + 2];
983 M[2 * 8 + 5] = XYv[3 * 4 + 2];
984 M[3 * 8 + 4] = XYv[2 * 4 + 3];
985 M[3 * 8 + 5] = XYv[3 * 4 + 3];
986 M[4 * 8 + 2] = XYv[0 * 4 + 0];
987 M[4 * 8 + 3] = XYv[1 * 4 + 0];
988 M[5 * 8 + 2] = XYv[0 * 4 + 1];
989 M[5 * 8 + 3] = XYv[1 * 4 + 1];
990 M[6 * 8 + 6] = XYv[2 * 4 + 0];
991 M[6 * 8 + 7] = XYv[3 * 4 + 0];
992 M[7 * 8 + 6] = XYv[2 * 4 + 1];
993 M[7 * 8 + 7] = XYv[3 * 4 + 1];
994
995 M[8 * 8 + 0] = XZv[0 * 4 + 2];
996 M[8 * 8 + 1] = XZv[1 * 4 + 2];
997 M[9 * 8 + 0] = XZv[0 * 4 + 3];
998 M[9 * 8 + 1] = XZv[1 * 4 + 3];
999 M[10 * 8 + 6] = XZv[2 * 4 + 2];
1000 M[10 * 8 + 7] = XZv[3 * 4 + 2];
1001 M[11 * 8 + 6] = XZv[2 * 4 + 3];
1002 M[11 * 8 + 7] = XZv[3 * 4 + 3];
1003 M[12 * 8 + 2] = XZv[0 * 4 + 0];
1004 M[12 * 8 + 3] = XZv[1 * 4 + 0];
1005 M[13 * 8 + 2] = XZv[0 * 4 + 1];
1006 M[13 * 8 + 3] = XZv[1 * 4 + 1];
1007 M[14 * 8 + 4] = XZv[2 * 4 + 0];
1008 M[14 * 8 + 5] = XZv[3 * 4 + 0];
1009 M[15 * 8 + 4] = XZv[2 * 4 + 1];
1010 M[15 * 8 + 5] = XZv[3 * 4 + 1];
1011
1012 Int_vec_zero(A4, 4 * 4);
1013
1014
1015 if (f_v) {
1016 cout << "M=" << endl;
1017 Int_matrix_print(M, 16, 8);
1018 }
1019
1020 int rk;
1021 int base_cols[8];
1022
1023 rk = F->Linear_algebra->Gauss_simple(M, 16, 8, base_cols, verbose_level);
1024
1025 //rk = F->RREF_and_kernel(16, 8, M, verbose_level);
1026
1027 if (f_v) {
1028 cout << "has rank " << rk << endl;
1029 Int_matrix_print(M, rk, 8);
1030 }
1031 if (f_v) {
1032 cout << "base columns: " << endl;
1033 Int_vec_print(cout, base_cols, rk);
1034 cout << endl;
1035 }
1036
1037 int kernel_m, kernel_n;
1038 int K[8 * 8];
1039 int i, j;
1040
1041 F->Linear_algebra->matrix_get_kernel(M, 16, 8, base_cols, rk,
1042 kernel_m, kernel_n, K, 0 /* verbose_level */);
1043
1044
1045 if (f_v) {
1046 cout << "kernel: " << endl;
1047 Int_matrix_print(K, 8, kernel_n);
1048 }
1049
1050
1051 int abcdefgh[8];
1052 int a, b, c, d, e, f, g, h;
1053
1054 for (i = 0; i < 8; i++) {
1055 abcdefgh[i] = 0;
1056 }
1057
1058
1059 for (j = 0; j < kernel_n; j++) {
1060 for (i = 0; i < 8; i++) {
1061 if (K[i * kernel_n + j]) {
1062 abcdefgh[i] = K[i * kernel_n + j];
1063 }
1064 }
1065 }
1066
1067 a = abcdefgh[0];
1068 b = abcdefgh[1];
1069 c = abcdefgh[2];
1070 d = abcdefgh[3];
1071 e = abcdefgh[4];
1072 f = abcdefgh[5];
1073 g = abcdefgh[6];
1074 h = abcdefgh[7];
1075
1076
1077 Int_vec_zero(D, 16);
1078 D[0 * 4 + 0] = a;
1079 D[0 * 4 + 1] = b;
1080 D[1 * 4 + 0] = c;
1081 D[1 * 4 + 1] = d;
1082 D[2 * 4 + 2] = e;
1083 D[2 * 4 + 3] = f;
1084 D[3 * 4 + 2] = g;
1085 D[3 * 4 + 3] = h;
1086
1087 if (f_v) {
1088 cout << "D=" << endl;
1089 Int_matrix_print(D, 4, 4);
1090 }
1091
1092 F->Linear_algebra->mult_matrix_matrix(D, X, A4, 4, 4, 4, 0 /* verbose_level*/);
1093
1094 if (f_v) {
1095 cout << "A4=" << endl;
1096 Int_matrix_print(A4, 4, 4);
1097 }
1098
1099
1100 int A6b[36];
1101
1102 F->Linear_algebra->exterior_square(A4, A6b, 4, 0 /* verbose_level*/);
1103 //F->lift_to_Klein_quadric(A4, A6b, 0 /* verbose_level*/);
1104
1105 if (f_v) {
1106 cout << "A6b=" << endl;
1107 Int_matrix_print(A6b, 6, 6);
1108 }
1109
1110
1111 if (!F->test_if_vectors_are_projectively_equal(A6, A6b, 36)) {
1112 cout << "matrices are not projectively equal" << endl;
1113 exit(1);
1114 }
1115 else {
1116 cout << "matrices are projectively the same, success" << endl;
1117 }
1118
1119 if (f_v) {
1120 cout << "klein_correspondence::reverse_isomorphism done" << endl;
1121 }
1122}
1123
1124
1125}}}
1126
1127
1128
1129
void q_binomial(ring_theory::longinteger_object &a, int n, int k, int q, int verbose_level)
a collection of functions related to sorted vectors
int vector_lint_search(std::vector< long int > &v, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1235
void PG_element_rank_modified(int *v, int stride, int len, int &a)
void PG_element_unrank_modified(int *v, int stride, int len, int a)
various functions related to geometries
Definition: geometry.h:721
to rank and unrank subspaces of a fixed dimension in F_q^n
Definition: geometry.h:892
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
void init(int n, int k, field_theory::finite_field *F, int verbose_level)
Definition: grassmann.cpp:70
void points_covered(long int *the_points, int verbose_level)
Definition: grassmann.cpp:255
void Pluecker_to_line(int *v6, int *basis_line, int verbose_level)
void init(field_theory::finite_field *F, orthogonal_geometry::orthogonal *O, int verbose_level)
void identify_external_lines_and_spreads(spread_tables *T, std::vector< long int > &External_lines, long int *&spread_to_external_line_idx, long int *&external_line_to_spread, int verbose_level)
void plane_intersections(long int *lines_in_PG3, int nb_lines, ring_theory::longinteger_object *&R, long int **&Pts_on_plane, int *&nb_pts_on_plane, int &nb_planes, int verbose_level)
void exterior_square_to_line(int *v, int *basis_line, int verbose_level)
long int line_to_point_on_quadric(long int line_rk, int verbose_level)
void reverse_isomorphism(int *A6, int *A4, int verbose_level)
long int point_on_quadric_to_line(long int point_rk, int verbose_level)
void compute_external_lines(std::vector< long int > &External_lines, int verbose_level)
void line_to_Pluecker(long int line_rk, int *v6, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
void plane_intersection_type_fast(grassmann *G, long int *set, int set_size, ring_theory::longinteger_object *&R, long int **&Pts_on_plane, int *&nb_pts_on_plane, int &len, int verbose_level)
void klein_correspondence(projective_space *P5, long int *set_in, int set_size, long int *set_out, int verbose_level)
void projective_space_init(int n, field_theory::finite_field *F, int f_init_incidence_structure, int verbose_level)
tables with line-spreads in PG(3,q)
Definition: geometry.h:2335
void exterior_square(int *An, int *An2, int n, int verbose_level)
void invert_matrix(int *A, int *A_inv, int n, int verbose_level)
void mult_matrix_matrix(int *A, int *B, int *C, int m, int n, int o, int verbose_level)
int perp(int n, int k, int *A, int *Gram, int verbose_level)
int Gauss_simple(int *A, int m, int n, int *base_cols, int verbose_level)
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)
long int rank_point(int *v, int stride, int verbose_level)
void unrank_point(int *v, int stride, long int rk, int verbose_level)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
#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 Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define Int_matrix_print(A, B, C)
Definition: foundations.h:707
#define 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
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects