Orbiter 2022
Combinatorial Objects
orbits_on_polynomials.cpp
Go to the documentation of this file.
1/*
2 * orbits_on_polynomials.cpp
3 *
4 * Created on: Nov 28, 2020
5 * Author: betten
6 */
7
8
9
10
11
12
13#include "orbiter.h"
14
15using namespace std;
16
17namespace orbiter {
18namespace layer5_applications {
19namespace apps_algebra {
20
21
23{
24 LG = NULL;
26
27 F = NULL;
28 A = NULL;
29 n = 0;
30 // go;
31 HPD = NULL;
32 A2 = NULL;
33 Elt1 = Elt2 = Elt3 = NULL;
34 Sch = NULL;
35 // full_go
36 //fname_base
37 //fname_csv
38 //fname_report
39 T = NULL;
40 Nb_pts = NULL;
41
42}
43
45{
46}
47
50 int degree_of_poly,
51 int f_recognize, std::string &recognize_text,
52 int verbose_level)
53{
54 int f_v = (verbose_level >= 1);
55
56 if (f_v) {
57 cout << "orbits_on_polynomials::init" << endl;
58 }
59
62
63
64
65 A = LG->A_linear;
68
70
71 if (f_v) {
72 cout << "n = " << n << endl;
73 }
74
75 if (f_v) {
76 cout << "strong generators:" << endl;
77 //A->Strong_gens->print_generators();
79 }
80
82
83
84 monomial_ordering_type Monomial_ordering_type = t_PART;
85
86
87 HPD->init(F, n /* nb_var */, degree_of_poly,
88 TRUE /* f_init_incidence_structure */,
89 Monomial_ordering_type,
90 verbose_level - 2);
91
94 HPD,
95 FALSE /* f_induce_action */, NULL,
96 verbose_level - 2);
97
98 if (f_v) {
99 cout << "created action A2" << endl;
100 A2->print_info();
101 }
102
103
107
108
109 char str[1000];
110
111 sprintf(str, "poly_orbits_d%d_n%d_q%d", degree_of_poly, n - 1, F->q);
112 fname_base.assign(str);
113 fname_csv.assign(fname_base);
114 fname_csv.append(".csv");
115
116
117 //Sch = new schreier;
118 //A2->all_point_orbits(*Sch, verbose_level);
119
120
121 if (f_v) {
122 cout << "orbits_on_polynomials::init "
123 "before A->Strong_gens->orbits_on_points_schreier" << endl;
124 }
125
126
127 Sch = A->Strong_gens->orbits_on_points_schreier(A2, verbose_level - 2);
128
129 if (f_v) {
130 cout << "orbits_on_polynomials::init "
131 "after A->Strong_gens->orbits_on_points_schreier" << endl;
132 }
133
134
135
136 if (f_v) {
137 cout << "orbits_on_polynomials::init "
138 "before Sch->write_orbit_summary" << endl;
139 }
141 A /*default_action*/,
142 go,
143 verbose_level);
144 if (f_v) {
145 cout << "orbits_on_polynomials::init "
146 "after Sch->write_orbit_summary" << endl;
147 }
148
149
150
153
154 if (f_v) {
155 cout << "orbits_on_polynomials::init before T->init_from_schreier" << endl;
156 }
157
159 Sch,
160 A,
161 full_go,
162 verbose_level);
163
164 if (f_v) {
165 cout << "orbits_on_polynomials::init after T->init_from_schreier" << endl;
166 }
167
168
169
170 Sch->print_orbit_reps(cout);
171
172
173 if (f_v) {
174 cout << "orbits_on_polynomials::init "
175 "before compute_points" << endl;
176 }
177 compute_points(verbose_level);
178 if (f_v) {
179 cout << "orbits_on_polynomials::init "
180 "after compute_points" << endl;
181 }
182
183
184
185 if (f_recognize) {
186 long int *Rank;
187 int len;
188 int i;
189
190 int *Idx;
191
192
193 cout << "orbits_on_polynomials::init recognition:" << endl;
194 Lint_vec_scan(recognize_text, Rank, len);
195
196 Idx = NEW_int(len);
197
198 for (i = 0; i < len; i++) {
199 //cout << "recognizing object " << i << " / " << len << " which is " << Rank[i] << endl;
200 int orbit_idx;
201 orbit_idx = Sch->orbit_number(Rank[i]);
202 Idx[i] = orbit_idx;
203 cout << "recognizing object " << i << " / " << len << ", point "
204 << Rank[i] << " lies in orbit " << orbit_idx << endl;
205 }
207 std::string fname;
208
209 fname.assign(fname_base);
210 fname.append("_recognition.csv");
211
212 Fio.int_vec_write_csv(Idx, len, fname, "Idx");
213
214 FREE_lint(Rank);
215
216 }
217
218
219
220
221 FREE_int(Elt1);
222 FREE_int(Elt2);
223 FREE_int(Elt3);
224
225
226
227 if (f_v) {
228 cout << "orbits_on_polynomials::init done" << endl;
229 }
230}
231
233{
234 int *coeff;
235 int i;
236
237 coeff = NEW_int(HPD->get_nb_monomials());
239
240
241 for (i = 0; i < T->nb_orbits; i++) {
242
245
246 cout << i << " : ";
247 Lint_vec_print(cout, T->Reps[i].data, T->Reps[i].sz);
248 cout << " : ";
249 cout << go;
250
251 cout << " : ";
252
253 HPD->unrank_coeff_vector(coeff, T->Reps[i].data[0]);
254
255 std::vector<long int> Pts;
256
257 HPD->enumerate_points(coeff, Pts, verbose_level);
258
259 Points.push_back(Pts);
260 Nb_pts[i] = Pts.size();
261 }
262 FREE_int(coeff);
263
264}
265
266void orbits_on_polynomials::report(int verbose_level)
267{
268 int f_v = (verbose_level >= 1);
269
270 if (f_v) {
271 cout << "orbits_on_polynomials::report" << endl;
272 }
273 cout << "orbit reps:" << endl;
274
275 char title[1000];
276 char author[1000];
277 char str[1000];
278
279 sprintf(str, "poly_orbits_d%d_n%d_q%d.tex", degree_of_poly, n - 1, F->q);
280 fname_report.assign(str);
281
282 sprintf(title, "Varieties of degree %d in PG(%d,%d)", degree_of_poly, n - 1, F->q);
283 sprintf(author, "Orbiter");
284 {
285 ofstream ost(fname_report);
287
288 L.head(ost,
289 FALSE /* f_book*/,
290 TRUE /* f_title */,
291 title, author,
292 FALSE /* f_toc */,
293 FALSE /* f_landscape */,
294 TRUE /* f_12pt */,
295 TRUE /* f_enlarged_page */,
296 TRUE /* f_pagenumbers */,
297 NULL /* extra_praeamble */);
298
299 ost << "\\small" << endl;
300 ost << "\\arraycolsep=2pt" << endl;
301 ost << "\\parindent=0pt" << endl;
302 ost << "$q = " << F->q << "$\\\\" << endl;
303 ost << "$n = " << n - 1 << "$\\\\" << endl;
304 ost << "degree of poly $ = " << degree_of_poly << "$\\\\" << endl;
305
306 ost << "\\clearpage" << endl << endl;
307
308
309 // summary table:
310
311 ost << "\\section{The Varieties of degree $" << degree_of_poly
312 << "$ in $PG(" << n - 1 << ", " << F->q << ")$, summary}" << endl;
313
314#if 0
316 f,
317 TRUE /* f_has_callback */,
318 polynomial_orbits_callback_print_function2,
319 HPD /* callback_data */,
320 TRUE /* f_has_callback */,
321 polynomial_orbits_callback_print_function,
322 HPD /* callback_data */,
323 verbose_level);
324#else
325 int *coeff;
326 int i;
327
328 coeff = NEW_int(HPD->get_nb_monomials());
329 //Nb_pts = NEW_int(T->nb_orbits);
330
331
332 // compute the group of the surface:
334 int f_semilinear;
336
337 if (NT.is_prime(F->q)) {
338 f_semilinear = FALSE;
339 }
340 else {
341 f_semilinear = TRUE;
342 }
343
345
346 if (f_v) {
347 cout << "group_theoretic_activity::do_cubic_surface_properties before PA->init" << endl;
348 }
349 PA->init(
350 F, n - 1 /*n*/, f_semilinear,
351 TRUE /* f_init_incidence_structure */,
352 verbose_level);
353 if (f_v) {
354 cout << "group_theoretic_activity::do_cubic_surface_properties after PA->init" << endl;
355 }
356
357
358
359
360
361
362 data_structures::tally T_nb_pts;
363 int h, j, f, l, a;
364
365 T_nb_pts.init(Nb_pts, T->nb_orbits, FALSE, 0);
366
367 for (h = T_nb_pts.nb_types - 1; h >= 0; h--) {
368
369 f = T_nb_pts.type_first[h];
370 l = T_nb_pts.type_len[h];
371 a = T_nb_pts.data_sorted[f];
372
373 ost << "\\subsection{Objects with " << a << " Points}" << endl;
374
375 ost << "There are " << l << " objects with " << a << " Points: \\\\" << endl;
376
377 int *Idx;
378 int len;
379
380 T_nb_pts.get_class_by_value(Idx, len, a, 0 /*verbose_level*/);
381
382
384
385 Sorting.int_vec_heapsort(Idx, l);
386
387 ost << "orbit : rep : go : poly : Pts\\\\" << endl;
388 for (j = 0; j < l; j++) {
389
390 //i = T_nb_pts.sorting_perm_inv[f + j];
391
392 i = Idx[j];
393
396
397 ost << i << " : ";
398 Lint_vec_print(ost, T->Reps[i].data, T->Reps[i].sz);
399 ost << " : ";
400 ost << go;
401
402 ost << " : ";
403
404 HPD->unrank_coeff_vector(coeff, T->Reps[i].data[0]);
405
406 int nb_pts;
407
408 nb_pts = Nb_pts[i];
409
410 //ost << nb_pts;
411 //ost << " : ";
412
413 ost << T->Reps[i].data[0] << "=$";
414 HPD->print_equation_tex(ost, coeff);
415 //int_vec_print(f, coeff, HPD->get_nb_monomials());
416 //cout << " = ";
417 //HPD->print_equation_str(ost, coeff);
418
419 //f << " & ";
420 //Reps[i].Strong_gens->print_generators_tex(f);
421 ost << "$";
422
423 ost << " : ";
424
425 int u;
426 long int *set;
428
429 set = NEW_lint(nb_pts);
430 for (u = 0; u < nb_pts; u++) {
431 set[u] = Points[i][u];
432 }
433
434 for (u = 0; u < nb_pts; u++) {
435 ost << set[u];
436 if (u < nb_pts - 1) {
437 ost << ",";
438 }
439 }
440
441 PA->compute_group_of_set(set, nb_pts,
442 Sg,
443 verbose_level);
444
445 ost << " : go=";
447 Sg->group_order(go1);
448 ost << go1;
449 ost << "\\\\" << endl;
450
451 FREE_lint(set);
452 }
453
454 FREE_int(Idx);
455
456 }
457 FREE_OBJECT(PA);
458
459#endif
460
461 FREE_int(coeff);
462
463
464
465 L.foot(ost);
466
467 }
469
470 cout << "Written file " << fname_report << " of size " << Fio.file_size(fname_report) << endl;
471 if (f_v) {
472 cout << "orbits_on_polynomials::report done" << endl;
473 }
474
475}
476
478 int verbose_level)
479{
480 int f_v = (verbose_level >= 1);
481
482 if (f_v) {
483 cout << "orbits_on_polynomials::report_detailed_list" << endl;
484 }
485 // detailed listing:
486
487
488
490
491 T1.init(Nb_pts, T->nb_orbits, FALSE, 0);
492 ost << "Distribution of the number of points: $";
493 T1.print_naked_tex(ost, TRUE);
494 ost << "$\\\\" << endl;
495
496 ost << "\\section{The Varieties of degree $" << degree_of_poly
497 << "$ in $PG(" << n - 1 << ", " << F->q << ")$, "
498 "detailed listing}" << endl;
499 {
500 int fst, l, a, r;
503 int *coeff;
504 int *line_type;
505 long int *Pts;
506 int nb_pts;
507 int *Kernel;
508 int *v;
509 int i;
510 //int h, pt, orbit_idx;
511
512 A->group_order(go);
513 Pts = NEW_lint(HPD->get_P()->N_points);
514 coeff = NEW_int(HPD->get_nb_monomials());
515 line_type = NEW_int(HPD->get_P()->N_lines);
517 v = NEW_int(n);
518
519 for (i = 0; i < Sch->nb_orbits; i++) {
520 ost << "\\subsection*{Orbit " << i << " / "
521 << Sch->nb_orbits << "}" << endl;
522 fst = Sch->orbit_first[i];
523 l = Sch->orbit_len[i];
524
525 D.integral_division_by_int(go, l, go1, r);
526 a = Sch->orbit[fst];
527 HPD->unrank_coeff_vector(coeff, a);
528
529
530 vector<long int> Points;
531
532 HPD->enumerate_points(coeff, Points, verbose_level);
533
534 nb_pts = Points.size();
535 Pts = NEW_lint(nb_pts);
536 for (int u = 0; u < nb_pts; u++) {
537 Pts[u] = Points[u];
538 }
539
540 ost << "stab order " << go1 << "\\\\" << endl;
541 ost << "orbit length = " << l << "\\\\" << endl;
542 ost << "orbit rep = " << a << "\\\\" << endl;
543 ost << "number of points = " << nb_pts << "\\\\" << endl;
544
545 ost << "$";
546 Int_vec_print(ost, coeff, HPD->get_nb_monomials());
547 ost << " = ";
548 HPD->print_equation(ost, coeff);
549 ost << "$\\\\" << endl;
550
551
552 cout << "We found " << nb_pts << " points in the variety" << endl;
553 cout << "They are : ";
554 Lint_vec_print(cout, Pts, nb_pts);
555 cout << endl;
556 HPD->get_P()->print_set_numerical(cout, Pts, nb_pts);
557
559 ost, Pts, nb_pts, n);
560
561 HPD->get_P()->line_intersection_type(Pts, nb_pts,
562 line_type, 0 /* verbose_level */);
563
564 ost << "The line type is: ";
565
566 stringstream sstr;
568 line_type, HPD->get_P()->N_lines, TRUE /* f_backwards*/);
569 string s = sstr.str();
570 ost << "$" << s << "$\\\\" << endl;
571 //int_vec_print_classified(line_type, HPD->P->N_lines);
572 //cout << "after int_vec_print_classified" << endl;
573
574 ost << "The stabilizer is generated by:" << endl;
576 } // next i
577
578 FREE_lint(Pts);
579 FREE_int(coeff);
580 FREE_int(line_type);
581 FREE_int(Kernel);
582 FREE_int(v);
583 }
584
585 if (f_v) {
586 cout << "orbits_on_polynomials::report_detailed_list done" << endl;
587 }
588}
589
590}}}
591
void print_classified_str(std::stringstream &sstr, int *v, int len, int f_backwards)
Definition: int_vec.cpp:598
a collection of functions related to sorted vectors
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
void get_class_by_value(int *&Pts, int &nb_pts, int value, int verbose_level)
Definition: tally.cpp:644
void display_table_of_projective_points(std::ostream &ost, long int *Pts, int nb_pts, int len)
void print_set_numerical(std::ostream &ost, long int *set, int set_size)
void line_intersection_type(long int *set, int set_size, int *type, int verbose_level)
void int_vec_write_csv(int *v, int len, std::string &fname, const char *label)
Definition: file_io.cpp:1175
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)
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)
void enumerate_points(int *coeff, std::vector< long int > &Pts, int verbose_level)
domain to compute with objects of type longinteger
Definition: ring_theory.h:240
void integral_division_by_int(longinteger_object &a, int b, longinteger_object &q, int &r)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
a permutation group in a fixed action.
Definition: actions.h:99
groups::strong_generators * Strong_gens
Definition: actions.h:130
field_theory::finite_field * matrix_group_finite_field()
Definition: action.cpp:2883
void induced_action_on_homogeneous_polynomials(action *A_old, ring_theory::homogeneous_polynomial_domain *HPD, int f_induce_action, groups::sims *old_G, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
Definition: action.cpp:2223
a set of orbits using a vector of orbit representatives and stabilizers
void print_table_latex(std::ostream &f, int f_has_callback, void(*callback_print_function)(std::stringstream &ost, void *data, void *callback_data), void *callback_data, int f_has_callback2, void(*callback_print_function2)(std::stringstream &ost, void *data, void *callback_data), void *callback_data2, int verbose_level)
void init_from_schreier(groups::schreier *Sch, actions::action *default_action, ring_theory::longinteger_object &full_group_order, int verbose_level)
creates a linear group from command line arguments using linear_group_description
Definition: groups.h:244
void write_orbit_summary(std::string &fname, actions::action *default_action, ring_theory::longinteger_object &full_group_order, int verbose_level)
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
schreier * orbits_on_points_schreier(actions::action *A_given, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
void init(groups::linear_group *LG, int degree_of_poly, int f_recognize, std::string &recognize_text, int verbose_level)
projective space PG(n,q) with automorphism group PGGL(n+1,q)
void init(field_theory::finite_field *F, int n, int f_semilinear, int f_init_incidence_structure, int verbose_level)
void compute_group_of_set(long int *set, int set_sz, groups::strong_generators *&Sg, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define Lint_vec_scan(A, B, C)
Definition: foundations.h:717
#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 TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#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
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects