Orbiter 2022
Combinatorial Objects
choose_points_or_lines.cpp
Go to the documentation of this file.
1// choose_points_or_lines.cpp
2//
3// Anton Betten
4//
5// started: Nov 21, 2010
6// moved to TOP_LEVEL: Nov 29, 2010
7
8#include "orbiter.h"
9
10using namespace std;
11
12namespace orbiter {
13namespace layer5_applications {
14namespace apps_geometry {
15
16
18{
19 null();
20}
21
23{
24 freeself();
25}
26
28{
29 //label;
30 data = NULL;
31 //Arc = NULL;
32 //input_set = NULL;
33 //f_is_in_input_set = NULL;
34 transporter = NULL;
35 transporter_inv = NULL;
36 gen = NULL;
37 Control = NULL;
38 Poset = NULL;
44
45}
46
48{
49#if 0
50 if (input_set) {
51 FREE_int(input_set);
52 }
53 if (f_is_in_input_set) {
54 FREE_int(f_is_in_input_set);
55 }
56#endif
57 if (transporter) {
59 }
60 if (transporter_inv) {
62 }
63 if (gen) {
65 }
66 if (Control) {
68 }
69 if (Poset) {
71 }
73 null();
74}
75
77{
78 representative = NULL;
79 stab_order = NULL;
80 Stab_Strong_gens = NULL;
81 //stab_gens = NULL;
82 //stab_tl = NULL;
83 stab = NULL;
84}
85
87{
88 int f_v = FALSE;
89
90 if (f_v) {
91 cout << "choose_points_or_lines::free_representative freeing representative" << endl;
92 }
93 if (representative) {
95 }
96 if (stab_order) {
98 }
99 if (Stab_Strong_gens) {
101 }
102 if (f_v) {
103 cout << "choose_points_or_lines::free_representative freeing stab" << endl;
104 }
105 if (stab) {
107 }
109}
110
111#if 0
112void poset::add_testing_without_group(
113 void (*func)(int *S, int len,
114 int *candidates, int nb_candidates,
115 int *good_candidates, int &nb_good_candidates,
116 void *data, int verbose_level),
117 void *data,
118 int verbose_level)
119#endif
120
121void choose_points_or_lines::init(const char *label, void *data,
122 actions::action *A, actions::action *A_lines,
123 int f_choose_lines,
124 int nb_points_or_lines,
125 int (*check_function)(int len, long int *S, void *data, int verbose_level),
126 int t0,
127 int verbose_level)
128{
129 int f_v = (verbose_level >= 1);
130
131 if (f_v) {
132 cout << "choose_points_or_lines::init " << label << endl;
133 }
134
136 //choose_points_or_lines::Arc = Arc;
144 if (f_choose_lines) {
145 A2 = A_lines;
146 }
147 else {
148 A2 = A;
149 }
152}
153
155{
156 int f_v = (verbose_level >= 1);
157 //int f_vv = (verbose_level >= 2);
158 //vector_ge *gens;
159 //int *tl;
160 groups::strong_generators *Strong_gens;
161
162 if (f_v) {
163 cout << "choose_points_or_lines::compute_orbits_from_sims " << label << endl;
164 }
166 Strong_gens->init_from_sims(G, verbose_level - 2);
167 compute_orbits(Strong_gens, verbose_level);
168 FREE_OBJECT(Strong_gens);
169}
170
172 int verbose_level)
173{
174 int f_v = (verbose_level >= 1);
175 int f_vv = (verbose_level >= 2);
176
177 if (f_v) {
178 cout << "choose_points_or_lines::compute_orbits " << label << endl;
179 }
180
181 if (gen) {
183 }
184 if (Poset) {
186 }
187
189
190 //sprintf(gen->fname_base, "%s", label);
191
192
193 //gen->depth = nb_points_or_lines;
194
195 if (f_vv) {
196 cout << "choose_points_or_lines::compute_orbits "
197 << label << " calling gen->init" << endl;
198 }
199
203
205 Poset->init_subset_lattice(A, A2, Strong_gens, verbose_level);
206
208 nb_points_or_lines /* sz */, verbose_level - 2);
209 if (f_vv) {
210 cout << "choose_points_or_lines::compute_orbits "
211 << label << " calling gen->init_check_func" << endl;
212 }
213
214
215#if 0
216 gen->f_print_function = TRUE;
217 gen->print_function = print_set;
218 gen->print_function_data = this;
219#endif
220
221
222 int f_use_invariant_subset_if_available = TRUE;
223 //int f_implicit_fusion = FALSE;
224 int f_debug = FALSE;
225
226 if (f_vv) {
227 cout << "choose_points_or_lines::compute_orbits "
228 << label << " calling generator_main" << endl;
229 }
230 gen->main(t0,
231 Control->depth,
232 f_use_invariant_subset_if_available,
233 //f_implicit_fusion,
234 f_debug,
235 verbose_level - 2);
236
237
238 if (f_vv) {
239 cout << "choose_points_or_lines::compute_orbits "
240 << label << " done with generator_main" << endl;
241 }
243
244 if (f_v) {
245 cout << "choose_points_or_lines::compute_orbits "
246 << label << " we found " << nb_orbits
247 << " orbits on " << nb_points_or_lines;
248 if (f_choose_lines) {
249 cout << "-sets of lines" << endl;
250 }
251 else {
252 cout << "-sets of points" << endl;
253 }
254 }
255}
256
258 int &f_hit_favorite, int verbose_level)
259{
260 int f_v = (verbose_level >= 1);
261 int f_vv = (verbose_level >= 2);
262 int f_vvv = (verbose_level >= 3);
263 //int f_v4 = (verbose_level >= 4);
264 int f, nd, i;
265 int f_changed;
266 long int *the_favorite_representative;
269
270 f_hit_favorite = FALSE;
271 if (f_v) {
272 cout << "choose_points_or_lines::choose_orbit " << label
273 << " orbit_no " << orbit_no << " / " << nb_orbits << endl;
274 }
275
276
278
279
281 nd = f + orbit_no;
282
284
287 the_favorite_representative = NEW_lint(nb_points_or_lines);
288
289 O = gen->get_node(nd);
291
292 if (f_vv) {
293 cout << "##############################################################################" << endl;
294 cout << "choose_points_or_lines::choose_orbit " << label
295 << " choosing orbit " << orbit_no << " / " << nb_orbits << endl;
296 }
297 if (f_vvv) {
298 cout << "choose_points_or_lines::choose_orbit " << label << " the ";
299 if (f_choose_lines) {
300 cout << "lines";
301 }
302 else {
303 cout << "points";
304 }
305 cout << " representing orbit " << orbit_no << " / "
306 << nb_orbits << " are ";
308 cout << endl;
309 }
310
311
312 f_changed = FALSE;
313 if (f_has_favorite) {
314 f_hit_favorite = favorite_orbit_representative(
316 the_favorite_representative, verbose_level - 3);
317 if (f_hit_favorite) {
318 if (f_iso_test_only) {
319 f_changed = FALSE;
320 if (f_v) {
321 cout << "choose_points_or_lines::choose_orbit "
322 << label << " isomorphism test only" << endl;
323 cout << "element mapping the favorite set to "
324 "the canonical set:" << endl;
326 cout << endl;
328 }
329 }
330 else {
331 f_changed = TRUE;
332 }
333 }
334 }
335 if (f_changed) {
336 for (i = 0; i < nb_points_or_lines; i++) {
337 representative[i] = the_favorite_representative[i];
338 }
339 if (f_vvv) {
340 cout << "choose_points_or_lines::choose_orbit " << label
341 << " / " << nb_orbits << " after changing, the "
342 "representative set for orbit " << orbit_no << " are ";
344 cout << endl;
345 }
346 }
347
348
350 gen,
351 *G, go,
352 verbose_level);
353#if 0
354 G->init(A, verbose_level - 2);
355 G->init_strong_generators_by_hdl(O->nb_strong_generators,
356 O->hdl_strong_generators, O->tl, FALSE);
357 G->schreier_sims(0);
358 G->group_order(go);
359#endif
360
361 if (f_vv) {
362 cout << "stabilizer of the chosen set has order " << go << endl;
363 }
364
367
368 if (f_changed) {
369
371 groups::sims *NewStab;
372
373 if (f_vvv) {
374 cout << "computing NewStab (because we changed)" << endl;
375 }
376 NewStab = NEW_OBJECT(groups::sims);
377 NewStab->init(A, verbose_level - 2);
378 NewStab->init_trivial_group(0/*verbose_level - 1*/);
379 //NewStab->group_order(stab_order);
380
381 NewStab->conjugate(A, G->S, transporter_inv,
382 FALSE, 0 /*verbose_level - 1*/);
383 NewStab->group_order(go1);
384 if (f_vv) {
385 cout << "The conjugated stabilizer has order " << go1 << endl;
386 }
387 Stab_Strong_gens->init_from_sims(NewStab, 0);
388 NewStab->group_order(*stab_order);
389
390 FREE_OBJECT(NewStab);
391 }
392 else {
395 }
396
397 if (f_v) {
398 cout << "choose_points_or_lines::choose_orbit " << label
399 << " orbit_no " << orbit_no << " / " << nb_orbits
400 << " done, chosen the set ";
402 cout << "_" << *stab_order;
403 cout << endl;
404 }
405#if 0
406 if (f_vv) {
407 cout << "tl: ";
408 int_vec_print(cout, stab_tl, A->base_len);
409 cout << endl;
410 }
411#endif
412 if (f_vv) {
413 cout << "choose_points_or_lines::choose_orbit " << label
414 << " we have " << Stab_Strong_gens->gens->len
415 << " strong generators" << endl;
416 }
417 if (f_vv || print_generators_verbose_level) {
418 for (i = 0; i < Stab_Strong_gens->gens->len; i++) {
419 cout << i << " : " << endl;
420
422 cout << endl;
423
425 cout << "in action on points:" << endl;
427 Stab_Strong_gens->gens->ith(i), cout);
428 cout << endl;
429 cout << "in action on lines:" << endl;
431 Stab_Strong_gens->gens->ith(i), cout);
432 cout << endl;
433 }
434 }
435 }
436
437
438
439 FREE_OBJECT(G);
440 FREE_lint(the_favorite_representative);
441
442}
443
445 int *transporter, int *transporter_inv,
446 long int *the_favorite_representative,
447 int verbose_level)
448{
449 int f_v = (verbose_level >= 1);
450 //int f_implicit_fusion = FALSE;
451 long int *canonical_set1;
452 long int *canonical_set2;
453 int *Elt1;
454 int *Elt2;
455 int *Elt3;
456 int f_OK = TRUE;
457 int i;
458
459 if (f_v) {
460 cout << "choose_points_or_lines::favorite_orbit_representative "
461 << label << endl;
462 }
464 cout << "choose_points_or_lines::favorite_orbit_representative "
465 << label << " not the right size" << endl;
466 cout << "nb_points_or_lines=" << nb_points_or_lines << endl;
467 cout << "favorite_size=" << favorite_size << endl;
468 return FALSE;
469 }
470
471 canonical_set1 = NEW_lint(nb_points_or_lines);
472 canonical_set2 = NEW_lint(nb_points_or_lines);
473 Elt1 = NEW_int(A2->elt_size_in_int);
474 Elt2 = NEW_int(A2->elt_size_in_int);
475 Elt3 = NEW_int(A2->elt_size_in_int);
476 gen->trace_set(
478 nb_points_or_lines /* level */,
479 canonical_set1,
481 //f_implicit_fusion,
482 verbose_level - 2);
483
484
485 for (i = 0; i < nb_points_or_lines; i++) {
486 if (canonical_set1[i] != representative[i]) {
487 f_OK = FALSE;
488 break;
489 }
490 }
492 if (f_OK) {
493 if (f_v) {
494 cout << "arc::favorite_zero_lines: transporter "
495 "to favorite set:" << endl;
498 }
499 for (i = 0; i < nb_points_or_lines; i++) {
500 the_favorite_representative[i] = favorite[i];
501 }
502 }
503 FREE_lint(canonical_set1);
504 FREE_lint(canonical_set2);
505 FREE_int(Elt1);
506 FREE_int(Elt2);
507 FREE_int(Elt3);
508 if (f_OK) {
509 return TRUE;
510 }
511 else {
512 return FALSE;
513 }
514
515}
516
518{
520 cout << "_" << *stab_order;
521}
522
524{
525 int i;
526
527 if (Stab_Strong_gens->gens->len == 0)
528 return;
529 cout << "generators:" << endl;
530 for (i = 0; i < Stab_Strong_gens->gens->len; i++) {
532
533#if 0
534 cout << "as permutation of points:" << endl;
536 cout << endl;
537 cout << "as permutation of lines:" << endl;
539 cout << endl;
540#endif
541
542 }
543}
544
546{
547 int i;
548
549 for (i = 0; i < nb_points_or_lines; i++) {
550 if (a == representative[i]) {
551 return TRUE;
552 }
553 }
554 return FALSE;
555}
556
557}}}
558
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
a permutation group in a fixed action.
Definition: actions.h:99
void print_for_make_element(std::ostream &ost, void *elt)
Definition: action_cb.cpp:182
void element_print_quick(void *elt, std::ostream &ost)
Definition: action_cb.cpp:353
void element_print(void *elt, std::ostream &ost)
Definition: action_cb.cpp:347
void print_quick(std::ostream &ost, void *elt)
Definition: action_cb.cpp:137
void element_invert(void *a, void *av, int verbose_level)
Definition: action_cb.cpp:322
void element_print_as_permutation(void *elt, std::ostream &ost)
Definition: action_cb.cpp:421
void init_strong_generators_by_hdl(int nb_gen, int *gen_hdl, int *tl, int verbose_level)
a permutation group represented via a stabilizer chain
Definition: groups.h:1273
void conjugate(actions::action *A, sims *old_G, int *Elt, int f_overshooting_OK, int verbose_level)
void init(actions::action *A, int verbose_level)
Definition: sims.cpp:289
void group_order(ring_theory::longinteger_object &go)
Definition: sims.cpp:951
void init_trivial_group(int verbose_level)
Definition: sims.cpp:584
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
void init_from_sims(groups::sims *S, int verbose_level)
data_structures_groups::vector_ge * gens
Definition: groups.h:1708
to control the behavior of the poset classification algorithm
void initialize_and_allocate_root_node(poset_classification_control *PC_control, poset_with_group_action *Poset, int depth, int verbose_level)
int trace_set(long int *set, int size, int level, long int *canonical_set, int *Elt_transporter, int verbose_level)
int main(int t0, int schreier_depth, int f_use_invariant_subset_if_available, int f_debug, int verbose_level)
to represent one poset orbit; related to the class poset_classification
void get_stabilizer(poset_classification *PC, data_structures_groups::group_container &G, ring_theory::longinteger_object &go_G, int verbose_level)
void store_set_to(poset_classification *gen, int i, long int *to)
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void choose_orbit(int orbit_no, int &f_hit_favorite, int verbose_level)
poset_classification::poset_classification * gen
Definition: tl_geometry.h:251
poset_classification::poset_with_group_action * Poset
Definition: tl_geometry.h:253
poset_classification::poset_classification_control * Control
Definition: tl_geometry.h:252
void compute_orbits(groups::strong_generators *Strong_gens, int verbose_level)
void init(const char *label, void *data, actions::action *A, actions::action *A_lines, int f_choose_lines, int nb_points_or_lines, int(*check_function)(int len, long int *S, void *data, int verbose_level), int t0, int verbose_level)
int(* check_function)(int len, long int *S, void *data, int verbose_level)
Definition: tl_geometry.h:249
int favorite_orbit_representative(int *transporter, int *transporter_inv, long int *the_favorite_representative, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_OBJECT(type)
Definition: foundations.h:638
#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
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects