Orbiter 2022
Combinatorial Objects
poset_with_group_action.cpp
Go to the documentation of this file.
1// poset_with_group_action.cpp
2//
3// Anton Betten
4// November 19, 2018
5
7#include "discreta/discreta.h"
10
11using namespace std;
12
13namespace orbiter {
14namespace layer4_classification {
15namespace poset_classification {
16
17
18static int callback_test_independence_condition(
19 orbit_based_testing *Obt,
20 long int *S, int len, void *data, int verbose_level);
21
22
24{
25 description = NULL;
27 n = 0;
29 VS = NULL;
30
31 A = NULL;
32 A2 = NULL;
33 Strong_gens = NULL;
34
37
39 print_function = NULL;
41
42 //null();
43}
44
46{
47 freeself();
48}
49
51{
52}
53
55{
59 }
60 }
61 null();
62}
63
65 groups::strong_generators *Strong_gens,
66 int verbose_level)
67{
68 int f_v = (verbose_level >= 1);
69
70 if (f_v) {
71 cout << "poset_with_group_action::init_subset_lattice" << endl;
72 }
74 n = A2->degree;
75 if (f_v) {
76 cout << "poset_with_group_action::init_subset_lattice degree of action = " << n << endl;
77 }
84 if (f_v) {
85 cout << "poset_with_group_action::init_subset_lattice done" << endl;
86 }
87}
88
91 groups::strong_generators *Strong_gens,
93 int verbose_level)
94{
95 int f_v = (verbose_level >= 1);
96
97 if (f_v) {
98 cout << "poset_with_group_action::init_subspace_lattice" << endl;
99 }
101 n = A2->degree;
109 if (f_v) {
110 cout << "poset_with_group_action::init_subspace_lattice done" << endl;
111 }
112}
113
115 poset_description *description,
116 actions::action *A, // the action in which the group is given
117 actions::action *A2, // the action in which we do the search
118 groups::strong_generators *Strong_gens,
119 int verbose_level)
120{
121 int f_v = (verbose_level >= 1);
122
123 if (f_v) {
124 cout << "poset_with_group_action::init" << endl;
125 }
130
131
133 n = A2->degree;
138 mtx = A->get_matrix_group();
139 F = mtx->GFq;
140 if (mtx->n != description->dimension) {
141 cout << "poset_with_group_action::init mtx->n != description->dimension" << endl;
142 exit(1);
143 }
144 VS->init(F, description->dimension, verbose_level);
147
151 verbose_level);
152 }
153 if (f_v) {
154 cout << "poset_with_group_action::init action A:" << endl;
155 A->print_info();
156 }
157 if (f_v) {
158 cout << "poset_with_group_action::init action A2:" << endl;
159 A2->print_info();
160 }
161 if (f_v) {
162 cout << "poset_with_group_action::init generators for a group of order " << go
163 << " and degree " << A2->degree << endl;
164 }
165 if (f_v) {
166 cout << "poset_with_group_action::init done" << endl;
167 }
168}
169
171 int independence_value,
172 int verbose_level)
173{
174 int f_v = (verbose_level >= 1);
175
176 if (f_v) {
177 cout << "poset_with_group_action::add_independence_condition" << endl;
178 }
179 if (f_v) {
180 cout << "poset_with_group_action::init independence_condition value = "
181 << independence_value << endl;
182 }
183
186
187 mtx = A->get_matrix_group();
188
190 if (f_v) {
191 cout << "poset_with_group_action::add_independence_condition before "
192 "rc->init" << endl;
193 }
194 rc->init(mtx->GFq,
195 mtx->n,
196 n,
197 independence_value + 1);
198
199 if (Orbit_based_testing == NULL) {
202 if (f_v) {
203 cout << "poset_with_group_action::add_independence_condition before "
204 "Orbit_based_testing->init" << endl;
205 }
207 NULL /* poset_classification *PC */,
208 n,
209 verbose_level);
210 }
211 if (f_v) {
212 cout << "poset_with_group_action::add_independence_condition "
213 "adding callback for testing the "
214 "independence condition" << endl;
215 }
217 callback_test_independence_condition,
218 (void *) rc,
219 verbose_level);
220 if (f_v) {
221 cout << "poset_with_group_action::add_independence_condition done" << endl;
222 }
223}
224
225
227 int (*func)(orbit_based_testing *Obt,
228 long int *S, int len, void *data, int verbose_level),
229 void *data,
230 int verbose_level)
231{
232 int f_v = (verbose_level >= 1);
233
234 if (f_v) {
235 cout << "poset_with_group_action::add_testing" << endl;
236 }
237
238 if (Orbit_based_testing == NULL) {
241 if (f_v) {
242 cout << "poset_with_group_action::add_testing before "
243 "Orbit_based_testing->init" << endl;
244 }
246 NULL /* poset_classification *PC */,
247 n,
248 verbose_level);
249 }
250 if (f_v) {
251 cout << "poset_with_group_action::add_testing "
252 "adding callback for testing the "
253 "independence condition" << endl;
254 }
256 func,
257 data,
258 verbose_level);
259
260 if (f_v) {
261 cout << "poset_with_group_action::add_testing done" << endl;
262 }
263}
264
266 void (*func)(long int *S, int len,
267 long int *candidates, int nb_candidates,
268 long int *good_candidates, int &nb_good_candidates,
269 void *data, int verbose_level),
270 void *data,
271 int verbose_level)
272{
273 int f_v = (verbose_level >= 1);
274
275 if (f_v) {
276 cout << "poset_with_group_action::add_testing_without_group" << endl;
277 }
278
279 if (Orbit_based_testing == NULL) {
282 if (f_v) {
283 cout << "poset_with_group_action::add_testing_without_group before "
284 "Orbit_based_testing->init" << endl;
285 }
287 NULL /* poset_classification *PC */,
288 n,
289 verbose_level);
290 }
291 if (f_v) {
292 cout << "poset_with_group_action::add_testing_without_group "
293 "adding callback" << endl;
294 }
296 func,
297 data,
298 verbose_level);
299
300 if (f_v) {
301 cout << "poset_with_group_action::add_testing_without_group done" << endl;
302 }
303}
304
305
307{
308 if (f_subset_lattice) {
309 cout << "poset of subsets of an " << n << "-element set" << endl;
310 }
311 if (f_subspace_lattice) {
312 cout << "poset of subspaces of F_{" << VS->F->q << "}^{"
313 << VS->dimension << "}" << endl;
314 }
315 cout << "group action A:" << endl;
316 A->print_info();
317 cout << "group action A2:" << endl;
318 A2->print_info();
319 cout << "group order " << go << endl;
320}
321
323 long int *S, int len,
324 long int *candidates, int nb_candidates,
325 long int *good_candidates, int &nb_good_candidates,
326 int verbose_level)
327{
328 int f_v = (verbose_level >= 1);
329
330 if (f_v) {
331 cout << "poset_with_group_action::early_test_func" << endl;
332 }
334 if (f_v) {
335 cout << "poset_with_group_action::early_test_func "
336 "before Orbit_based_testing->early_test_"
337 "func_by_using_group" << endl;
338 }
340 S, len,
341 candidates, nb_candidates,
342 good_candidates, nb_good_candidates,
343 verbose_level - 1);
344 if (f_v) {
345 cout << "poset_with_group_action::early_test_func "
346 "after Orbit_based_testing->early_test_"
347 "func_by_using_group" << endl;
348 }
349 }
350 else {
351 Lint_vec_copy(candidates, good_candidates, nb_candidates);
352 nb_good_candidates = nb_candidates;
353 }
354 if (f_v) {
355 cout << "poset_with_group_action::early_test_func done" << endl;
356 }
357}
358
360{
361 if (!f_subspace_lattice) {
362 cout << "poset_with_group_action::unrank_point !f_subspace_lattice" << endl;
363 exit(1);
364 }
365 if (VS == NULL) {
366 cout << "poset_with_group_action::unrank_point VS == NULL" << endl;
367 exit(1);
368 }
369 VS->unrank_point(v, rk);
370}
371
373{
374 long int rk;
375
376 if (!f_subspace_lattice) {
377 cout << "poset_with_group_action::rank_point !f_subspace_lattice" << endl;
378 exit(1);
379 }
380 if (VS == NULL) {
381 cout << "poset_with_group_action::rank_point VS == NULL" << endl;
382 exit(1);
383 }
384 rk = VS->rank_point(v);
385 return rk;
386}
387
390 int k, long int *&orbit_reps, int &nb_orbits, int verbose_level)
391{
392 int f_v = (verbose_level >= 1);
394
395 if (f_v) {
396 cout << "poset_with_group_action::orbits_on_k_sets" << endl;
397 }
398
399 Gen = orbits_on_k_sets_compute(Control,
400 k, verbose_level);
401 if (f_v) {
402 cout << "poset_with_group_action::orbits_on_k_sets "
403 "done with orbits_on_k_sets_compute" << endl;
404 }
405
406 Gen->get_orbit_representatives(k, nb_orbits,
407 orbit_reps, verbose_level);
408
409
410 if (f_v) {
411 cout << "poset_with_group_action::orbits_on_k_sets "
412 "we found "
413 << nb_orbits << " orbits on " << k << "-sets" << endl;
414 }
415
416 FREE_OBJECT(Gen);
417 if (f_v) {
418 cout << "poset_with_group_action::orbits_on_k_sets done" << endl;
419 }
420}
421
424 int k, int verbose_level)
425{
426 int f_v = (verbose_level >= 1);
428
429
430 if (f_v) {
431 cout << "poset_with_group_action::orbits_on_k_sets_compute" << endl;
432 }
434
435 //sprintf(Gen->problem_label_with_path, "orbits_on_k_sets");
436
437
438
439 //Gen->depth = k;
440
441 //Gen->f_W = TRUE;
442
443 if (f_v) {
444 cout << "poset_with_group_action::orbits_on_k_sets_compute calling Gen->init" << endl;
445 }
446 Gen->initialize_and_allocate_root_node(
447 Control,
448 this,
449 k /* sz */,
450 verbose_level - 1);
451 //Gen->init_check_func(
452 // check_zero_lines,
453 // this /* candidate_check_data */);
454 //Gen->init_incremental_check_func(
455 //check_mindist_incremental,
456 //this /* candidate_check_data */);
457
458
459#if 0
460 Gen->f_print_function = TRUE;
461 Gen->print_function = print_set;
462 Gen->print_function_data = this;
463#endif
464
465
467 int schreier_depth = k;
468 int f_use_invariant_subset_if_available = TRUE;
469 int f_debug = FALSE;
470 int t0 = Os.os_ticks();
471
472 if (f_v) {
473 cout << "poset_with_group_action::orbits_on_k_sets_compute "
474 "calling generator_main" << endl;
475 }
476 Gen->main(t0,
477 schreier_depth,
478 f_use_invariant_subset_if_available,
479 f_debug,
480 verbose_level - 1);
481
482
483 if (f_v) {
484 cout << "poset_with_group_action::orbits_on_k_sets_compute done" << endl;
485 }
486 return Gen;
487}
488
489void poset_with_group_action::invoke_print_function(ostream &ost, int sz, long int *set)
490{
491 (*print_function)(ost, sz, set, print_function_data);
492}
493
494//##############################################################################
495// global functions:
496//##############################################################################
497
498
499static int callback_test_independence_condition(
501 long int *S, int len, void *data, int verbose_level)
502{
503 int f_v = (verbose_level >= 0);
504
505 if (f_v) {
506 cout << "callback_test_independence_condition" << endl;
507 }
509
510 rc = (algebra::rank_checker *) data;
512 S, verbose_level - 1)) {
513 return TRUE;
514 }
515 else {
516 return FALSE;
517 }
518
519}
520
521}}}
522
523
to check whether any d - 1 elements of a given set are linearly independent
Definition: algebra.h:655
int check_rank_last_two_are_fixed(int len, long int *S, int verbose_level)
void init(field_theory::finite_field *GFq, int m, int n, int d)
finite dimensional vector space over a finite field
Definition: algebra.h:688
void init(field_theory::finite_field *F, int dimension, int verbose_level)
a permutation group in a fixed action.
Definition: actions.h:99
groups::matrix_group * get_matrix_group()
Definition: action.cpp:2986
a matrix group over a finite field in projective, vector space or affine action
Definition: groups.h:318
a strong generating set for a permutation group with respect to a fixed action
Definition: groups.h:1703
void group_order(ring_theory::longinteger_object &go)
maintains a list of test functions which define a G-invariant poset
void init(poset_classification *PC, int max_depth, int verbose_level)
void early_test_func(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, int verbose_level)
void add_callback_no_group(void(*func)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level), void *data, int verbose_level)
void add_callback(int(*func)(orbit_based_testing *Obt, long int *S, int len, void *data, int verbose_level), void *data, int verbose_level)
to control the behavior of the poset classification algorithm
void init(poset_description *description, actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void early_test_func(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, int verbose_level)
void init_subspace_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, algebra::vector_space *VS, int verbose_level)
void add_testing(int(*func)(orbit_based_testing *Obt, long int *S, int len, void *data, int verbose_level), void *data, int verbose_level)
void add_testing_without_group(void(*func)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level), void *data, int verbose_level)
poset_classification * orbits_on_k_sets_compute(poset_classification_control *Control, int k, int verbose_level)
void orbits_on_k_sets(poset_classification_control *Control, int k, long int *&orbit_reps, int &nb_orbits, int verbose_level)
void(* print_function)(std::ostream &ost, int len, long int *S, void *data)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
the orbiter library for the classification of combinatorial objects