Orbiter 2022
Combinatorial Objects
surface_domain_io.cpp
Go to the documentation of this file.
1// surface_domain_io.cpp
2//
3// Anton Betten
4//
5// moved here from surface.cpp: Dec 26, 2018
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
22void surface_domain::print_equation(std::ostream &ost, int *coeffs)
23{
24 Poly3_4->print_equation(ost, coeffs);
25}
26
27void surface_domain::print_equation_maple(std::stringstream &ost, int *coeffs)
28{
29 Poly3_4->print_equation_str(ost, coeffs);
30}
31
32
33void surface_domain::print_equation_tex(std::ostream &ost, int *coeffs)
34{
35 Poly3_4->print_equation_tex(ost, coeffs);
36}
37
38void surface_domain::print_equation_with_line_breaks_tex(std::ostream &ost, int *coeffs)
39{
40 ost << "{\\renewcommand{\\arraystretch}{1.5}" << endl;
41 ost << "$$" << endl;
42 ost << "\\begin{array}{c}" << endl;
44 ost, coeffs, 10 /* nb_terms_per_line*/,
45 "\\\\\n" /* const char *new_line_text*/);
46 ost << "=0" << endl;
47 ost << "\\end{array}" << endl;
48 ost << "$$}" << endl;
49}
50
51void surface_domain::print_equation_tex_lint(std::ostream &ost, long int *coeffs)
52{
53 Poly3_4->print_equation_lint_tex(ost, coeffs);
54}
55
56void surface_domain::latex_double_six(std::ostream &ost, long int *double_six)
57{
58
59#if 0
60 long int i, j, a, u, v;
61
62 ost << "\\begin{array}{cc}" << endl;
63 for (i = 0; i < 6; i++) {
64 for (j = 0; j < 2; j++) {
65 a = double_six[j * 6 + i];
66 Gr->unrank_lint(a, 0);
67
68 ost << Schlaefli->Labels->Line_label[i + j * 6];
69 ost << " = ";
70 ost << "\\left[" << endl;
71 ost << "\\begin{array}{*{4}{c}}" << endl;
72 for (u = 0; u < 2; u++) {
73 for (v = 0; v < 4; v++) {
74 ost << Gr->M[u * 4 + v];
75 if (v < 4 - 1) {
76 ost << ", ";
77 }
78 }
79 ost << "\\\\" << endl;
80 }
81 ost << "\\end{array}" << endl;
82 ost << "\\right]_{" << a << "}" << endl;
83
84 if (j < 2 - 1) {
85 ost << ", " << endl;
86 }
87 }
88 ost << "\\\\" << endl;
89 }
90 ost << "\\end{array}" << endl;
91#else
92
93 print_lines_tex(ost, double_six, 12 /* nb_lines */);
94
95#endif
96}
97
100 long int *Wedge_rk, long int *Line_rk, long int *Klein_rk, int nb_lines,
101 int verbose_level)
102{
103 int f_v = (verbose_level >= 1);
104 long int i, a;
105 char str[1000];
106 int w[6];
107 int Basis[8];
108 char **Text_wedge;
109 char **Text_line;
110 char **Text_klein;
111
112 if (f_v) {
113 cout << "surface_domain::make_spreadsheet_of_lines_in_three_kinds" << endl;
114 }
115
116 Text_wedge = NEW_pchar(nb_lines);
117 Text_line = NEW_pchar(nb_lines);
118 Text_klein = NEW_pchar(nb_lines);
119
120 for (i = 0; i < nb_lines; i++) {
121 a = Wedge_rk[i];
122 F->PG_element_unrank_modified_lint(w, 1, 6 /*wedge_dimension*/, a);
123 Int_vec_print_to_str(str, w, 6);
124 Text_wedge[i] = NEW_char(strlen(str) + 1);
125 strcpy(Text_wedge[i], str);
126 }
127 for (i = 0; i < nb_lines; i++) {
128 a = Line_rk[i];
129 Gr->unrank_lint_here(Basis, a, 0 /* verbose_level */);
130 Int_vec_print_to_str(str, Basis, 8);
131 Text_line[i] = NEW_char(strlen(str) + 1);
132 strcpy(Text_line[i], str);
133 }
134 for (i = 0; i < nb_lines; i++) {
135 a = Klein_rk[i];
136 O->unrank_point(w, 1, a, 0 /* verbose_level*/);
137 // error corrected: w was v which was v[4], so too short.
138 // Aug 25, 2018
139 Int_vec_print_to_str(str, w, 6);
140 // w was v, error corrected
141 Text_klein[i] = NEW_char(strlen(str) + 1);
142 strcpy(Text_klein[i], str);
143 }
144
146 Sp->init_empty_table(nb_lines + 1, 7);
147 Sp->fill_column_with_row_index(0, "Idx");
148 Sp->fill_column_with_lint(1, Wedge_rk, "Wedge_rk");
150 (const char **) Text_wedge, "Wedge coords");
151 Sp->fill_column_with_lint(3, Line_rk, "Line_rk");
153 (const char **) Text_line, "Line basis");
154 Sp->fill_column_with_lint(5, Klein_rk, "Klein_rk");
156 (const char **) Text_klein, "Klein coords");
157
158 for (i = 0; i < nb_lines; i++) {
159 FREE_char(Text_wedge[i]);
160 }
161 FREE_pchar(Text_wedge);
162 for (i = 0; i < nb_lines; i++) {
163 FREE_char(Text_line[i]);
164 }
165 FREE_pchar(Text_line);
166 for (i = 0; i < nb_lines; i++) {
167 FREE_char(Text_klein[i]);
168 }
169 FREE_pchar(Text_klein);
170
171
172 if (f_v) {
173 cout << "surface_domain::make_spreadsheet_of_lines_"
174 "in_three_kinds done" << endl;
175 }
176}
177
178
179
180#if 0
181void surface_domain::print_web_of_cubic_curves(ostream &ost,
182 int *Web_of_cubic_curves)
183// curves[45 * 10]
184{
185 latex_interface L;
186
187 ost << "Web of cubic curves:\\\\" << endl;
188 ost << "$$" << endl;
189 L.print_integer_matrix_with_standard_labels(ost,
190 Web_of_cubic_curves, 45, 10, TRUE /* f_tex*/);
191 ost << "$$" << endl;
192}
193#endif
194
196 int *the_six_plane_equations, int lambda, int *the_equation)
197{
198 ost << "\\begin{align*}" << endl;
199 ost << "0 & = F_0F_1F_2 + \\lambda G_0G_1G_2\\\\" << endl;
200 ost << "& = " << endl;
201 ost << "\\Big(";
202 Poly1_4->print_equation(ost, the_six_plane_equations + 0 * 4);
203 ost << "\\Big)";
204 ost << "\\Big(";
205 Poly1_4->print_equation(ost, the_six_plane_equations + 1 * 4);
206 ost << "\\Big)";
207 ost << "\\Big(";
208 Poly1_4->print_equation(ost, the_six_plane_equations + 2 * 4);
209 ost << "\\Big)";
210 ost << "+ " << lambda;
211 ost << "\\Big(";
212 Poly1_4->print_equation(ost, the_six_plane_equations + 3 * 4);
213 ost << "\\Big)";
214 ost << "\\Big(";
215 Poly1_4->print_equation(ost, the_six_plane_equations + 4 * 4);
216 ost << "\\Big)";
217 ost << "\\Big(";
218 Poly1_4->print_equation(ost, the_six_plane_equations + 5 * 4);
219 ost << "\\Big)\\\\";
220 ost << "& \\equiv " << endl;
221 Poly3_4->print_equation(ost, the_equation);
222 ost << "\\\\";
223 ost << "\\end{align*}" << endl;
224}
225
226void surface_domain::print_equation_wrapped(std::ostream &ost, int *the_equation)
227{
228 ost << "\\begin{align*}" << endl;
229 ost << "0 & = " << endl;
230 Poly3_4->print_equation(ost, the_equation);
231 ost << "\\\\";
232 ost << "\\end{align*}" << endl;
233}
234
235void surface_domain::print_lines_tex(std::ostream &ost, long int *Lines, int nb_lines)
236{
237 int i;
239 long int *Rk;
240 int vv[6];
241
242 Rk = NEW_lint(nb_lines);
243
244 ost << "The lines and their Pluecker coordinates are:\\\\" << endl;
245
246 for (i = 0; i < nb_lines; i++) {
247 //fp << "Line " << i << " is " << v[i] << ":\\\\" << endl;
248 Gr->unrank_lint(Lines[i], 0 /*verbose_level*/);
249 ost << "$$" << endl;
250 ost << "\\ell_{" << i << "}";
251
252 if (nb_lines == 27) {
253 ost << " = " << Schlaefli->Labels->Line_label_tex[i];
254 }
255 ost << " = " << endl;
256 //print_integer_matrix_width(cout,
257 // Gr->M, k, n, n, F->log10_of_q + 1);
258 Gr->latex_matrix(ost, Gr->M);
259 //print_integer_matrix_tex(ost, Gr->M, 2, 4);
260 //ost << "\\right]_{" << Lines[i] << "}" << endl;
261 ost << "_{" << Lines[i] << "}" << endl;
262 ost << "=" << endl;
263 ost << "\\left[" << endl;
264 L.print_integer_matrix_tex(ost, Gr->M, 2, 4);
265 ost << "\\right]_{" << Lines[i] << "}" << endl;
266
267 int v6[6];
268
269 P->Pluecker_coordinates(Lines[i], v6, 0 /* verbose_level */);
270
271 Int_vec_copy(v6, vv, 6); // mistake found by Alice Hui
272
273 Rk[i] = F->Orthogonal_indexing->Qplus_rank(vv, 1, 5, 0 /* verbose_level*/);
274
275 ost << "={\\rm\\bf Pl}(" << v6[0] << "," << v6[1] << ","
276 << v6[2] << "," << v6[3] << "," << v6[4]
277 << "," << v6[5] << " ";
278 ost << ")_{" << Rk[i] << "}";
279 ost << "$$" << endl;
280 }
281 ost << "Rank of lines: ";
282 Lint_vec_print(ost, Lines, nb_lines);
283 ost << "\\\\" << endl;
284 ost << "Rank of points on Klein quadric: ";
285 Lint_vec_print(ost, Rk, nb_lines);
286 ost << "\\\\" << endl;
287
288 //alice(ost, Lines, nb_lines);
289
290 FREE_lint(Rk);
291
292}
293
294
295void surface_domain::alice(std::ostream &ost, long int *Lines, int nb_lines)
296{
297 int Pa6[6];
298 int Pb6[6];
299 int Pa2[6];
300 int P_line[6];
301 int tmp[6];
302 long int rk_a6;
303 long int rk_b6;
304 int h;
305
306 P->Pluecker_coordinates(Lines[5], Pa6, 0 /* verbose_level */);
307 P->Pluecker_coordinates(Lines[11], Pb6, 0 /* verbose_level */);
308 P->Pluecker_coordinates(Lines[1], Pa2, 0 /* verbose_level */);
309
310 Int_vec_copy(Pa6, tmp, 6);
311 rk_a6 = F->Orthogonal_indexing->Qplus_rank(tmp, 1, 5, 0 /* verbose_level*/);
312
313 Int_vec_copy(Pb6, tmp, 6);
314 rk_b6 = F->Orthogonal_indexing->Qplus_rank(tmp, 1, 5, 0 /* verbose_level*/);
315
316 if (rk_a6 != 1) {
317 return;
318 }
319 if (rk_b6 != 0) {
320 return;
321 }
322 Int_vec_copy(Pa2, tmp, 6);
323 if (Pa2[2] || Pa2[3] || Pa2[4]) {
324 return;
325 }
326
327 int v[3];
328 long int rk;
329
330 ost << "\\section*{Projected points:}" << endl;
331 for (h = 0; h < 27; h++) {
332 if (h == 5 || h == 11 || h == 1) {
333 continue;
334 }
335
336 P->Pluecker_coordinates(Lines[h], P_line, 0 /* verbose_level */);
337 Int_vec_copy(P_line + 2, v, 3);
338
339 rk = P2->rank_point(v);
340
341
342 ost << "$" << Schlaefli->Labels->Line_label_tex[h];
343 ost << " = ";
344 Int_vec_print(ost, v, 3);
345 ost << "_{";
346 ost << rk;
347 ost << "}$\\\\" << endl;
348
349
350 }
351 for (h = 0; h < 27; h++) {
352 if (h == 5 || h == 11 || h == 1) {
353 continue;
354 }
355 P->Pluecker_coordinates(Lines[h], P_line, 0 /* verbose_level */);
356 Int_vec_copy(P_line + 2, v, 3);
357
358 rk = P2->rank_point(v);
359 ost << rk << ",";
360 }
361 ost << "\\\\" << endl;
362
363
364}
365
366
368{
369 int h, i, f_first;
370
372 cout << "surface_domain::print_clebsch_P f_has_large_polynomial_"
373 "domains is FALSE" << endl;
374 //exit(1);
375 return;
376 }
377 ost << "\\clearpage" << endl;
378 ost << "\\subsection*{The Clebsch system $P$}" << endl;
379
380 ost << "$$" << endl;
382 ost << "\\cdot \\left[" << endl;
383 ost << "\\begin{array}{c}" << endl;
384 ost << "x_0\\\\" << endl;
385 ost << "x_1\\\\" << endl;
386 ost << "x_2\\\\" << endl;
387 ost << "x_3\\\\" << endl;
388 ost << "\\end{array}" << endl;
389 ost << "\\right]" << endl;
390 ost << "= \\left[" << endl;
391 ost << "\\begin{array}{c}" << endl;
392 ost << "0\\\\" << endl;
393 ost << "0\\\\" << endl;
394 ost << "0\\\\" << endl;
395 ost << "\\end{array}" << endl;
396 ost << "\\right]" << endl;
397 ost << "$$" << endl;
398
399
400 ost << "\\begin{align*}" << endl;
401 for (h = 0; h < 4; h++) {
402 ost << "x_" << h << " &= C_" << h
403 << "(y_0,y_1,y_2)=\\\\" << endl;
404 f_first = TRUE;
405 for (i = 0; i < Poly3->get_nb_monomials(); i++) {
406
407 if (Poly3_24->is_zero(CC[h * Poly3->get_nb_monomials() + i])) {
408 continue;
409 }
410 ost << "&";
411
412 if (f_first) {
413 f_first = FALSE;
414 }
415 else {
416 ost << "+";
417 }
418 ost << "\\Big(";
420 ost, CC[h * Poly3->get_nb_monomials() + i],
421 6, "\\\\\n&");
422 ost << "\\Big)" << endl;
423
424 ost << "\\cdot" << endl;
425
426 Poly3->print_monomial(ost, i);
427 ost << "\\\\" << endl;
428 }
429 }
430 ost << "\\end{align*}" << endl;
431}
432
434{
435 int i, j;
436
438 cout << "surface::print_clebsch_P_matrix_only "
439 "f_has_large_polynomial_domains is FALSE" << endl;
440 exit(1);
441 }
442 ost << "\\left[" << endl;
443 ost << "\\begin{array}{cccc}" << endl;
444 for (i = 0; i < 3; i++) {
445 for (j = 0; j < 4; j++) {
446 //cout << "Clebsch_P_" << i << "," << j << ":";
447 Poly2_27->print_equation(ost, Clebsch_P[i * 4 + j]);
448 if (j < 4 - 1) {
449 ost << " & ";
450 }
451 }
452 ost << "\\\\" << endl;
453 }
454 ost << "\\end{array}" << endl;
455 ost << "\\right]" << endl;
456}
457
459{
460 int i, h;
461
463 cout << "surface_domain::print_clebsch_cubics "
464 "f_has_large_polynomial_domains is FALSE" << endl;
465 exit(1);
466 }
467 ost << "The Clebsch coefficients are:" << endl;
468 for (h = 0; h < 4; h++) {
469 ost << "C[" << h << "]:" << endl;
470 for (i = 0; i < Poly3->get_nb_monomials(); i++) {
471
472 if (Poly3_24->is_zero(CC[h * Poly3->get_nb_monomials() + i])) {
473 continue;
474 }
475
476 Poly3->print_monomial(ost, i);
477 ost << " \\cdot \\Big(";
479 ost << "\\Big)" << endl;
480 }
481 }
482}
483
484void surface_domain::print_system(ostream &ost, int *system)
485{
486 int i, j;
487
488 //ost << "The system:\\\\";
489 ost << "$$" << endl;
490 ost << "\\left[" << endl;
491 ost << "\\begin{array}{cccc}" << endl;
492 for (i = 0; i < 3; i++) {
493 for (j = 0; j < 4; j++) {
494 int *p = system + (i * 4 + j) * 3;
495 Poly1->print_equation(ost, p);
496 if (j < 4 - 1) {
497 ost << " & ";
498 }
499 }
500 ost << "\\\\" << endl;
501 }
502 ost << "\\end{array}" << endl;
503 ost << "\\right]" << endl;
504 ost << "\\cdot \\left[" << endl;
505 ost << "\\begin{array}{c}" << endl;
506 ost << "x_0\\\\" << endl;
507 ost << "x_1\\\\" << endl;
508 ost << "x_2\\\\" << endl;
509 ost << "x_3\\\\" << endl;
510 ost << "\\end{array}" << endl;
511 ost << "\\right]" << endl;
512 ost << "= \\left[" << endl;
513 ost << "\\begin{array}{c}" << endl;
514 ost << "0\\\\" << endl;
515 ost << "0\\\\" << endl;
516 ost << "0\\\\" << endl;
517 ost << "\\end{array}" << endl;
518 ost << "\\right]" << endl;
519 ost << "$$" << endl;
520}
521
523 long int *F_planes_rank, long int *G_planes_rank)
524{
525 int i;
526 int F_planes[12];
527 int G_planes[12];
528
529 for (i = 0; i < 3; i++) {
530 P->unrank_point(F_planes + i * 4, F_planes_rank[i]);
531 }
532 for (i = 0; i < 3; i++) {
533 P->unrank_point(G_planes + i * 4, G_planes_rank[i]);
534 }
535 cout << "[";
536 for (i = 0; i < 3; i++) {
537 Int_vec_print_GAP(cout, F_planes + i * 4, 4);
538 cout << ", ";
539 }
540 for (i = 0; i < 3; i++) {
541 Int_vec_print_GAP(cout, G_planes + i * 4, 4);
542 if (i < 3 - 1) {
543 cout << ", ";
544 }
545 }
546 cout << "];";
547}
548
550{
553
554
555 cout << "surface_domain::print_basics "
556 "before print_Steiner_and_Eckardt" << endl;
558 cout << "surface_domain::print_basics "
559 "after print_Steiner_and_Eckardt" << endl;
560
561 cout << "surface_domain::print_basics "
562 "before print_clebsch_P" << endl;
563 print_clebsch_P(ost);
564 cout << "surface_domain::print_basics "
565 "after print_clebsch_P" << endl;
566
567}
568
569
571{
572 ost << "The polynomial domain Poly3\\_4 is:" << endl;
574
575 ost << "The polynomial domain Poly1\\_x123 is:" << endl;
577
578 ost << "The polynomial domain Poly2\\_x123 is:" << endl;
580
581 ost << "The polynomial domain Poly3\\_x123 is:" << endl;
583
584 ost << "The polynomial domain Poly4\\_x123 is:" << endl;
586
587}
588
589
590
591void surface_domain::sstr_line_label(stringstream &sstr, long int pt)
592{
593 if (pt >= 27) {
594 cout << "surface_domain::sstr_line_label pt >= 27, pt=" << pt << endl;
595 exit(1);
596 }
597 if (pt < 0) {
598 cout << "surface_domain::sstr_line_label pt < 0, pt=" << pt << endl;
599 exit(1);
600 }
601 sstr << Schlaefli->Labels->Line_label_tex[pt];
602}
603
604
606{
607
608
609 //int f_v = (verbose_level >= 1);
610
611
612 char fname[1000];
613 char title[1000];
614 const char *author = "Orbiter";
615 const char *extras_for_preamble = "";
616
617 sprintf(fname, "surfaces_report.tex");
618 sprintf(title, "Cubic Surfaces with 27 Lines over Finite Fields");
619
620 {
621 ofstream fp(fname);
623 //latex_head_easy(fp);
624 L.head(fp,
625 FALSE /* f_book */, TRUE /* f_title */,
626 title, author,
627 FALSE /*f_toc*/, FALSE /* f_landscape*/, FALSE /* f_12pt*/,
628 TRUE /*f_enlarged_page*/, TRUE /* f_pagenumbers*/,
629 extras_for_preamble);
630
631
632 {
633 int Q[] = {
634 4,7,8,9,11,13,16,17,19,23,25,27,29,31,32,37,
635 41,43,47,49,53,59,61,64,67,71,73,79,81,83, 89, 97, 101, 103, 107, 109, 113, 121, 128
636 };
637 int nb_Q = sizeof(Q) / sizeof(int);
638
639 fp << "\\section*{Cubic Surfaces}" << endl;
640
641 make_table_of_surfaces2(fp, Q, nb_Q, verbose_level);
642 }
643
644 fp << endl;
645
646#if 0
647 fp << "\\clearpage" << endl;
648
649 fp << endl;
650
651
652 {
653 int Q_even[] = {
654 4,8,16,32,64,128
655 };
656 int nb_Q_even = 6;
657
658 fp << "\\section*{Even Characteristic}" << endl;
659
660 make_table_of_surfaces2(fp, Q_even, nb_Q_even, verbose_level);
661 }
662
663 fp << endl;
664
665 fp << "\\clearpage" << endl;
666
667 fp << endl;
668
669
670 {
671 int Q_odd[] = {
672 7,9,11,13,17,19,23,25,27,29,31,37,
673 41,43,47,49,53,59,61,67,71,73,79,81,83, 89, 97, 101, 103, 107, 109, 113, 121
674 };
675 int nb_Q_odd = sizeof(Q_odd) / sizeof(int);
676
677
678 fp << "\\section*{Odd Characteristic}" << endl;
679
680 make_table_of_surfaces2(fp, Q_odd, nb_Q_odd, verbose_level);
681 }
682#endif
683
684 L.foot(fp);
685 }
686
687}
688
689
691 int *Q_table, int Q_table_len, int verbose_level)
692{
693 int i, j, q, cur, nb_E;
694 int nb_reps_total;
695 int *Nb_reps;
697 long int *Big_table;
699
700 Nb_reps = NEW_int(Q_table_len);
701
702 nb_reps_total = 0;
703 for (i = 0; i < Q_table_len; i++) {
704 q = Q_table[i];
705 Nb_reps[i] = K.cubic_surface_nb_reps(q);
706 nb_reps_total += Nb_reps[i];
707 }
708 Big_table = NEW_lint(nb_reps_total * 4);
709
710 cur = 0;
711 for (i = 0; i < Q_table_len; i++) {
712 q = Q_table[i];
713 for (j = 0; j < Nb_reps[i]; j++, cur++) {
715 Big_table[cur * 4 + 0] = q;
716 Big_table[cur * 4 + 1] = nb_E;
717 Big_table[cur * 4 + 2] = j;
718
719 int *data;
720 int nb_gens;
721 int data_size;
722 string stab_order;
723 long int ago;
725
726 K.cubic_surface_stab_gens(q, j, data, nb_gens, data_size, stab_order);
727 ago = ST.strtolint(stab_order);
728
729 Big_table[cur * 4 + 3] = ago;
730 }
731 }
732 std::string fname;
733
734 fname.assign("table_of_cubic_surfaces_QECA.csv");
735
736 std::string *headers;
737
738 headers = new string[4];
739
740
741 headers[0].assign("Q");
742 headers[1].assign("E");
743 headers[2].assign("OCN");
744 headers[3].assign("AUT");
745
746
747 Fio.lint_matrix_write_csv_override_headers(fname, headers, Big_table, nb_reps_total, 4);
748
749 FREE_lint(Big_table);
750}
751
753 int *Q_table, int Q_table_len, int verbose_level)
754{
755#if 0
756 int Q_table[] = {
757 4,7,8,9,11,13,16,17,19,23,25,27,29,31,32,37,
758 41,43,47,49,53,59,61,64,67,71,73,79,81,83, 89, 97};
759 int Q_table[] = {
760 4,8,16,32,64,128
761 };
762#endif
763 //int Q_table_len = sizeof(Q_table) / sizeof(int);
764 int q, nb_reps;
765 int i, j, nb_E;
766 int *data;
767 int nb_gens;
768 int data_size;
771
772
773 for (i = 0; i < Q_table_len; i++) {
774 q = Q_table[i];
775 nb_reps = K.cubic_surface_nb_reps(q);
776 cout << q << " : " << nb_reps << "\\\\" << endl;
777 }
778
779#if 0
780 const char *fname_ago = "ago.csv";
781 {
782 ofstream f(fname_ago);
783
784 f << "q,j,nb_E,stab_order" << endl;
785 for (i = 0; i < Q_table_len; i++) {
786 q = Q_table[i];
787 nb_reps = K.cubic_surface_nb_reps(q);
788 for (j = 0; j < nb_reps; j++) {
791 data, nb_gens, data_size, stab_order);
792 f << q << "," << j << ", " << nb_E << ", "
793 << stab_order << endl;
794 }
795 }
796 f << "END" << endl;
797 }
798 cout << "Written file " << fname_ago << " of size "
799 << Fio.file_size(fname_ago) << endl;
800
801 const char *fname_dist = "ago_dist.csv";
802 {
803 ofstream f(fname_dist);
804 int *Ago;
805
806 f << "q,ago" << endl;
807 for (i = 0; i < Q_table_len; i++) {
808 q = Q_table[i];
809 nb_reps = K.cubic_surface_nb_reps(q);
810 Ago = NEW_int(nb_reps);
811 for (j = 0; j < nb_reps; j++) {
813 K.cubic_surface_stab_gens(q, j, data,
814 nb_gens, data_size, stab_order);
815 sscanf(stab_order, "%d", &Ago[j]);
816 //f << q << "," << j << ", " << nb_E << ", " << stab_order << endl;
817 }
818 tally C;
819
820 C.init(Ago, nb_reps, FALSE, 0);
821 f << q << ", ";
822 C.print_naked_tex(f, TRUE /* f_backwards*/);
823 f << endl;
824
825 FREE_int(Ago);
826 }
827 f << "END" << endl;
828 }
829 cout << "Written file " << fname_dist << " of size "
830 << Fio.file_size(fname_dist) << endl;
831#endif
832
833 long int *Table;
834 long int *Table2;
835 int *Q;
836 int nb_Q;
837 int *E;
838 int nb_E_types;
839
840 compute_table_E(Q_table, Q_table_len,
841 Table, Q, nb_Q, E, nb_E_types, verbose_level);
842
843 Table2 = NEW_lint(nb_Q * nb_E_types + 1);
844 for (i = 0; i < nb_Q; i++) {
845 Table2[i * (nb_E_types + 1) + 0] = Q[i];
846 for (j = 0; j < nb_reps; j++) {
847 Table2[i * (nb_E_types + 1) + 1 + j] = Table[i * nb_E_types + j];
848 }
849 }
850
851 //file_io Fio;
852 std::string fname;
853
854 fname.assign("table_of_cubic_surfaces_QE.csv");
855
856 std::string *headers;
857
858 headers = new string[nb_E_types + 1];
859
860
861 headers[0].assign("Q");
862 for (j = 0; j < nb_E_types; j++) {
863 char str[1000];
864
865 sprintf(str, "E%d", E[j]);
866 headers[1 + j].assign(str);
867 }
868
869
870 Fio.lint_matrix_write_csv_override_headers(fname, headers, Table2, nb_Q, nb_E_types + 1);
871 FREE_lint(Table2);
872
873 //LG->report(fp, f_sylow, f_group_table, verbose_level);
874
875
876
877 int Nb_total = 0;
878
879 ost << "$$" << endl;
880 ost << "\\begin{array}{|r||r||*{" << nb_E_types << "}{r|}}" << endl;
881 ost << "\\hline" << endl;
882 ost << "q & \\mbox{total} ";
883 for (j = 0; j < nb_E_types; j++) {
884 ost << " & " << E[j];
885 }
886 ost << "\\\\" << endl;
887 ost << "\\hline" << endl;
888 ost << "\\hline" << endl;
889 for (i = 0; i < nb_Q; i++) {
890 q = Q[i];
891 ost << q;
892 nb_reps = K.cubic_surface_nb_reps(q);
893 Nb_total += nb_reps;
894 ost << " & ";
895 ost << nb_reps;
896 for (j = 0; j < nb_E_types; j++) {
897 ost << " & " << Table[i * nb_E_types + j];
898 }
899 ost << "\\\\" << endl;
900 ost << "\\hline" << endl;
901 }
902 //cout << "\\hline" << endl;
903 ost << "\\end{array}" << endl;
904 ost << "$$" << endl;
905
906 ost << "Total: " << Nb_total << endl;
907
908
909
910
911
912 ost << "\\bigskip" << endl;
913
914 for (j = 0; j < nb_E_types; j++) {
915 ost << "\\section*{" << E[j] << " Eckardt Points}" << endl;
916
917 Nb_total = 0;
918
919 ost << "$$" << endl;
920 ost << "\\begin{array}{|r|r|p{8cm}|}" << endl;
921 ost << "\\hline" << endl;
922 ost << "q & \\mbox{total} & \\mbox{Ago} \\\\" << endl;
923 ost << "\\hline" << endl;
924 ost << "\\hline" << endl;
925
926 for (i = 0; i < nb_Q; i++) {
927 q = Q[i];
928 nb_reps = Table[i * nb_E_types + j];
929 Nb_total += nb_reps;
930 if (nb_reps) {
931
932 int *Ago;
933 int go;
934 int h, u, nb_total;
936
937 nb_total = K.cubic_surface_nb_reps(q);
938 Ago = NEW_int(nb_reps);
939 u = 0;
940 for (h = 0; h < nb_total; h++) {
942 if (nb_E != E[j]) {
943 continue;
944 }
945 string stab_order;
946
947 K.cubic_surface_stab_gens(q, h, data,
948 nb_gens, data_size, stab_order);
949
950 go = ST.strtolint(stab_order);
951 Ago[u++] = go;
952 }
953
954 if (u != nb_reps) {
955 cout << "u != nb_reps" << endl;
956 exit(1);
957 }
959
960 C.init(Ago, nb_reps, FALSE, 0);
961 ost << q << " & " << nb_reps << " & ";
962 ost << "$";
963 C.print_naked_tex(ost, TRUE /* f_backwards*/);
964 ost << "$\\\\" << endl;
965
966 FREE_int(Ago);
967
968
969
970 ost << "\\hline" << endl;
971 }
972 }
973
974
975 ost << "\\end{array}" << endl;
976 ost << "$$" << endl;
977
978 ost << "Total: " << Nb_total << endl;
979
980
981 ost << "\\bigskip" << endl;
982
983
984 } // next j
985
986#if 0
987 table_top(ost);
988
989 h = 0;
990 for (i = 0; i < Q_table_len; i++) {
991 q = Q_table[i];
992 nb_reps = K.cubic_surface_nb_reps(q);
993
994
995
996
997 for (j = 0; j < nb_reps; j++, h++) {
998
999 int *data;
1000 int nb_gens;
1001 int data_size;
1002 const char *stab_order;
1003
1006 data, nb_gens, data_size, stab_order);
1007 ost << q << " & " << j << " & " << stab_order
1008 << " & " << nb_E << " & \\\\" << endl;
1009 if ((h + 1) % 30 == 0) {
1010 table_bottom(ost);
1011 if ((h + 1) % 60 == 0) {
1012 ost << endl;
1013 ost << "\\bigskip" << endl;
1014 ost << endl;
1015 }
1016 table_top(ost);
1017 }
1018 }
1019 ost << "\\hline" << endl;
1020 }
1021 table_bottom(ost);
1022#endif
1023
1024 FREE_lint(Table);
1025 FREE_int(Q);
1026 FREE_int(E);
1027
1028
1029 make_table_of_surfaces_detailed(Q_table, Q_table_len, verbose_level);
1030
1031
1032}
1033
1034void surface_domain::table_top(std::ostream &ost)
1035{
1036 ost << "$" << endl;
1037 ost << "\\begin{array}{|c|c||c|c|c|}" << endl;
1038 ost << "\\hline" << endl;
1039 ost << "q & \\mbox{Iso} & \\mbox{Ago} & \\# E & "
1040 "\\mbox{Comment}\\\\" << endl;
1041 ost << "\\hline" << endl;
1042 ost << "\\hline" << endl;
1043}
1044
1045void surface_domain::table_bottom(std::ostream &ost)
1046{
1047 ost << "\\hline" << endl;
1048 ost << "\\end{array}" << endl;
1049 //ost << "\\quad" << endl;
1050 ost << "$" << endl;
1051}
1052
1054 int *field_orders, int nb_fields,
1055 long int *&Table,
1056 int *&Q, int &nb_Q,
1057 int *&E, int &nb_E_types, int verbose_level)
1058{
1059 //int Q_table[] = {4,7,8,9,11,13,16,17,19,23,25,27,29,
1060 // 31,32,37,41,43,47,49,53,59,61,64,67,71,73,79,81,83,89, 97};
1061 //int Q_table_len = sizeof(Q_table) / sizeof(int);
1062 int i, j, q, nb_reps, nb_E, nb_E_max, idx;
1063 int *Table_idx;
1065
1066 nb_Q = nb_fields;
1067 Q = NEW_int(nb_Q);
1068 Int_vec_copy(field_orders, Q, nb_Q);
1069
1070 nb_E_max = 0;
1071 for (i = 0; i < nb_fields; i++) {
1072 q = field_orders[i];
1073 nb_reps = K.cubic_surface_nb_reps(q);
1074 for (j = 0; j < nb_reps; j++) {
1076 nb_E_max = MAXIMUM(nb_E_max, nb_E);
1077 }
1078 }
1079 cout << "nb_E_max=" << nb_E_max << endl;
1080 int *E_freq;
1081 E_freq = NEW_int(nb_E_max + 1);
1082 Int_vec_zero(E_freq, nb_E_max + 1);
1083 for (i = 0; i < nb_fields; i++) {
1084 q = field_orders[i];
1085 nb_reps = K.cubic_surface_nb_reps(q);
1086 for (j = 0; j < nb_reps; j++) {
1088 E_freq[nb_E]++;
1089 }
1090 }
1091
1092
1093
1094 cout << "E_freq=";
1095 Int_vec_print(cout, E_freq, nb_E_max + 1);
1096 cout << endl;
1097
1098
1099 E = NEW_int(nb_E_max + 1);
1100 nb_E_types = 0;
1101
1102 Table_idx = NEW_int(nb_E_max + 1);
1103 for (j = 0; j <= nb_E_max; j++) {
1104 if (E_freq[j]) {
1105 E[nb_E_types] = j;
1106 Table_idx[j] = nb_E_types;
1107 nb_E_types++;
1108 }
1109 else {
1110 Table_idx[j] = -1;
1111 }
1112 }
1113
1114
1115 Table = NEW_lint(nb_Q * nb_E_types);
1116 orbiter_kernel_system::Orbiter->Lint_vec->zero(Table, nb_Q * nb_E_types);
1117 for (i = 0; i < nb_fields; i++) {
1118 q = Q[i];
1119 nb_reps = K.cubic_surface_nb_reps(q);
1120 for (j = 0; j < nb_reps; j++) {
1122 idx = Table_idx[nb_E];
1123 Table[i * nb_E_types + idx]++;
1124 }
1125 }
1126 cout << "Table:" << endl;
1127 orbiter_kernel_system::Orbiter->Lint_vec->matrix_print(Table, nb_Q, nb_E_types);
1128
1129 FREE_int(Table_idx);
1130}
1131
1132
1133
1134void callback_surface_domain_sstr_line_label(std::stringstream &sstr, long int pt, void *data)
1135{
1136 surface_domain *D = (surface_domain *) data;
1137
1138 //cout << "callback_surface_domain_sstr_line_label pt=" << pt << endl;
1139 D->sstr_line_label(sstr, pt);
1140}
1141
1142
1143
1144
1145}}}
1146
void latex_double_six(std::ostream &ost, long int *double_six)
ring_theory::homogeneous_polynomial_domain * Poly3_x123
void print_trihedral_pair_in_dual_coordinates_in_GAP(long int *F_planes_rank, long int *G_planes_rank)
ring_theory::homogeneous_polynomial_domain * Poly4_x123
void alice(std::ostream &ost, long int *Lines, int nb_lines)
void print_equation_maple(std::stringstream &ost, int *coeffs)
ring_theory::homogeneous_polynomial_domain * Poly1_4
void make_spreadsheet_of_lines_in_three_kinds(data_structures::spreadsheet *&Sp, long int *Wedge_rk, long int *Line_rk, long int *Klein_rk, int nb_lines, int verbose_level)
ring_theory::homogeneous_polynomial_domain * Poly3_24
ring_theory::homogeneous_polynomial_domain * Poly3_4
ring_theory::homogeneous_polynomial_domain * Poly1_x123
void make_table_of_surfaces2(std::ostream &ost, int *Q_table, int Q_table_len, int verbose_level)
void print_equation_with_line_breaks_tex(std::ostream &ost, int *coeffs)
void print_lines_tex(std::ostream &ost, long int *Lines, int nb_lines)
ring_theory::homogeneous_polynomial_domain * Poly2_27
void compute_table_E(int *field_orders, int nb_fields, long int *&Table, int *&Q, int &nb_Q, int *&E, int &nb_E_types, int verbose_level)
void print_equation_wrapped(std::ostream &ost, int *the_equation)
void make_table_of_surfaces_detailed(int *Q_table, int Q_table_len, int verbose_level)
void print_equation_in_trihedral_form(std::ostream &ost, int *the_six_plane_equations, int lambda, int *the_equation)
void print_equation_tex_lint(std::ostream &ost, long int *coeffs)
void sstr_line_label(std::stringstream &sstr, long int pt)
ring_theory::homogeneous_polynomial_domain * Poly2_x123
void matrix_print(long int *p, int m, int n)
Definition: lint_vec.cpp:203
void fill_column_with_text(int col_idx, const char **text, const char *heading)
void fill_column_with_row_index(int col_idx, const char *heading)
void fill_column_with_lint(int col_idx, long int *data, const char *heading)
functions related to strings and character arrays
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 print_naked_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:413
orthogonal_geometry::orthogonal_indexing * Orthogonal_indexing
void PG_element_unrank_modified_lint(int *v, int stride, int len, long int a)
void unrank_lint(long int rk, int verbose_level)
Definition: grassmann.cpp:343
void latex_matrix(std::ostream &ost, int *p)
Definition: grassmann.cpp:1200
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
void Pluecker_coordinates(int line_rk, int *v6, int verbose_level)
provides access to pre-computed combinatorial data in encoded form
void cubic_surface_stab_gens(int q, int i, int *&data, int &nb_gens, int &data_size, std::string &stab_order_str)
void lint_matrix_write_csv_override_headers(std::string &fname, std::string *headers, long int *M, int m, int n)
Definition: file_io.cpp:1346
void print_integer_matrix_tex(std::ostream &ost, int *p, int m, int n)
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)
long int Qplus_rank(int *v, int stride, int k, int verbose_level)
void unrank_point(int *v, int stride, long int rk, int verbose_level)
void print_equation_with_line_breaks_tex(std::ostream &ost, int *coeffs, int nb_terms_per_line, const char *new_line_text)
#define Int_vec_print_GAP(A, B, C)
Definition: foundations.h:703
#define NEW_pchar(n)
Definition: foundations.h:635
#define FREE_pchar(p)
Definition: foundations.h:648
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define NEW_char(n)
Definition: foundations.h:632
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define NEW_int(n)
Definition: foundations.h:625
#define Int_vec_print_to_str(A, B, C)
Definition: foundations.h:696
#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_char(p)
Definition: foundations.h:646
#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
#define MAXIMUM(x, y)
Definition: foundations.h:217
void callback_surface_domain_sstr_line_label(std::stringstream &sstr, long int pt, void *data)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects