Orbiter 2022
Combinatorial Objects
action_by_restriction.cpp
Go to the documentation of this file.
1// action_by_restriction.cpp
2//
3// Anton Betten
4// February 20, 2010
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 nb_points = 0;
20 points = NULL;
21 points_sorted = NULL;
22 perm_inv = NULL;
24 pt = 0;
26}
27
29{
30 free();
31}
32
34{
35 if (points) {
37 }
38 if (points_sorted) {
40 }
41 if (perm_inv) {
43 }
44}
45
48 int pt, int verbose_level)
49{
50 int f_v = (verbose_level >= 1);
51
52 if (f_v) {
53 cout << "action_by_restriction::init_single_orbit_from_schreier_vector "
54 "pt=" << pt << endl;
55 }
56
59
60 long int *orbit_elts;
61 int orbit_len;
62
63
64 if (f_v) {
65 cout << "action_by_restriction::init_single_orbit_from_schreier_vector "
66 "before Schreier_vector->orbit_of_point pt=" << pt << endl;
67 }
68 Schreier_vector->orbit_of_point(
69 pt, orbit_elts, orbit_len, idx_of_root_node,
70 verbose_level);
71 if (f_v) {
72 cout << "action_by_restriction::init_single_orbit_from_schreier_vector "
73 "after Schreier_vector->orbit_of_point pt=" << pt << endl;
74 cout << "orbit_elts = ";
75 Lint_vec_print(cout, orbit_elts, orbit_len);
76 cout << endl;
77 }
78
79 if (f_v) {
80 cout << "action_by_restriction::init_single_orbit_from_schreier_vector "
81 "before init" << endl;
82 }
83 init(orbit_len, orbit_elts, verbose_level);
84 if (f_v) {
85 cout << "action_by_restriction::init_single_orbit_from_schreier_vector "
86 "after init" << endl;
87 }
88
89 FREE_lint(orbit_elts);
90
91 if (f_v) {
92 cout << "action_by_restriction::init_single_orbit_from_schreier_vector "
93 "done" << endl;
94 }
95}
96
97void action_by_restriction::init(int nb_points, long int *points,
98 int verbose_level)
99// the array points must be ordered
100{
101 int i;
102 int f_v = (verbose_level >= 1);
103 int f_vv = (verbose_level >= 2);
105
106 if (f_v) {
107 cout << "action_by_restriction::init nb_points="
108 << nb_points << endl;
109 }
110 if (f_vv) {
111 cout << "action_by_restriction::init points=";
113 cout << endl;
114 }
119 for (i = 0; i < nb_points; i++) {
121 points_sorted[i] = points[i];
122 perm_inv[i] = i;
123 }
125 if (f_vv) {
126 cout << "action_by_restriction::init points after sorting=";
128 cout << endl;
129 }
130 if (f_v) {
131 cout << "action_by_restriction::init finished" << endl;
132 }
133}
134
136{
137 return points[pt];
138}
139
141{
142 int idx;
144
145 if (!Sorting.lint_vec_search(points_sorted, nb_points, pt, idx, 0 /* verbose_level */)) {
146 cout << "action_by_restriction::restricted_point_idx fatal: "
147 "point " << pt << " not found" << endl;
148 exit(1);
149 }
150 return perm_inv[idx];
151}
152
153
155 actions::action *A, int *Elt, long int i, int verbose_level)
156{
157 int idx;
158 long int b, c, h;
159 int f_v = (verbose_level >= 1);
160 int f_vv = (verbose_level >= 2);
162
163 if (f_v) {
164 cout << "action_by_restriction::compute_image i = " << i << endl;
165 }
166 if (i < 0 || i >= nb_points) {
167 cout << "action_by_restriction::compute_image "
168 "i = " << i << " out of range" << endl;
169 exit(1);
170 }
171 if (f_vv) {
172 cout << "under the group element " << endl;
173 A->element_print_quick(Elt, cout);
174 cout << endl;
175 }
176 if (f_vv) {
177 cout << "points[i]=" << points[i] << endl;
178 }
179 b = A->element_image_of(points[i], Elt, verbose_level - 2);
180 if (f_vv) {
181 cout << "image of " << points[i] << " is " << b << endl;
182 }
183 if (!Sorting.lint_vec_search(points_sorted, nb_points, b, idx, 0 /* verbose_level */)) {
184 cout << "action_by_restriction::compute_image fatal: "
185 "image point " << b << " not found" << endl;
186 cout << "action: ";
187 A->print_info();
188
189 cout << "the element " << endl;
190 A->element_print_quick(Elt, cout);
191 cout << endl;
192 //cout << "as permutation:" << endl;
193 //A->print_as_permutation(cout, Elt);
194 //cout << endl;
195
196 cout << "i=" << i << endl;
197 cout << "image of " << points[i] << " is " << b << endl;
198 cout << "nb_points=" << nb_points << endl;
199 cout << "points=";
201 cout << endl;
202 cout << "points_sorted=" << endl;
203 for (h = 0; h < nb_points; h++) {
204 cout << h << " : " << points_sorted[h] << endl;
205 }
206 //int_vec_print(cout, points_sorted, nb_points);
207 //cout << endl;
208
209 cout << "We compute the image point again, "
210 "this time with more output" << endl;
211 b = A->element_image_of(points[i],
212 Elt, 10 /* verbose_level - 2*/);
213 cout << "action_by_restriction::compute_image fatal: "
214 "image point " << b << " not found" << endl;
215 cout << "action: ";
216 A->print_info();
217 exit(1);
218 }
219 if (f_v) {
220 cout << "action_on_sets::compute_image idx = " << idx << endl;
221 }
222 c = perm_inv[idx];
223 if (f_v) {
224 cout << "action_on_sets::compute_image c = " << c << endl;
225 }
226 return c;
227}
228
229}}}
230
231
232
a collection of functions related to sorted vectors
void lint_vec_heapsort_with_log(long int *v, long int *w, int len)
Definition: sorting.cpp:1981
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
a permutation group in a fixed action.
Definition: actions.h:99
void element_print_quick(void *elt, std::ostream &ost)
Definition: action_cb.cpp:353
long int element_image_of(long int a, void *elt, int verbose_level)
Definition: action_cb.cpp:198
void orbit_of_point(int pt, long int *&orbit_elts, int &orbit_len, int &idx_of_root_node, int verbose_level)
void init(int nb_points, long int *points, int verbose_level)
void init_single_orbit_from_schreier_vector(data_structures_groups::schreier_vector *Schreier_vector, int pt, int verbose_level)
long int compute_image(actions::action *A, int *Elt, long int i, int verbose_level)
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#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
the orbiter library for the classification of combinatorial objects