Orbiter 2022
Combinatorial Objects
test_semicanonical.cpp
Go to the documentation of this file.
1/*
2 * test_semicanonical.cpp
3 *
4 * Created on: Dec 24, 2021
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13using namespace std;
14
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace geometry_builder {
20
21
22
24{
25 gg = NULL;
26 MAX_V = 0;
27
28 // initial vbar / hbar
29 nb_i_vbar = 0;
30 i_vbar = NULL;
31 nb_i_hbar = 0;
32 i_hbar = NULL;
33
34
35 f_vbar = NULL;
36 vbar = NULL;
37 hbar = NULL;
38}
39
41{
42
43 if (i_vbar) {
45 }
46 if (i_hbar) {
48 }
49
50
51 if (f_vbar) {
53 }
54 if (vbar) {
56 }
57 if (hbar) {
59 }
60}
61
62void test_semicanonical::init(gen_geo *gg, int MAX_V, int verbose_level)
63{
64 int f_v = (verbose_level >= 1);
65 int i;
66
67 if (f_v) {
68 cout << "test_semicanonical::init" << endl;
69 }
70
73
74
76
77 for (i = 0; i < gg->GB->V * gg->inc->Encoding->dim_n; i++) {
78 f_vbar[i] = FALSE;
79 }
80
81 hbar = NEW_int(gg->GB->V + 1);
82 for (i = 0; i <= gg->GB->V; i++) {
83 hbar[i] = INT_MAX;
84 }
85
86 vbar = NEW_int(gg->GB->B + 1);
87 for (i = 0; i <= gg->GB->B; i++) {
88 vbar[i] = INT_MAX;
89 }
90
91 if (f_v) {
92 cout << "gen_geo::init_bars_and_partition before init_bars" << endl;
93 }
94 init_bars(verbose_level);
95 if (f_v) {
96 cout << "gen_geo::init_bars_and_partition after init_bars" << endl;
97 }
98
99
100
101
102 if (f_v) {
103 cout << "girth_test::test_semicanonical done" << endl;
104 }
105}
106
107void test_semicanonical::init_bars(int verbose_level)
108{
109 int f_v = (verbose_level >= 1);
110 int j;
111
112 if (f_v) {
113 cout << "test_semicanonical::init_bars" << endl;
114 }
115 if (f_v) {
116 cout << "test_semicanonical::init_bars before i_hbar" << endl;
117 }
118 i_vbar = NEW_int(gg->GB->b_len + 1);
119 i_hbar = NEW_int(gg->GB->v_len + 1);
120
121
122
123 nb_i_vbar = 0;
124
125 for (j = 0; j < gg->GB->b_len; j++) {
126 if (f_v) {
127 cout << "j=" << j << endl;
128 }
130
131 vbar[C->j0] = -1;
132
133 i_vbar[nb_i_vbar++] = C->j0;
134
135 }
136
137
138 nb_i_hbar = 0;
139 i_hbar[nb_i_hbar++] = 0;
140
141
142 if (f_v) {
143 cout << "test_semicanonical::init_bars done" << endl;
144 }
145
146}
147
149{
150 int i;
151
152 //cout << "V = " << Encoding->v << ", B = " << Encoding->b << endl;
153
154 cout << "vbar: ";
155 for (i = 0; i < nb_i_vbar; i++) {
156 cout << i_vbar[i];
157 if (i < nb_i_vbar - 1) {
158 cout << ", ";
159 }
160 }
161 cout << endl;
162
163 cout << "hbar: ";
164 for (i = 0; i < nb_i_hbar; i++) {
165 cout << i_hbar[i];
166 if (i < nb_i_hbar - 1) {
167 cout << ", ";
168 }
169 }
170 cout << endl;
171
172}
173
174void test_semicanonical::markers_update(int I, int m, int J, int n, int j,
175 int i1, int j0, int r,
176 int verbose_level)
177{
178
179 if (gg->GB->Descr->f_orderly) {
180 return;
181 }
182
183 // manage vbar:
184
185 if (vbar[j0 + j] == i1) {
186 if (n == 0) {
187 cout << "test_semicanonical::markers_update n == 0" << endl;
188 exit(1);
189 }
190 if (gg->inc->Encoding->theX[i1 * gg->inc->Encoding->dim_n + r - 1] != j0 + j - 1) {
191
192 // previous incidence:
193 cout << "test_semicanonical::markers_update theX[i1 * inc.max_r + r - 1] != j0 + j - 1" << endl;
194 exit(1);
195 }
196 if (!f_vbar[i1 * gg->inc->Encoding->dim_n + r - 1]) {
197 cout << "test_semicanonical::markers_update !f_vbar[i1 * inc->Encoding->dim_n + r - 1]" << endl;
198 exit(1);
199 }
200 f_vbar[i1 * gg->inc->Encoding->dim_n + r - 1] = FALSE;
201 vbar[j0 + j] = MAX_V;
202 // the value MAX_V indicates that there is no vbar
203 }
204
205 // create new vbar to the right:
206
207 if (vbar[j0 + j + 1] == i1) {
208 cout << "test_semicanonical::markers_update vbar[j0 + j + 1] == i1" << endl;
209 exit(1);
210 }
211 if (vbar[j0 + j + 1] > i1) {
212 f_vbar[i1 * gg->inc->Encoding->dim_n + r] = TRUE;
213 vbar[j0 + j + 1] = i1;
214 }
215
216
217 // ToDo: row_marker_test_and_update:
218 if (hbar[i1] > J) {
219 if (m == 0) {
220 cout << "test_semicanonical::markers_update no hbar && m == 0" << endl;
221 exit(1);
222 }
223 if (j0 + j != gg->inc->Encoding->theX[(i1 - 1) * gg->inc->Encoding->dim_n + r]) {
224 // create new hbar:
225 hbar[i1] = J;
226 }
227 }
228
229}
230
231void test_semicanonical::marker_move_on(int I, int m, int J, int n, int j,
232 int i1, int j0, int r,
233 int verbose_level)
234{
235
236 if (gg->GB->Descr->f_orderly) {
237 return;
238 }
239
240 // generate new vbar to the left of this incidence:
241 if (vbar[j0 + j + 1] == i1) {
242 cout << "test_semicanonical::marker_move_on vbar[j0 + j + 1] == i1" << endl;
243 exit(1);
244 }
245 if (vbar[j0 + j + 1] > i1) {
246 f_vbar[i1 * gg->inc->Encoding->dim_n + r] = TRUE;
247 vbar[j0 + j + 1] = i1;
248 }
249
250 if (hbar[i1] > J) {
251 if (m == 0) {
252 cout << "test_semicanonical::marker_move_on no hbar && m == 0" << endl;
253 exit(1);
254 }
255 if (j0 + j != gg->inc->Encoding->theX[(i1 - 1) * gg->inc->Encoding->dim_n + r]) {
256 // generate new hbar:
257 hbar[i1] = J;
258 }
259 }
260}
261
262int test_semicanonical::row_starter(int I, int m, int J, int n,
263 int i1, int j0, int r,
264 int verbose_level)
265{
266 int j;
267
268 if (gg->GB->Descr->f_orderly) {
269 if (n == 0) {
270 // first incidence inside the block?
271 j = 0;
272 }
273 else {
274
275 // start out one to the right of the previous incidence:
276
277 j = gg->inc->Encoding->theX[i1 * gg->inc->Encoding->dim_n + r - 1] - j0 + 1;
278 }
279 }
280 else {
281 if (hbar[i1] <= J) {
282 // hbar exists, which means that the left part of the row differs from the row above.
283 // The next incidence must be tried starting from the leftmost position.
284 // We cannot copy over from the previous row.
285 if (n == 0) {
286 // first incidence inside the block?
287 j = 0;
288 }
289 else {
290
291 // start out one to the right of the previous incidence:
292
293 j = gg->inc->Encoding->theX[i1 * gg->inc->Encoding->dim_n + r - 1] - j0 + 1;
294 }
295 }
296 else {
297 if (m == 0) {
298 cout << "gen_geo::GeoXFst hbar[i1] > J && m == 0" << endl;
299 exit(1);
300 }
301 // no hbar means that the left parts agree.
302
303 // pick the incidence according to the previous row:
304 j = gg->inc->Encoding->theX[(i1 - 1) * gg->inc->Encoding->dim_n + r] - j0;
305 }
306 }
307 return j;
308}
309
310void test_semicanonical::row_init(int I, int m, int J,
311 int i1,
312 int verbose_level)
313{
314 if (gg->GB->Descr->f_orderly) {
315 return;
316 }
317
318 if (m == 0) {
319 hbar[i1] = -1;
320 // initial hbar
321 }
322 else {
323 hbar[i1] = gg->GB->b_len;
324 // no hbar
325 }
326
327}
328
329int test_semicanonical::col_marker_test(int j0, int j, int i1)
330{
331 if (gg->GB->Descr->f_orderly) {
332 return FALSE;
333 }
334
335 if (vbar[j0 + j] > i1) {
336 // no vbar, skip
337 if (FALSE) {
338 //cout << "gen_geo::X_Fst I=" << I << " m=" << m << " J=" << J << " n=" << n << " j=" << j << " skipped because of vbar" << endl;
339 }
340 return TRUE;
341 }
342 return FALSE;
343
344}
345
346void test_semicanonical::col_marker_remove(int I, int m, int J, int n,
347 int i1, int j0, int r, int old_x)
348{
349 if (gg->GB->Descr->f_orderly) {
350 return;
351 }
352
353
354 // remove vbar:
355 if (f_vbar[i1 * gg->inc->Encoding->dim_n + r]) {
356 vbar[old_x + 1] = MAX_V;
357 f_vbar[i1 * gg->inc->Encoding->dim_n + r] = FALSE;
358 }
359
360 // possibly create new vbar on the left:
361 if (n > 0) {
362 if (vbar[old_x] > i1 &&
363 gg->inc->Encoding->theX[i1 * gg->inc->Encoding->dim_n + r - 1] == old_x - 1) {
364 vbar[old_x] = i1;
365 f_vbar[i1 * gg->inc->Encoding->dim_n + r - 1] = TRUE;
366 }
367 }
368
369}
370
371void test_semicanonical::row_test_continue(int I, int m, int J, int i1)
372{
373 if (gg->GB->Descr->f_orderly) {
374 return;
375 }
376
377
378 if (hbar[i1] > J) {
379 hbar[i1] = J;
380 }
381}
382
383
384}}}
385
386
description of a configuration which is part of class decomposition_with_fuse
classification of geometries with a given row-tactical decomposition
void col_marker_remove(int I, int m, int J, int n, int i1, int j0, int r, int old_x)
void row_init(int I, int m, int J, int i1, int verbose_level)
int row_starter(int I, int m, int J, int n, int i1, int j0, int r, int verbose_level)
void init(gen_geo *gg, int MAX_V, int verbose_level)
void marker_move_on(int I, int m, int J, int n, int j, int i1, int j0, int r, int verbose_level)
void markers_update(int I, int m, int J, int n, int j, int i1, int j0, int r, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_int(n)
Definition: foundations.h:625
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define MAX_V
Definition: gen_geo.cpp:23
the orbiter library for the classification of combinatorial objects