Orbiter 2022
Combinatorial Objects
action_on_k_subsets.cpp
Go to the documentation of this file.
1// action_on_k_subsets.cpp
2//
3// Anton Betten
4// May 15, 2012
5
7#include "group_actions.h"
8
9using namespace std;
10
11
12namespace orbiter {
13namespace layer3_group_actions {
14namespace induced_actions {
15
16
18{
19 null();
20}
21
23{
24 free();
25}
26
28{
29 A = NULL;
30 set1 = NULL;
31 set2 = NULL;
32}
33
35{
36 if (set1) {
38 }
39 if (set2) {
41 }
42 null();
43}
44
46 int k, int verbose_level)
47{
48 int f_v = (verbose_level >= 1);
49 int n;
51
52 if (f_v) {
53 cout << "action_on_k_subsets::init k=" << k << endl;
54 }
57 n = A->degree;
58 degree = Combi.int_n_choose_k(n, k);
59 set1 = NEW_int(k);
60 set2 = NEW_int(k);
61 if (f_v) {
62 cout << "action_on_k_subsets::init n=" << n << endl;
63 cout << "action_on_k_subsets::init "
64 "n choose k=" << degree << endl;
65 }
66}
67
69 int *Elt, long int i, int verbose_level)
70{
71 long int u, a, b, j;
72 int f_v = (verbose_level >= 1);
73 int f_vv = (verbose_level >= 2);
76
77 if (f_v) {
78 cout << "action_on_k_subsets::compute_image "
79 "i = " << i << endl;
80 }
81 if (i < 0 || i >= degree) {
82 cout << "action_on_k_subsets::compute_image "
83 "i = " << i << " out of range" << endl;
84 exit(1);
85 }
86 Combi.unrank_k_subset(i, set1, A->degree, k);
87 for (u = 0; u < k; u++) {
88 a = set1[u];
89 b = A->image_of(Elt, a);
90 set2[u] = b;
91 }
92 Sorting.int_vec_heapsort(set2, k);
93 j = Combi.rank_k_subset(set2, A->degree, k);
94 if (f_vv) {
95 cout << "set " << i << " = ";
96 Int_vec_print(cout, set1, k);
97 cout << " maps to ";
98 Int_vec_print(cout, set2, k);
99 cout << " = " << j << endl;
100 }
101 if (j < 0 || j >= degree) {
102 cout << "action_on_k_subsets::compute_image "
103 "j = " << j << " out of range" << endl;
104 exit(1);
105 }
106 return j;
107}
108
109
110}}}
111
112
a collection of functions related to sorted vectors
a permutation group in a fixed action.
Definition: actions.h:99
void init(actions::action *A, int k, int verbose_level)
long int compute_image(int *Elt, long int i, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_int(n)
Definition: foundations.h:625
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects