Orbiter 2022
Combinatorial Objects
design_create.cpp
Go to the documentation of this file.
1/*
2 * design_create.cpp
3 *
4 * Created on: Sep 19, 2019
5 * Author: betten
6 */
7
8
9
10#include "orbiter.h"
11
12using namespace std;
13
14namespace orbiter {
15namespace layer5_applications {
16namespace apps_combinatorics {
17
18
20{
21 Descr = NULL;
22
23 //std::string prefix;
24 //std::string label_txt;
25 //std::string label_tex;
26
27 q = 0;
28 F = NULL;
29 k = 0;
30
31 A = NULL;
32 A2 = NULL;
33 Aut = NULL;
34 Aut_on_lines = NULL;
35
36 degree = 0;
37
38 set = NULL;
39 sz = 0;
40
42 Sg = NULL;
43
44 PA = NULL;
45 P = NULL;
46 block = NULL;
47
48 //null();
49}
50
52{
53 freeself();
54}
55
57{
58}
59
61{
62 if (F) {
64 }
65 if (set) {
67 }
68 if (Sg) {
70 }
71 if (PA) {
73 }
74 if (block) {
76 }
77 null();
78}
79
81{
82 int f_v = (verbose_level >= 1);
84
85 if (f_v) {
86 cout << "design_create::init" << endl;
87 }
89
90 if (Descr->f_q) {
91
92 q = Descr->q;
93
94 if (f_v) {
95 cout << "design_create::init q = " << q << endl;
96 //cout << "design_create::init k = " << k << endl;
97 }
99 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
100 }
101
102 if (Descr->f_family) {
103 if (f_v) {
104 cout << "design_create::init "
105 "family_name=" << Descr->family_name << endl;
106 }
107 if (ST.stringcmp(Descr->family_name, "PG_2_q") == 0) {
108 if (f_v) {
109 cout << "design_create::init PG(2," << q << ")" << endl;
110 }
111 if (!Descr->f_q) {
112 cout << "please use option -q <q> to specify the field order" << endl;
113 exit(1);
114 }
115 create_design_PG_2_q(F, set, sz, k, verbose_level);
116
117 char str[1000];
118
119 sprintf(str, "PG_2_q%d", q);
120 prefix.assign(str);
121
122 sprintf(str, "PG_2_%d", q);
123 label_txt.assign(str);
124
125 sprintf(str, "PG\\_2\\_%d", q);
126 label_tex.assign(str);
127 }
128
129 }
130 else if (Descr->f_catalogue) {
131
132 if (f_v) {
133 cout << "design_create::init "
134 "from catalogue" << endl;
135 }
136 //int nb_iso;
137 //knowledge_base K;
138
139 exit(1);
140
141 }
142 else if (Descr->f_list_of_blocks) {
143
144 if (f_v) {
145 cout << "design_create::init "
146 "list of blocks" << endl;
147 }
148
152
153 char str[1000];
154
155 sprintf(str, "blocks_v%d_k%d", degree, k);
156 prefix.assign(str);
157
158 sprintf(str, "blocks_v%d_k%d", degree, k);
159 label_txt.assign(str);
160
161 sprintf(str, "blocks\\_v%d\\_k%d", degree, k);
162 label_tex.assign(str);
163
165
166 int f_no_base = FALSE;
167
168 if (Descr->f_no_group) {
169 f_no_base = TRUE;
170 }
171 A->init_symmetric_group(degree, f_no_base, verbose_level);
172
174 A2->induced_action_on_k_subsets(*A, k, verbose_level);
175
176 Aut = NULL;
177 Aut_on_lines = NULL;
179 Sg = NULL;
180
181 }
183
184 if (f_v) {
185 cout << "design_create::init "
186 "list of blocks from file " << Descr->list_of_blocks_from_file_fname << endl;
187 }
188
191
193 int m, n;
194
196 set, m, n, verbose_level);
197
198
199 if (n != 1) {
200 cout << "design_create::init f_list_of_blocks_from_file n != 1" << endl;
201 exit(1);
202 }
203 sz = m;
204
205 //Orbiter->Lint_vec.scan(Descr->list_of_blocks_text, set, sz);
206
207 char str[1000];
208
209 sprintf(str, "blocks_v%d_k%d", degree, k);
210 prefix.assign(str);
211
212 sprintf(str, "blocks_v%d_k%d", degree, k);
213 label_txt.assign(str);
214
215 sprintf(str, "blocks\\_v%d\\_k%d", degree, k);
216 label_tex.assign(str);
217
219
220 int f_no_base = FALSE;
221
222 if (Descr->f_no_group) {
223 f_no_base = TRUE;
224 }
225
226 A->init_symmetric_group(degree, f_no_base, verbose_level);
227
229 A2->induced_action_on_k_subsets(*A, k, verbose_level);
230
231 Aut = NULL;
232 Aut_on_lines = NULL;
234 Sg = NULL;
235
236 }
237 else {
238 cout << "design_create::init no design created" << endl;
239 sz = 0;
241 //exit(1);
242 }
243
244
245 if (f_v) {
246 cout << "design_create::init set = ";
247 Lint_vec_print(cout, set, sz);
248 cout << endl;
249 }
250
251 if (f_has_group) {
252 cout << "design_create::init the stabilizer is:" << endl;
254 }
255 else {
256 cout << "design_create::init stabilizer is not available" << endl;
257 }
258
259
260
261 if (f_v) {
262 cout << "design_create::init done" << endl;
263 }
264}
265
267 long int *&set, int &sz, int &k, int verbose_level)
268{
269 int f_v = (verbose_level >= 1);
270
271 if (f_v) {
272 cout << "design_create::create_design_PG_2_q" << endl;
273 }
274
277 int j;
278 int f_semilinear;
279 //int *block;
280
281 if (F->e > 1) {
282 f_semilinear = TRUE;
283 }
284 else {
285 f_semilinear = FALSE;
286 }
288 PA->init(F, 2 /* n */, f_semilinear,
289 TRUE /*f_init_incidence_structure*/, verbose_level);
290
291 P = PA->P;
292
293
294 design_create::k = q + 1;
295 k = q + 1;
296 degree = P->N_points;
297
298 block = NEW_int(k);
299 sz = P->N_lines;
300 set = NEW_lint(sz);
301 for (j = 0; j < sz; j++) {
303 Sorting.int_vec_heapsort(block, k);
304 set[j] = Combi.rank_k_subset(block, P->N_points, k);
305 if (f_v) {
306 cout << "block " << j << " / " << sz << " : ";
307 Int_vec_print(cout, block, k);
308 cout << " : " << set[j] << endl;
309 }
310 }
311 Sorting.lint_vec_heapsort(set, sz);
312 if (f_v) {
313 cout << "design : ";
314 Lint_vec_print(cout, set, sz);
315 cout << endl;
316 }
317
318 if (f_v) {
319 cout << "design_create::create_design_PG_2_q creating actions" << endl;
320 }
322
323 int f_no_base = FALSE;
324
325 A->init_symmetric_group(degree, f_no_base, verbose_level);
326
328 A2->induced_action_on_k_subsets(*A, k, verbose_level);
329
330 Aut = PA->A;
333 Sg = Aut->Strong_gens;
334
335
336 //Aonk = A2->G.on_k_subsets;
337
338 if (f_v) {
339 cout << "design_create::create_design_PG_2_q creating actions done" << endl;
340 }
341
342 if (f_v) {
343 cout << "design_create::create_design_PG_2_q done" << endl;
344 }
345}
346
348 int rk, int verbose_level)
349{
350 int f_v = (verbose_level >= 1);
351
352 if (f_v) {
353 cout << "design_create::unrank_block_in_PG_2_q rk=" << rk
354 << " P->N_points=" << P->N_points << " k=" << k << endl;
355 }
357
358 Combi.unrank_k_subset(rk, block, P->N_points, k);
359 if (f_v) {
360 cout << "design_create::unrank_block_in_PG_2_q block = ";
361 Int_vec_print(cout, block, k);
362 cout << endl;
363 }
364 if (f_v) {
365 cout << "design_create::unrank_block_in_PG_2_q done" << endl;
366 }
367}
368
370 int verbose_level)
371{
372 int f_v = (verbose_level >= 1);
373 int rk;
374
375 if (f_v) {
376 cout << "design_create::rank_block_in_PG_2_q" << endl;
377 }
380
381 Sorting.int_vec_heapsort(block, k);
382 rk = Combi.rank_k_subset(block, P->N_points, k);
383 if (f_v) {
384 cout << "design_create::rank_block_in_PG_2_q done" << endl;
385 }
386 return rk;
387}
388
390{
391 int f_v = (verbose_level >= 1);
393 int nb_c;
394
395 if (f_v) {
396 cout << "design_create::get_nb_colors_as_two_design" << endl;
397 }
398 nb_c = Combi.binomial2(P->N_points - 2);
399 if (f_v) {
400 cout << "design_create::get_nb_colors_as_two_design done" << endl;
401 }
402 return nb_c;
403}
404
405int design_create::get_color_as_two_design_assume_sorted(long int *design, int verbose_level)
406{
407 int f_v = (verbose_level >= 1);
408 int c, i;
409
410 if (f_v) {
411 cout << "design_create::get_color_as_two_design_assume_sorted" << endl;
412 }
414
415 Combi.unrank_k_subset(design[0], block, P->N_points, k);
416 if (block[0] != 0) {
417 cout << "block[0] != 0" << endl;
418 exit(1);
419 }
420 if (block[1] != 1) {
421 cout << "block[1] != 1" << endl;
422 exit(1);
423 }
424 for (i = 2; i < k; i++) {
425 block[i] -= 2;
426 }
427 c = Combi.rank_k_subset(block + 2, P->N_points - 2, k - 2);
428 if (f_v) {
429 cout << "design_create::get_color_as_two_design_assume_sorted done" << endl;
430 }
431 return c;
432}
433
434}}}
435
436
437
a collection of functions related to sorted vectors
functions related to strings and character arrays
void finite_field_init(int q, int f_without_tables, int verbose_level)
projective_space_implementation * Implementation
Definition: geometry.h:1940
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
Definition: file_io.cpp:1558
a permutation group in a fixed action.
Definition: actions.h:99
void init_symmetric_group(int degree, int f_no_base, int verbose_level)
groups::strong_generators * Strong_gens
Definition: actions.h:130
void induced_action_on_k_subsets(action &old_action, int k, int verbose_level)
to describe the construction of a known design from the command line
void unrank_block_in_PG_2_q(int *block, int rk, int verbose_level)
void init(apps_combinatorics::design_create_description *Descr, int verbose_level)
projective_geometry::projective_space_with_action * PA
int get_color_as_two_design_assume_sorted(long int *design, int verbose_level)
void create_design_PG_2_q(field_theory::finite_field *F, long int *&set, int &sz, int &k, int verbose_level)
projective space PG(n,q) with automorphism group PGGL(n+1,q)
void init(field_theory::finite_field *F, int n, int f_semilinear, int f_init_incidence_structure, int verbose_level)
#define FREE_int(p)
Definition: foundations.h:640
#define Lint_vec_scan(A, B, C)
Definition: foundations.h:717
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#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 Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
the orbiter library for the classification of combinatorial objects