Orbiter 2022
Combinatorial Objects
eckardt_point_info.cpp
Go to the documentation of this file.
1// eckardt_point_info.cpp
2//
3// Anton Betten
4// October 20, 2018
5
6#include "foundations.h"
7
8using namespace std;
9
10
11namespace orbiter {
12namespace layer1_foundations {
13namespace algebraic_geometry {
14
15
16static void intersection_matrix_entry_print(int *p,
17 int m, int n, int i, int j, int val,
18 std::string &output, void *data);
19
21{
22 P2 = NULL;
23 //long int arc6[6];
24 bisecants = NULL;
25 Intersections = NULL;
26 B_pts = NULL;
27 B_pts_label = NULL;
28 nb_B_pts = 0;
29 E2 = NULL;
30 nb_E2 = 0;
31 conic_coefficients = NULL;
32 E = NULL;
33 nb_E = 0;
34}
35
36
38{
39 freeself();
40}
41
43{
44}
45
47{
48 if (bisecants) {
50 }
51 if (Intersections) {
53 }
54 if (B_pts) {
56 }
57 if (B_pts_label) {
59 }
60 if (E2) {
61 FREE_int(E2);
62 }
65 }
66
67 if (E) {
69 }
70 null();
71}
72
74 long int *arc6, int verbose_level)
75{
76 int f_v = (verbose_level >= 1);
77 int f_vv = (verbose_level >= 2);
78 int i, j, h, pi, pj, bi, bj, p;
79 int multiplicity = 6;
80 int t, f, l, s, u;
82
83 long int arc5[5];
84 int *H1; // [6]
85 int *H; // [12]
86
87
88 if (f_v) {
89 cout << "eckardt_point_info::init" << endl;
90 }
91 //eckardt_point_info::Surf = Surf;
94
95 if (P2->n != 2) {
96 cout << "eckardt_point_info::init "
97 "P->n != 2" << endl;
98 exit(1);
99 }
100
101 if (f_v) {
102 cout << "arc: ";
103 Lint_vec_print(cout, arc6, 6);
104 cout << endl;
105 }
106
107 if (f_v) {
108 cout << "eckardt_point_info::init "
109 "computing E_{ij,kl,mn}:" << endl;
110 }
111
112
113
114 // bisecants
115 bisecants = NEW_int(15);
116 h = 0;
117 for (i = 0; i < 6; i++) {
118 pi = arc6[i];
119 for (j = i + 1; j < 6; j++, h++) {
120 pj = arc6[j];
122 }
123 }
124 if (f_v) {
125 cout << "bisecants: ";
126 Int_vec_print(cout, bisecants, 15);
127 cout << endl;
128 }
129 Intersections = NEW_int(15 * 15);
130 for (i = 0; i < 15; i++) {
131 bi = bisecants[i];
132 for (j = 0; j < 15; j++) {
133 bj = bisecants[j];
134 if (i == j) {
135 p = -1;
136 }
137 else {
138 p = P2->intersection_of_two_lines(bi, bj);
139 }
140 Intersections[i * 15 + j] = p;
141 }
142 }
143 //int_matrix_print(Intersections, 15, 15);
144
145
147 C.init(Intersections, 15 * 15, FALSE, 0);
149 multiplicity, 0 /* verbose_level */);
150
151 if (f_vv) {
152 cout << "We found " << nb_B_pts << " B-pts: ";
154 cout << endl;
155 }
156
158 H1 = NEW_int(6);
159 H = NEW_int(12);
160
161 s = 0;
162 for (t = 0; t < C.nb_types; t++) {
163 f = C.type_first[t];
164 l = C.type_len[t];
165 if (l == multiplicity) {
166 if (B_pts[s] != C.data_sorted[f]) {
167 cout << "Pts[s] != C.data_sorted[f]" << endl;
168 exit(1);
169 }
170 //len = 0;
171 for (u = 0; u < l; u++) {
172 h = C.sorting_perm_inv[f + u];
173 H1[u] = h;
174 }
175
176 if (f_vv) {
177 cout << "H1=";
178 Int_vec_print(cout, H1, 6);
179 cout << endl;
180 }
181 for (u = 0; u < 6; u++) {
182 h = H1[u];
183 H[2 * u + 0] = h % 15;
184 H[2 * u + 1] = h / 15;
185 }
186 if (f_vv) {
187 cout << "H=";
188 Int_vec_print(cout, H, 12);
189 cout << endl;
190 }
191
193 int *Labels;
194 int nb_labels;
195
196 C2.init(H, 12, FALSE, 0);
198 Labels, nb_labels,
199 4 /*multiplicity*/,
200 0 /* verbose_level */);
201
202 if (f_vv) {
203 cout << "eckardt_point_info::init "
204 "We found " << nb_labels << " labels: ";
205 Int_vec_print(cout, Labels, nb_labels);
206 cout << endl;
207 }
208
209 if (nb_labels != 3) {
210 cout << "nb_labels != 3" << endl;
211 exit(1);
212 }
213 Int_vec_copy(Labels, B_pts_label + 3 * s, 3);
214
215 FREE_int(Labels);
216 s++;
217 } // if
218 } // next t
219
220 //int_matrix_print(B_pts_label, nb_B_pts, 3);
221
222 if (f_v) {
223 cout << "eckardt_point_info::init "
224 "We found " << nb_B_pts << " Eckardt points:" << endl;
225 for (s = 0; s < nb_B_pts; s++) {
226 cout << "E_{";
227 for (l = 0; l < 3; l++) {
228 h = B_pts_label[s * 3 + l];
229 Combi.k2ij(h, i, j, 6);
230 cout << i + 1 << j + 1;
231 if (l < 2) {
232 cout << ",";
233 }
234 }
235 cout << "} B-pt=" << B_pts[s] << endl;
236 }
237 }
238
239 if (f_v) {
240 cout << "computing E_ij:" << endl;
241 }
242
243
244 E2 = NEW_int(6 * 5 * 2);
246
247 for (j = 0; j < 6; j++) {
248
249 int deleted_point, rk, i1;
250 int *six_coeffs;
251 long int tangents[5];
252 int Basis[9];
253
254 six_coeffs = conic_coefficients + j * 6;
255
256 deleted_point = arc6[j];
257 Lint_vec_copy(arc6, arc5, j);
258 Lint_vec_copy(arc6 + j + 1, arc5 + j, 5 - j);
259
260#if 0
261 cout << "deleting point " << j << " / 6:";
262 int_vec_print(cout, arc5, 5);
263 cout << endl;
264#endif
265
267 six_coeffs, 0 /* verbose_level */);
268 P2->F->PG_element_normalize_from_front(six_coeffs, 1, 6);
269
270#if 0
271 cout << "coefficients of the conic: ";
272 int_vec_print(cout, six_coeffs, 6);
273 cout << endl;
274#endif
275
277 arc5, 5,
278 tangents, 0 /* verbose_level */);
279
280 for (i = 0; i < 5; i++) {
281 P2->unrank_line(Basis, tangents[i]);
282
283#if 0
284 cout << "The tangent line at " << arc5[i] << " is:" << endl;
285 int_matrix_print(Basis, 2, 3);
286#endif
287
288 P2->unrank_point(Basis + 6, deleted_point);
289 rk = P2->F->Linear_algebra->Gauss_easy(Basis, 3, 3);
290 if (rk == 2) {
291 if (i >= j) {
292 i1 = i + 1;
293 }
294 else {
295 i1 = i;
296 }
297 if (f_v) {
298 cout << "eckardt_point_info::init "
299 "Found Eckardt point E_{"
300 << i1 + 1 << j + 1 << "}" << endl;
301 }
302 E2[nb_E2 * 2 + 0] = i1;
303 E2[nb_E2 * 2 + 1] = j;
304 nb_E2++;
305 }
306 } // next i
307 } // next j
308 if (f_v) {
309 cout << "eckardt_point_info::init We found " << nb_E2
310 << " Eckardt points of the second type" << endl;
311 }
312
313 nb_E = nb_B_pts + nb_E2;
315 for (i = 0; i < nb_B_pts; i++) {
316 E[i].len = 3;
317 E[i].pt = B_pts[i];
318 Int_vec_copy(B_pts_label + i * 3, E[i].index, 3);
319 }
320 for (i = 0; i < nb_E2; i++) {
321 E[nb_B_pts + i].len = 2;
322 E[nb_B_pts + i].pt = -1;
323 E[nb_B_pts + i].index[0] = E2[i * 2 + 0];
324 E[nb_B_pts + i].index[1] = E2[i * 2 + 1];
325 E[nb_B_pts + i].index[2] = -1;
326 }
327
328
329 FREE_int(H1);
330 FREE_int(H);
331 if (f_v) {
332 cout << "eckardt_point_info::init done" << endl;
333 }
334}
335
336
337void eckardt_point_info::print_bisecants(ostream &ost, int verbose_level)
338{
339 int f_v = (verbose_level >= 1);
340 int i, j, h, a;
341 int Mtx[9];
343
344 if (f_v) {
345 cout << "eckardt_point_info::print_bisecants" << endl;
346 }
347
348
350
351
353
354 if (f_v) {
355 cout << "eckardt_point_info::print_bisecants before Poly1->init" << endl;
356 }
357 Poly1->init(P2->F,
358 3 /* nb_vars */, 1 /* degree */,
359 FALSE /* f_init_incidence_structure */,
360 t_PART,
361 verbose_level);
362 if (f_v) {
363 cout << "eckardt_point_info::print_bisecants after Poly1->init" << endl;
364 }
365
366
367 ost << "The 15 bisecants are:\\\\" << endl;
368 ost << "$$" << endl;
369 ost << "\\begin{array}{|r|r|r|r|r|}" << endl;
370 ost << "\\hline" << endl;
371 ost << "h & P_iP_j & \\mbox{rank} & \\mbox{line} "
372 "& \\mbox{equation}\\\\" << endl;
373 ost << "\\hline" << endl;
374 ost << "\\hline" << endl;
375 for (h = 0; h < 15; h++) {
376 a = bisecants[h];
377 Combi.k2ij(h, i, j, 6);
378 ost << h << " & P_{" << i + 1 << "}P_{" << j + 1
379 << "} & " << a << " & " << endl;
380 //ost << "\\left[ " << endl;
382 //ost << "\\right] ";
383
385 0 /*verbose_level */);
386 P2->F->PG_element_normalize(Mtx + 6, 1, 3);
387
388 ost << " & ";
389 Poly1->print_equation(ost, Mtx + 6); // ToDo
390 ost << "\\\\" << endl;
391 }
392 ost << "\\hline" << endl;
393 ost << "\\end{array}" << endl;
394 ost << "$$" << endl;
395
396 FREE_OBJECT(Poly1);
397
398 if (f_v) {
399 cout << "eckardt_point_info::print_bisecants done" << endl;
400 }
401}
402
403void eckardt_point_info::print_intersections(ostream &ost, int verbose_level)
404{
405 int f_v = (verbose_level >= 1);
407 int labels[15];
408 int fst[1];
409 int len[1];
410 fst[0] = 0;
411 len[0] = 15;
412 int i;
413
414 if (f_v) {
415 cout << "eckardt_point_info::print_intersections" << endl;
416 }
417 ost << "The intersections of bisecants are:\\\\" << endl;
418 for (i = 0; i < 15; i++) {
419 labels[i] = i;
420 }
421 ost << "{\\small \\arraycolsep=1pt" << endl;
422 ost << "$$" << endl;
424 Intersections, 15, 15,
425 labels, labels,
426 fst, len, 1,
427 fst, len, 1,
428 intersection_matrix_entry_print, (void *) this,
429 TRUE /* f_tex */);
430 ost << "$$}" << endl;
431 if (f_v) {
432 cout << "eckardt_point_info::print_intersections done" << endl;
433 }
434}
435
436void eckardt_point_info::print_conics(ostream &ost, int verbose_level)
437{
438 int f_v = (verbose_level >= 1);
439 int h;
441
442 if (f_v) {
443 cout << "eckardt_point_info::print_conics" << endl;
444 }
445
446
448
449 if (f_v) {
450 cout << "eckardt_point_info::print_conics before Poly2->init" << endl;
451 }
452 Poly2->init(P2->F,
453 3 /* nb_vars */, 2 /* degree */,
454 FALSE /* f_init_incidence_structure */,
455 t_PART,
456 verbose_level);
457 if (f_v) {
458 cout << "eckardt_point_info::print_conics after Poly2->init" << endl;
459 }
460
461
462
463 ost << "The 6 conics are:\\\\" << endl;
464 ost << "$$" << endl;
465 ost << "\\begin{array}{|r|r|r|}" << endl;
466 ost << "\\hline" << endl;
467 ost << "i & C_i & \\mbox{equation}\\\\" << endl;
468 ost << "\\hline" << endl;
469 ost << "\\hline" << endl;
470 for (h = 0; h < 6; h++) {
471 ost << h + 1 << " & C_" << h + 1 << " & " << endl;
472
473 Poly2->print_equation(ost,
474 conic_coefficients + h * 6);
475
476 ost << "\\\\" << endl;
477 }
478 ost << "\\hline" << endl;
479 ost << "\\end{array}" << endl;
480 ost << "$$" << endl;
481
482
483 FREE_OBJECT(Poly2);
484
485 if (f_v) {
486 cout << "eckardt_point_info::print_conics done" << endl;
487 }
488}
489
490void eckardt_point_info::print_Eckardt_points(ostream &ost, int verbose_level)
491{
492 int f_v = (verbose_level >= 1);
493 int s;
494
495 if (f_v) {
496 cout << "eckardt_point_info::print_Eckardt_points" << endl;
497 }
498 ost << "We found " << nb_E << " Eckardt points:\\\\" << endl;
499 for (s = 0; s < nb_E; s++) {
500 ost << s << " / " << nb_E << " : $";
501 E[s].latex(ost);
502 ost << "= E_{" << E[s].rank() << "}$\\\\" << endl;
503 }
504 //ost << "by rank: ";
505 //int_vec_print(ost, E_idx, nb_E);
506 //ost << "\\\\" << endl;
507 if (f_v) {
508 cout << "eckardt_point_info::print_Eckardt_points done" << endl;
509 }
510}
511
512
513static void intersection_matrix_entry_print(int *p,
514 int m, int n, int i, int j, int val,
515 std::string &output, void *data)
516{
517 //eckardt_point_info *E;
518 //E = (eckardt_point_info *) data;
519 int a, b;
521 char str[1000];
522
523 if (i == -1) {
524 Combi.k2ij(j, a, b, 6);
525 sprintf(str, "P_%dP_%d", a + 1, b + 1);
526 }
527 else if (j == -1) {
528 Combi.k2ij(i, a, b, 6);
529 sprintf(str, "P_%dP_%d", a + 1, b + 1);
530 }
531 else {
532 if (val == -1) {
533 sprintf(str, ".");
534 }
535 else {
536 sprintf(str, "%d", val);
537 }
538 }
539 output.assign(str);
540}
541
542
543
544}}}
545
546
547
void init(geometry::projective_space *P2, long int *arc6, int verbose_level)
Eckardt point on a cubic surface using the Schlaefli labeling.
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:72
void get_data_by_multiplicity(int *&Pts, int &nb_pts, int multiplicity, int verbose_level)
Definition: tally.cpp:557
void unrank_lint_here_and_compute_perp(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:979
void print_single_generator_matrix_tex(std::ostream &ost, long int a)
Definition: grassmann.cpp:122
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
int determine_conic_in_plane(long int *input_pts, int nb_pts, int *six_coeffs, int verbose_level)
void find_tangent_lines_to_conic(int *six_coeffs, long int *points, int nb_points, long int *tangents, int verbose_level)
long int line_through_two_points(long int p1, long int p2)
void int_matrix_print_with_labels_and_partition(std::ostream &ost, int *p, int m, int n, int *row_labels, int *col_labels, int *row_part_first, int *row_part_len, int nb_row_parts, int *col_part_first, int *col_part_len, int nb_col_parts, void(*process_function_or_NULL)(int *p, int m, int n, int i, int j, int val, std::string &output, void *data), void *data, int f_tex)
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)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define FREE_OBJECTS(p)
Definition: foundations.h:652
#define FREE_int(p)
Definition: foundations.h:640
#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 NEW_OBJECTS(type, n)
Definition: foundations.h:639
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects