Orbiter 2022
Combinatorial Objects
packing_invariants.cpp
Go to the documentation of this file.
1// packing_invariants.cpp
2//
3// Anton Betten
4// Feb 14, 2013
5//
6//
7//
8//
9//
10
11#include "orbiter.h"
12
13using namespace std;
14
15namespace orbiter {
16namespace layer5_applications {
17namespace packings {
18
19
20
21
22
24{
25 null();
26}
27
29{
30 freeself();
31}
32
34{
35 the_packing = NULL;
36 list_of_lines = NULL;
38}
39
41{
42 int i;
43
44 if (the_packing) {
46 }
47 if (list_of_lines) {
49 }
50 if (f_has_klein) {
51 delete [] R;
52 for (i = 0; i < nb_planes; i++) {
54 }
57 }
58 null();
59}
60
62 std::string &prefix, std::string &prefix_tex, int iso_cnt,
63 long int *the_packing, int verbose_level)
64{
65 int f_v = (verbose_level >= 1);
66 int f_vv = (verbose_level >= 2);
67 int i;
68
69 if (f_v) {
70 cout << "packing_invariants::init" << endl;
71 }
72
75
79 for (i = 0; i < P->size_of_packing; i++) {
81 }
86 verbose_level - 2);
87 if (f_vv) {
88 cout << "list_of_lines:" << endl;
91 }
93
94#if 0
95 if (TRUE /*v.s_l() == 0*/) {
96 //cout << "packing_invariants::init no Klein invariants, "
97 // "skipping" << endl;
98 nb_planes = -1;
99 R = NULL;
100 Pts_on_plane = NULL;
101 nb_pts_on_plane = NULL;
102 }
103 else {
104 }
105#endif
106
107 if (f_v) {
108 cout << "packing_invariants::init done" << endl;
109 }
110}
111
113 Vector &v, int verbose_level)
114{
115 int f_v = (verbose_level >= 1);
116 int i, j;
117
118 if (f_v) {
119 cout << "packing_invariants::init_klein_invariants" << endl;
120 }
121 nb_planes = v.s_ii(0);
125 for (i = 0; i < nb_planes; i++) {
126 R[i].create(v.s_i(1).as_vector().s_ii(i), __FILE__, __LINE__);
127 }
128 for (i = 0; i < nb_planes; i++) {
129 nb_pts_on_plane[i] =
130 v.s_i(2).as_vector().s_i(i).as_vector().s_l();
132 for (j = 0; j < nb_pts_on_plane[i]; j++) {
133 Pts_on_plane[i][j] =
134 v.s_i(2).as_vector().s_i(i).as_vector().s_ii(j);
135 }
136 }
138 if (f_v) {
139 cout << "packing_invariants::init_klein_invariants done" << endl;
140 }
141}
142
143
145{
146 int f_v = (verbose_level >= 1);
147 int i, j;
148
149 if (f_v) {
150 cout << "packing_invariants::compute_decomposition" << endl;
151 }
152
153
154 int f_second = FALSE;
155
157 C->init(nb_pts_on_plane, nb_planes, f_second, 0);
158 if (f_v) {
159 cout << "packing_invariants::compute_decomposition: "
160 "plane-intersection type: ";
161 C->print(FALSE /*f_backwards*/);
162 C->print_naked_tex(cout, FALSE /*f_backwards*/);
163 }
164
165#if 0
166 ost << "Plane type of Klein-image is $($ ";
167 C->print_naked_tex(ost);
168 ost << " $)$" << endl << endl;
169 ost << "\\bigskip" << endl << endl;
170#endif
171
172 int a, b, h, f, l, m, u, uu, idx;
173
174 m = 0;
175 for (i = 0; i < C->nb_types; i++) {
176 f = C->type_first[i];
177 l = C->type_len[i];
178 a = C->data_sorted[f];
179 m = MAXIMUM(a, m);
180 }
181
182 nb_blocks = 0;
183 for (i = 0; i < C->nb_types; i++) {
184 f = C->type_first[i];
185 l = C->type_len[i];
186 a = C->data_sorted[f];
187 if (TRUE /*a == m*/) {
188 nb_blocks += l;
189 }
190 }
191 if (f_v) {
192 cout << "There are " << nb_blocks
193 << " interesting planes" << endl;
194 }
197
198
205
207 for (i = 0; i < total_nb_points * total_nb_blocks; i++) {
208 Inc[i] = 0;
209 }
210 for (i = 0; i < nb_planes; i++) {
211 plane_to_block[i] = -1;
212 }
213 j = 0;
214 for (h = 0; h < C->nb_types; h++) {
215 f = C->type_first[h];
216 l = C->type_len[h];
217 a = C->data_sorted[f];
218 if (TRUE /*a == m*/) {
219 for (u = 0; u < l; u++) {
220 a = C->data_sorted[f + u];
221 idx = C->sorting_perm_inv[f + u];
222 for (uu = 0; uu < a; uu++) {
223 i = Pts_on_plane[idx][uu];
224 Inc[i * total_nb_blocks + j] = 1;
225 }
226 block_to_plane[j] = idx;
227 plane_to_block[idx] = j;
228 j++;
229 } // next u
230 } // if
231 } // next h
232 for (h = 0; h < P->size_of_packing; h++) {
233 for (u = 0; u < P->spread_size; u++) {
234 i = h * P->spread_size + u;
235 j = nb_blocks + h;
236 Inc[i * total_nb_blocks + j] = 1;
237 }
238 }
239 for (h = 0; h < P->size_of_packing; h++) {
240 a = the_packing[h];
242 i = P->size_of_packing * P->spread_size + b;
243 j = nb_blocks + h;
244 Inc[i * total_nb_blocks + j] = 1;
245 }
246
247 if (FALSE /*nb_blocks < 20*/) {
248
249 cout << "we will draw an incidence picture" << endl;
250
253
257 0 /* verbose_level */);
260 0 /* verbose_level */);
262 Stack->split_cell(0 /* verbose_level */);
265 Stack->split_cell(0 /* verbose_level */);
266 if (nb_fake_points >= 2) {
267
268 // isolate the fake points:
269 for (i = 1; i < nb_fake_points; i++) {
272 nb_fake_points - i);
273 Stack->split_cell(0 /* verbose_level */);
274 }
275 }
278 Stack->split_cell(0 /* verbose_level */);
279 Stack->sort_cells();
280
282 char str[1000];
283 sprintf(str, "%d_packing_planes.tex", iso_cnt);
284 fname_incidence_pic.append(str);
285 {
286 ofstream fp_pic(fname_incidence_pic);
287
288 //ost << "\\input " << fname_incidence_pic << endl;
289 I->latex_it(fp_pic, *Stack);
290 //ost << "\\\\" << endl;
291 }
293 FREE_OBJECT(I);
294 }
295
296 // compute TDO:
297 {
298 int depth = INT_MAX;
299
303 0 /* verbose_level */);
306 0 /* verbose_level */);
309 Stack->split_cell(0 /* verbose_level */);
312 Stack->split_cell(0 /* verbose_level */);
313 if (nb_fake_points >= 2) {
314
315 // isolate the fake points:
316 for (i = 1; i < nb_fake_points; i++) {
319 nb_fake_points - i);
320 Stack->split_cell(0 /* verbose_level */);
321 }
322 }
325 Stack->split_cell(0 /* verbose_level */);
326 Stack->sort_cells();
327
328 I->compute_TDO_safe(*Stack, depth, verbose_level - 2);
329
330
332 char str[1000];
333 sprintf(str, "%d_packing_planes_row_scheme.tex", iso_cnt);
334 fname_row_scheme.append(str);
335
337 //char str[1000];
338 sprintf(str, "%d_packing_planes_row_scheme.tex", iso_cnt);
339 fname_col_scheme.append(str);
340
341
342 {
343 ofstream fp_row_scheme(fname_row_scheme);
344 ofstream fp_col_scheme(fname_col_scheme);
346 fp_row_scheme, FALSE /* f_enter_math */,
347 TRUE /* f_print_subscripts */, *Stack);
349 fp_col_scheme, FALSE /* f_enter_math */,
350 TRUE /* f_print_subscripts */, *Stack);
351 }
352 }
353
354
355 if (f_v) {
356 cout << "packing_invariants::compute_decomposition done" << endl;
357 }
358}
359
360}}}
361
data structure for set partitions following Jeffrey Leon
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:72
void print_naked_tex(std::ostream &ost, int f_backwards)
Definition: tally.cpp:413
interface for various incidence geometries
Definition: geometry.h:1099
void get_and_print_row_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, data_structures::partitionstack &PStack)
void get_and_print_column_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, data_structures::partitionstack &PStack)
void init_by_matrix(int m, int n, int *M, int verbose_level)
void compute_TDO_safe(data_structures::partitionstack &PStack, int depth, int verbose_level)
void latex_it(std::ostream &ost, data_structures::partitionstack &P)
void compute_list_of_lines_from_packing(long int *list_of_lines, long int *packing, int sz_of_packing, int verbose_level)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
void create(long int i, const char *file, int line)
DISCRETA vector class for vectors of DISCRETA objects.
Definition: discreta.h:797
discreta_base & s_i(int i)
Definition: vector.cpp:202
classification of packings in PG(3,q)
Definition: packings.h:66
spreads::spread_table_with_selection * Spread_table_with_selection
Definition: packings.h:85
void init(packing_classify *P, std::string &prefix, std::string &prefix_tex, int iso_cnt, long int *the_packing, int verbose_level)
#define Lint_matrix_print(A, B, C)
Definition: foundations.h:708
#define FREE_int(p)
Definition: foundations.h:640
#define NEW_pint(n)
Definition: foundations.h:627
#define NEW_OBJECT(type)
Definition: foundations.h:638
#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 FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define FREE_pint(p)
Definition: foundations.h:641
#define MAXIMUM(x, y)
Definition: foundations.h:217
the orbiter library for the classification of combinatorial objects