Orbiter 2022
Combinatorial Objects
clebsch_map.cpp
Go to the documentation of this file.
1/*
2 * clebsch_map.cpp
3 *
4 * Created on: Jul 2, 2019
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace algebraic_geometry {
20
21
23{
24 SO = NULL;
25 Surf = NULL;
26 F = NULL;
27
28 hds = 0;
29 ds = 0;
30 ds_row = 0;
31
32 line1 = 0;
33 line2 = 0;
34 transversal = 0;
35
37
38
39 line_idx[0] = -1;
40 line_idx[1] = -1;
42
43 Clebsch_map = NULL;
44 Clebsch_coeff = NULL;
45}
46
48{
49 freeself();
50}
51
52
54{
55 int f_v = FALSE;
56
57 if (f_v) {
58 cout << "clebsch_map::freeself" << endl;
59 }
60}
61
63 int hds, int verbose_level)
64{
65 int f_v = (verbose_level >= 1);
66
67 if (f_v) {
68 cout << "clebsch_map::init_half_double_six" << endl;
69 }
70
71
73 Surf = SO->Surf;
74 F = Surf->F;
76 ds = hds / 2;
77 ds_row = hds % 2;
78 if (f_v) {
79 cout << "clebsch_map::init_half_double_six hds = " << hds
80 << " double six = " << ds << " row = " << ds_row << endl;
81 }
82
83 if (f_v) {
84 cout << "clebsch_map::init_half_double_six "
85 "before Surf->prepare_clebsch_map" << endl;
86 }
88 transversal, verbose_level);
89 if (f_v) {
90 cout << "clebsch_map::init_half_double_six "
91 "after Surf->prepare_clebsch_map" << endl;
92 }
93
94 if (f_v) {
95 cout << "clebsch_map::init_half_double_six "
96 "line1=" << line1
98 << " line2=" << line2
100 << " transversal=" << transversal
102 << endl;
103 }
104
105 line_idx[0] = line1;
106 line_idx[1] = line2;
107
109 transversal, verbose_level);
110
112
113
114 int u, a, h;
115 int v[4];
116 int coefficients[3];
117
118
122 0 /* verbose_level */);
123
124 if (f_v) {
126 cout << "surface_with_action::arc_lifting_and_classify "
127 "base_cols: ";
128 Int_vec_print(cout, base_cols, 3);
129 cout << endl;
130 }
131
132
133 if (f_v) {
134 cout << "surface_with_action::arc_lifting_and_classify "
135 "Lines with points on them:" << endl;
137 cout << "The half double six is no " << hds
139 << "$ : $";
141 cout << " = \\{" << endl;
142 for (h = 0; h < 6; h++) {
145 if (h < 6 - 1) {
146 cout << ", ";
147 }
148 }
149 cout << "\\}$\\\\" << endl;
150 }
151
152 for (u = 0; u < 6; u++) {
153
154 if (f_v) {
155 cout << "surface_with_action::arc_lifting_and_classify u="
156 << u << " / 6" << endl;
157 }
158 a = SO->Lines[Surf->Schlaefli->Half_double_sixes[hds * 6 + u]];
159 if (f_v) {
160 cout << "surface_with_action::arc_lifting_and_classify "
161 "intersecting line " << a << " and plane "
162 << plane_rk_global << endl;
163 }
167 0 /* verbose_level */);
168 if (f_v) {
169 cout << "surface_with_action::arc_lifting_and_classify "
170 "intersection point " << intersection_points[u] << endl;
171 }
173 if (f_v) {
174 cout << "surface_with_action::arc_lifting_and_classify "
175 "which is ";
176 Int_vec_print(cout, v, 4);
177 cout << endl;
178 }
180 3, 4, Plane, base_cols,
181 v, coefficients,
182 0 /* verbose_level */);
183 if (f_v) {
184 cout << "surface_with_action::arc_lifting_and_classify "
185 "local coefficients ";
186 Int_vec_print(cout, coefficients, 3);
187 cout << endl;
188 }
189 intersection_points_local[u] = Surf->P2->rank_point(coefficients);
190 }
191
192
193
194
195 if (f_v) {
196 cout << "clebsch_map::init_half_double_six done" << endl;
197 }
198}
199
201{
202 int f_v = (verbose_level >= 1);
203
204 if (f_v) {
205 cout << "clebsch_map::compute_Clebsch_map_down" << endl;
206 }
207
208 if (SO == NULL) {
209 cout << "clebsch_map::compute_Clebsch_map_down SO == NULL" << endl;
210 exit(1);
211 }
212
213
216
217 if (f_v) {
218 cout << "clebsch_map::compute_Clebsch_map_down before compute_Clebsch_map_down_worker" << endl;
219 }
220
224 verbose_level)) {
225 cout << "clebsch_map::compute_Clebsch_map_down The plane contains one of the lines, "
226 "this should not happen" << endl;
227 exit(1);
228 }
229 if (f_v) {
230 cout << "clebsch_map::compute_Clebsch_map_down after compute_Clebsch_map_down_worker" << endl;
231 }
232
233 if (f_v) {
234 cout << "clebsch_map::compute_Clebsch_map_down done" << endl;
235 }
236}
237
238
240 long int *Image_rk, int *Image_coeff,
241 int verbose_level)
242// assuming:
243// In:
244// SO->nb_pts
245// SO->Pts[SO->nb_pts]
246// SO->Lines[27]
247// Out:
248// Image_rk[nb_pts] (image point in the plane in local coordinates)
249// Note Image_rk[i] is -1 if Pts[i] does not have an image.
250// Image_coeff[nb_pts * 4] (image point in the plane in PG(3,q) coordinates)
251{
252 int f_v = (verbose_level >= 1);
253 int f_vv = (verbose_level >= 2);
254 int Plane[4 * 4];
255 int Line_a[2 * 4];
256 int Line_b[2 * 4];
257 int Dual_planes[4 * 4];
258 // dual coefficients of three planes:
259 // the first plane is line_a together with the surface point
260 // the second plane is line_b together with the surface point
261 // the third plane is the plane onto which we map.
262 // the fourth row is for the image point.
263 int M[4 * 4];
264 int v[4];
265 long int i, h, pt, r;
266 int coefficients[3];
267 int base_cols[4];
268
269 if (f_v) {
270 cout << "clebsch_map::compute_Clebsch_map_down_worker" << endl;
271 }
273 0 /* verbose_level */);
275 0 /* verbose_level */);
276 if (f_v) {
277 cout << "Plane rank " << plane_rk_global << " :" << endl;
279 }
280
281 F->Linear_algebra->RREF_and_kernel(4, 3, Plane, 0 /* verbose_level */);
282
283 if (f_v) {
284 cout << "Plane (3 basis vectors and dual coordinates):" << endl;
286 cout << "base_cols: ";
287 Int_vec_print(cout, base_cols, r);
288 cout << endl;
289 }
290
291 // make sure the two lines are not contained in
292 // the plane onto which we map:
293
294 // test line_a:
296 SO->Lines[line_idx[0]], 0 /* verbose_level */);
297 if (f_v) {
298 cout << "Line a = " << Surf->Schlaefli->Labels->Line_label_tex[line_idx[0]]
299 << " = " << SO->Lines[line_idx[0]] << ":" << endl;
301 }
302 for (i = 0; i < 2; i++) {
303 if (F->Linear_algebra->dot_product(4, Line_a + i * 4, Plane + 3 * 4)) {
304 break;
305 }
306 }
307 if (i == 2) {
308 cout << "clebsch_map::compute_Clebsch_map_down_worker Line a lies "
309 "inside the hyperplane" << endl;
310 return FALSE;
311 }
312
313 // test line_b:
315 SO->Lines[line_idx[1]], 0 /* verbose_level */);
316 if (f_v) {
317 cout << "Line b = " << Surf->Schlaefli->Labels->Line_label_tex[line_idx[1]]
318 << " = " << SO->Lines[line_idx[1]] << ":" << endl;
320 }
321 for (i = 0; i < 2; i++) {
322 if (F->Linear_algebra->dot_product(4, Line_b + i * 4, Plane + 3 * 4)) {
323 break;
324 }
325 }
326 if (i == 2) {
327 cout << "clebsch_map::compute_Clebsch_map_down_worker Line b lies "
328 "inside the hyperplane" << endl;
329 return FALSE;
330 }
331
332 // and now, map all surface points:
333 for (h = 0; h < SO->nb_pts; h++) {
334 pt = SO->Pts[h];
335
336 Surf->unrank_point(v, pt);
337
338 Int_vec_zero(Image_coeff + h * 4, 4);
339 if (f_v) {
340 cout << "clebsch_map::compute_Clebsch_map_down_worker "
341 "pt " << h << " / " << SO->nb_pts << " is " << pt << " = ";
342 Int_vec_print(cout, v, 4);
343 cout << ":" << endl;
344 }
345
346 // make sure the points do not lie on either line_a or line_b
347 // because the map is undefined there:
348 Int_vec_copy(Line_a, M, 2 * 4);
349 Int_vec_copy(v, M + 2 * 4, 4);
350 if (F->Linear_algebra->Gauss_easy(M, 3, 4) == 2) {
351 if (f_vv) {
352 cout << "The point is on line_a" << endl;
353 }
354 Image_rk[h] = -1;
355 continue;
356 }
357 Int_vec_copy(Line_b, M, 2 * 4);
358 Int_vec_copy(v, M + 2 * 4, 4);
359 if (F->Linear_algebra->Gauss_easy(M, 3, 4) == 2) {
360 if (f_vv) {
361 cout << "The point is on line_b" << endl;
362 }
363 Image_rk[h] = -1;
364 continue;
365 }
366
367 // The point is good:
368
369 // Compute the first plane in dual coordinates:
370 Int_vec_copy(Line_a, M, 2 * 4);
371 Int_vec_copy(v, M + 2 * 4, 4);
372 F->Linear_algebra->RREF_and_kernel(4, 3, M, 0 /* verbose_level */);
373 Int_vec_copy(M + 3 * 4, Dual_planes, 4);
374 if (f_vv) {
375 cout << "clebsch_map::compute_Clebsch_map_down_worker First plane in dual coordinates: ";
376 Int_vec_print(cout, M + 3 * 4, 4);
377 cout << endl;
378 }
379
380 // Compute the second plane in dual coordinates:
381 Int_vec_copy(Line_b, M, 2 * 4);
382 Int_vec_copy(v, M + 2 * 4, 4);
383 F->Linear_algebra->RREF_and_kernel(4, 3, M, 0 /* verbose_level */);
384 Int_vec_copy(M + 3 * 4, Dual_planes + 4, 4);
385 if (f_vv) {
386 cout << "clebsch_map::compute_Clebsch_map_down_worker Second plane in dual coordinates: ";
387 Int_vec_print(cout, M + 3 * 4, 4);
388 cout << endl;
389 }
390
391
392 // The third plane is the image
393 // plane, given by dual coordinates:
394 Int_vec_copy(Plane + 3 * 4, Dual_planes + 8, 4);
395 if (f_vv) {
396 cout << "clebsch_map::compute_Clebsch_map_down_worker Dual coordinates for all three planes: " << endl;
398 cout << endl;
399 }
400
402 Dual_planes, 0 /* verbose_level */);
403 if (f_vv) {
404 cout << "clebsch_map::compute_Clebsch_map_down_worker Dual coordinates and perp: " << endl;
406 cout << endl;
407 cout << "clebsch_map::compute_Clebsch_map_down_worker matrix of dual coordinates has rank " << r << endl;
408 }
409
410
411 if (r < 3) {
412 if (f_v) {
413 cout << "clebsch_map::compute_Clebsch_map_down_worker The line is contained in the plane" << endl;
414 }
415 Image_rk[h] = -1;
416 continue;
417 }
418 F->PG_element_normalize(Dual_planes + 12, 1, 4);
419 if (f_vv) {
420 cout << "clebsch_map::compute_Clebsch_map_down_worker intersection point normalized: ";
421 Int_vec_print(cout, Dual_planes + 12, 4);
422 cout << endl;
423 }
424 Int_vec_copy(Dual_planes + 12, Image_coeff + h * 4, 4);
425
426 // compute local coordinates of the image point:
428 3, 4, Plane, base_cols,
429 Dual_planes + 12, coefficients,
430 0 /* verbose_level */);
431 Image_rk[h] = Surf->P2->rank_point(coefficients);
432 if (f_vv) {
433 cout << "clebsch_map::compute_Clebsch_map_down_worker pt " << h << " / " << SO->nb_pts
434 << " is " << pt << " : image = ";
435 Int_vec_print(cout, Image_coeff + h * 4, 4);
436 cout << " image = " << Image_rk[h] << endl;
437 }
438 }
439
440 if (f_v) {
441 cout << "clebsch_map::compute_Clebsch_map_down_worker done" << endl;
442 }
443 return TRUE;
444}
445
447{
448 int i, j, u, pt;
449
450 cout << "clebsch_map::clebsch_map_print_fibers" << endl;
451 {
453
455 cout << "clebsch_map::clebsch_map_print_fibers The fibers "
456 "have the following sizes: ";
457 C2.print_naked(TRUE);
458 cout << endl;
459
460 int t2, f2, l2, sz;
461 int t1, f1, l1;
462
463 for (t2 = 0; t2 < C2.second_nb_types; t2++) {
464 f2 = C2.second_type_first[t2];
465 l2 = C2.second_type_len[t2];
466 sz = C2.second_data_sorted[f2];
467 cout << "clebsch_map::clebsch_map_print_fibers fibers "
468 "of size " << sz << ":" << endl;
469 if (sz == 1) {
470 continue;
471 }
472 for (i = 0; i < l2; i++) {
473 t1 = C2.second_sorting_perm_inv[f2 + i];
474 f1 = C2.type_first[t1];
475 l1 = C2.type_len[t1];
476 pt = C2.data_sorted[f1];
477 cout << "arc point " << pt << " belongs to the " << l1
478 << " surface points in the list of Pts "
479 "(local numbering): ";
480 for (j = 0; j < l1; j++) {
481 u = C2.sorting_perm_inv[f1 + j];
482 cout << u;
483 //cout << Pts[u];
484 if (j < l1 - 1) {
485 cout << ", ";
486 }
487 }
488 cout << endl;
489 }
490 }
491 cout << endl;
492 }
493}
494
495
497 int verbose_level)
498{
499 int f_v = (verbose_level >= 1);
500 int i, j, pt, nb_blow_up_lines;
501
502 if (f_v) {
503 cout << "clebsch_map::clebsch_map_find_arc_and_lines" << endl;
504 }
505
506
507 if (f_v) {
508 cout << "lines_on_point:" << endl;
510 }
511
512 {
514
516 if (f_v) {
517 cout << "clebsch_map::clebsch_map_find_arc_and_lines "
518 "The fibers have the following sizes: ";
519 C2.print_naked(TRUE);
520 cout << endl;
521 }
522
523 int t2, f2, l2, sz;
524 int t1, f1, l1;
525 int fiber[2];
526 int common_elt;
527 int u; //, v, w;
528
529
530
531
532 nb_blow_up_lines = 0;
533 for (t2 = 0; t2 < C2.second_nb_types; t2++) {
534 f2 = C2.second_type_first[t2];
535 l2 = C2.second_type_len[t2];
536 sz = C2.second_data_sorted[f2];
537 if (f_v) {
538 cout << "clebsch_map::clebsch_map_find_arc_and_lines "
539 "fibers of size " << sz << ":" << endl;
540 }
541 if (sz == 1) {
542 continue;
543 }
544
545 if (f_v) {
546 for (i = 0; i < l2; i++) {
547 t1 = C2.second_sorting_perm_inv[f2 + i];
548 f1 = C2.type_first[t1];
549 l1 = C2.type_len[t1];
550 pt = C2.data_sorted[f1];
551 cout << "arc point " << pt << " belongs to the " << l1
552 << " surface points in the list of Pts "
553 "(point indices): ";
554 for (j = 0; j < l1; j++) {
555 u = C2.sorting_perm_inv[f1 + j];
556 cout << u;
557 //cout << Pts[u];
558 if (j < l1 - 1) {
559 cout << ", ";
560 }
561 }
562 cout << endl;
563 }
564 }
565
566
567 for (i = 0; i < l2; i++) {
568 t1 = C2.second_sorting_perm_inv[f2 + i];
569 f1 = C2.type_first[t1];
570 l1 = C2.type_len[t1];
571 pt = C2.data_sorted[f1];
572
573 if (pt == -1) {
574 continue;
575 }
576 fiber[0] = C2.sorting_perm_inv[f1 + 0];
577 fiber[1] = C2.sorting_perm_inv[f1 + 1];
578
579 if (f_v) {
580 cout << "lines through point fiber[0]="
581 << fiber[0] << " : ";
583 SO->SOP->lines_on_point->Sets[fiber[0]],
584 SO->SOP->lines_on_point->Set_size[fiber[0]]);
585 cout << endl;
586 cout << "lines through point fiber[1]="
587 << fiber[1] << " : ";
589 SO->SOP->lines_on_point->Sets[fiber[1]],
590 SO->SOP->lines_on_point->Set_size[fiber[1]]);
591 cout << endl;
592 }
593
594 // find the unique line which passes through
595 // the surface points fiber[0] and fiber[1]:
597 fiber[0], fiber[1], common_elt)) {
598 cout << "The fiber does not seem to come "
599 "from a line, i=" << i << endl;
600
601
602#if 1
603 cout << "The fiber does not seem to come "
604 "from a line" << endl;
605 cout << "i=" << i << " / " << l2 << endl;
606 cout << "pt=" << pt << endl;
607 cout << "fiber[0]=" << fiber[0] << endl;
608 cout << "fiber[1]=" << fiber[1] << endl;
609 cout << "lines through point fiber[0]=" << fiber[0] << " : ";
611 SO->SOP->lines_on_point->Sets[fiber[0]],
612 SO->SOP->lines_on_point->Set_size[fiber[0]]);
613 cout << endl;
614 cout << "lines through point fiber[1]=" << fiber[1] << " : ";
616 SO->SOP->lines_on_point->Sets[fiber[1]],
617 SO->SOP->lines_on_point->Set_size[fiber[1]]);
618 cout << endl;
619 //exit(1);
620#endif
621 }
622 else {
623 if (nb_blow_up_lines == 6) {
624 cout << "too many long fibers" << endl;
625 exit(1);
626 }
627 cout << "i=" << i << " fiber[0]=" << fiber[0]
628 << " fiber[1]=" << fiber[1]
629 << " common_elt=" << common_elt << endl;
630 Arc[nb_blow_up_lines] = pt;
631 Blown_up_lines[nb_blow_up_lines] = common_elt;
632 nb_blow_up_lines++;
633 }
634
635#if 0
636 w = 0;
637 for (u = 0; u < l2; u++) {
638 fiber[0] = C2.sorting_perm_inv[f1 + u];
639 for (v = u + 1; v < l2; v++, w++) {
640 fiber[1] = C2.sorting_perm_inv[f1 + v];
641 Fiber_recognize[w] = -1;
642 if (!lines_on_point->find_common_element_in_two_sets(
643 fiber[0], fiber[1], common_elt)) {
644#if 0
645 cout << "The fiber does not seem to "
646 "come from a line" << endl;
647 cout << "i=" << i << " / " << l2 << endl;
648 cout << "pt=" << pt << endl;
649 cout << "fiber[0]=" << fiber[0] << endl;
650 cout << "fiber[1]=" << fiber[1] << endl;
651 cout << "lines_on_point:" << endl;
652 lines_on_point->print_table();
653 exit(1);
654#endif
655 }
656 else {
657 Fiber_recognize[w] = common_elt;
658 }
659 }
660 }
661 {
662 tally C_fiber;
663
664 C_fiber.init(Fiber_recognize, w, FALSE, 0);
665 cout << "The fiber type is : ";
666 C_fiber.print_naked(TRUE);
667 cout << endl;
668 }
669 Blown_up_lines[i] = -1;
670#endif
671
672 } // next i
673 }
674
675 if (nb_blow_up_lines != 6) {
676 cout << "nb_blow_up_lines != 6" << endl;
677 cout << "nb_blow_up_lines = " << nb_blow_up_lines << endl;
678 exit(1);
679 }
680 } // end of classify C2
681 if (f_v) {
682 cout << "clebsch_map::clebsch_map_find_arc_and_lines "
683 "done" << endl;
684 }
685}
686
687void clebsch_map::report(std::ostream &ost, int verbose_level)
688{
690
691 int h;
692
693 ost << "The half double six is no " << hds << "$ = "
696 ost << " = \\{" << endl;
697 for (h = 0; h < 6; h++) {
699 if (h < 6 - 1) {
700 ost << ", ";
701 }
702 }
703 ost << "\\}$\\\\" << endl;
704
705 ost << "line1$=" << line1 << " = " << Surf->Schlaefli->Labels->Line_label_tex[line1]
706 << "$ line2$=" << line2 << " = " << Surf->Schlaefli->Labels->Line_label_tex[line2]
707 << "$ transversal$=" << transversal << " = "
708 << Surf->Schlaefli->Labels->Line_label_tex[transversal] << "$\\\\" << endl;
709
710 ost << "transversal = " << transversal << " = $"
711 << Surf->Schlaefli->Labels->Line_label_tex[transversal] << "$\\\\" << endl;
712 ost << "plane\\_rk = $\\pi_{" << tritangent_plane_idx << "} = \\pi_{"
714 << plane_rk_global << "$\\\\" << endl;
715
716
717 ost << "The plane is:" << endl;
719
720 ost << "Clebsch map for lines $" << line1
721 << " = " << Surf->Schlaefli->Labels->Line_label_tex[line1] << ", "
722 << line2 << " = "
724 << "$\\\\" << endl;
725
726 //SOA->SO->clebsch_map_latex(fp, Clebsch_map, Clebsch_coeff);
727
728 ost << "Clebsch map for lines $" << line1
729 << " = " << Surf->Schlaefli->Labels->Line_label_tex[line1] << ", "
730 << line2 << " = " << Surf->Schlaefli->Labels->Line_label_tex[line2]
731 << "$ yields arc = $";
732 L.lint_set_print_tex(ost, Arc, 6);
733 ost << "$ : blown up lines = ";
735 ost << "\\\\" << endl;
736
738
739}
740
741
742
743}}}
744
void report(std::ostream &ost, int verbose_level)
int compute_Clebsch_map_down_worker(long int *Image_rk, int *Image_coeff, int verbose_level)
void init_half_double_six(surface_object *SO, int hds, int verbose_level)
Definition: clebsch_map.cpp:62
int choose_tritangent_plane_for_Clebsch_map(int line_a, int line_b, int transversal_line, int verbose_level)
Definition: schlaefli.cpp:1868
void print_set_of_lines_tex(std::ostream &ost, long int *v, int len)
Definition: schlaefli.cpp:2393
void prepare_clebsch_map(int ds, int ds_row, int &line1, int &line2, int &transversal, int verbose_level)
Definition: schlaefli.cpp:1643
void clebsch_map_latex(std::ostream &ost, long int *Clebsch_map, int *Clebsch_coeff)
a particular cubic surface in PG(3,q), given by its equation
int find_common_element_in_two_sets(int idx1, int idx2, int &common_elt)
a statistical analysis of data consisting of single integers
void init_lint(long int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:123
void print_set_tex(std::ostream &ost, long int *v, int len)
Definition: grassmann.cpp:157
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
int point_of_intersection_of_a_line_and_a_plane_in_three_space(long int line, int plane, int verbose_level)
void reduce_mod_subspace_and_get_coefficient_vector(int k, int len, int *basis, int *base_cols, int *v, int *coefficients, int verbose_level)
int RREF_and_kernel(int n, int k, int *A, int verbose_level)
int Gauss_simple(int *A, int m, int n, int *base_cols, int verbose_level)
void lint_set_print_tex(std::ostream &ost, long int *v, int len)
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define NEW_int(n)
Definition: foundations.h:625
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects