Orbiter 2022
Combinatorial Objects
arc_lifting_simeon.cpp
Go to the documentation of this file.
1/*
2 * arc_lifting_simeon.cpp
3 *
4 * Created on: Jan 5, 2019
5 * Author: betten
6 */
7
8
9#include "orbiter.h"
10
11using namespace std;
12
13namespace orbiter {
14namespace layer5_applications {
15namespace apps_geometry {
16
17static void early_test_func_for_arc_callback(long int *S, int len,
18 long int *candidates, int nb_candidates,
19 long int *good_candidates, int &nb_good_candidates,
20 void *data, int verbose_level);
21
22
23
24
26{
27 verbose_level = 0;
28 q = 0;
29 d = 0; // largest number of points per line
30 n = 0; // projective dimension
31 k = 0; // size of the arc
32 F = NULL;
38 //S = NULL;
39 A = NULL;
40 //longinteger_object go;
41 Elt = NULL;
42 v = NULL;
43 Sch = NULL;
44 Poset = NULL;
45 Gen = NULL;
46 P = NULL;
47
48 A2 = NULL; // action on the lines
49 A3 = NULL; // action on lines restricted to filtered_lines
50
51}
52
54{
55
56}
57
58void arc_lifting_simeon::init(int q, int d, int n, int k,
59 int verbose_level)
60{
61 int f_v = (verbose_level >= 1);
62 int i;
63
64 if (f_v) {
65 cout << "simeon::init" << endl;
66 }
71
77
78 v = NEW_int(n + 1);
79
81 F->finite_field_init(q, FALSE /* f_without_tables */, 0);
82
84
87 F, n + 1,
90 nice_gens,
92 FREE_OBJECT(nice_gens);
94 cout << "created a group of order " << go << endl;
95
97
98#if 0
99 for (i = 0; i < go.as_int(); i++) {
100 S->element_unrank_int(i, Elt, 0 /* verbose_level */);
101 cout << "element " << i << " / " << go << ":" << endl;
102 A->element_print_quick(Elt, cout);
103 }
104#endif
105
106 for (i = 0; i < A->degree; i++) {
107 F->PG_element_unrank_modified(v, 1, n + 1, i);
108 cout << "point " << i << " / " << A->degree << " is ";
109 Int_vec_print(cout, v, d);
110 cout << endl;
111 }
112
113 cout << "generating set: " << endl;
115
117
118 cout << "We have " << Sch->nb_orbits << " orbits on points" << endl;
119
121
123
124 P->projective_space_init(n /* n */,
125 F /* finite_field *F*/,
126 TRUE /* f_init_incidence_structure */,
127 0 /* verbose_level */);
128
129 P->init_incidence_structure(0 /*verbose_level*/);
130
133
137 A->Strong_gens,
139
140 if (f_v) {
141 cout << "before "
142 "Poset->add_testing_without_group" << endl;
143 }
145 early_test_func_for_arc_callback,
146 this /* void *data */,
148
149
151
153 k /* target_depth */,
154 //"" /* const char *prefix */,
155 //FALSE /* f_W */, FALSE /* f_w */,
156 Control,
157 Poset,
159
160
162
163 if (f_v) {
164 cout << "simeon::init done" << endl;
165 }
166
167}
168
169void arc_lifting_simeon::early_test_func(long int *S, int len,
170 long int *candidates, int nb_candidates,
171 long int *good_candidates, int &nb_good_candidates,
172 int verbose_level)
173{
174 int f_v = (verbose_level >= 1);
175 int f_vv = (verbose_level >= 2);
176 int j;
177 int f_OK;
178
179 if (f_v) {
180 cout << "arc_lifting_simeon::early_test_func checking set ";
181 Lint_vec_print(cout, S, len);
182 cout << endl;
183 cout << "candidate set of size "
184 << nb_candidates << ":" << endl;
185 Lint_vec_print(cout, candidates, nb_candidates);
186 cout << endl;
187 }
188
189 int *type_collected;
190
191 type_collected = NEW_int(len + 2);
192
193 if (len == 0) {
194 Lint_vec_copy(candidates, good_candidates, nb_candidates);
195 nb_good_candidates = nb_candidates;
196 }
197 else {
198 nb_good_candidates = 0;
199
200 if (f_vv) {
201 cout << "arc_lifting_simeon::early_test_func "
202 "before testing" << endl;
203 }
204 for (j = 0; j < nb_candidates; j++) {
205
206
207 if (f_vv) {
208 cout << "arc_lifting_simeon::early_test_func "
209 "testing " << j << " / "
210 << nb_candidates << endl;
211 }
212
213 int i;
214
215 f_OK = TRUE;
216
217 S[len] = candidates[j];
218
219 //cout << "test_function_for_arc" << endl;
221 S /*int *set */,
222 len + 1 /* int set_size */,
223 type_collected,
224 0 /*verbose_level */);
225 for (i = d + 1; i <= len + 1; i++) {
226 if (type_collected[i]) {
227 //cout << "test_function_for_arc fail" << endl;
228 f_OK = FALSE;
229 }
230 }
231
232 if (f_OK) {
233 good_candidates[nb_good_candidates++] =
234 candidates[j];
235 }
236 } // next j
237 } // else
238 FREE_int(type_collected);
239}
240
241
243{
244 int *type;
245 long int *original_arc;
246 int original_arc_sz;
247 int *bisecants;
248 int *c2_points;
249 long int *external_lines;
250 int nb_external_lines;
251 int h, i, j, pi, pj;
252 int nb_bisecants, nb_c2points, bi, bj, a, idx, u, pt;
255
256 original_arc = SaS->data;
257 original_arc_sz = SaS->sz;
258
259 nb_bisecants = Combi.int_n_choose_k(original_arc_sz, 2);
260 nb_c2points = nb_bisecants * nb_bisecants;
261 type = NEW_int(P->N_lines);
262 external_lines = NEW_lint(P->N_lines);
263 nb_external_lines = 0;
264 P->line_intersection_type(original_arc,
265 original_arc_sz, type, 0 /*verbose_level*/);
266
267 for (i = 0; i < P->N_lines; i++) {
268 if (type[i] == 0) {
269 external_lines[nb_external_lines++] = i;
270 }
271 }
272 cout << "We found " << nb_external_lines
273 << " external lines, they are: ";
274 Lint_vec_print(cout, external_lines, nb_external_lines);
275 cout << endl;
276
277 cout << "compute bisecants and c2 points:" << endl;
278
279
280 bisecants = NEW_int(nb_bisecants);
281
282 h = 0;
283 for (i = 0; i < original_arc_sz; i++) {
284 pi = original_arc[i];
285 for (j = i + 1; j < original_arc_sz; j++) {
286 pj = original_arc[j];
287 bisecants[h++] = P->line_through_two_points(pi, pj);
288 }
289 }
290 if (h != nb_bisecants) {
291 cout << "h != nb_bisecants" << endl;
292 exit(1);
293 }
294 cout << "We found " << nb_bisecants << " bisecants : ";
295 Int_vec_print(cout, bisecants, nb_bisecants);
296 cout << endl;
297
298 c2_points = NEW_int(nb_c2points);
299
300 h = 0;
301 for (i = 0; i < nb_bisecants; i++) {
302 bi = bisecants[i];
303 for (j = 0; j < nb_bisecants; j++) {
304 if (j == i) {
305 //continue;
306 }
307 else {
308 bj = bisecants[j];
309 a = P->intersection_of_two_lines(bi, bj);
310
311 if (Sorting.lint_vec_search_linear(original_arc,
312 original_arc_sz, a, idx)) {
313 }
314 else {
315 if (!Sorting.int_vec_search(c2_points, h, a, idx)) {
316 for (u = h; u > idx; u--) {
317 c2_points[u] = c2_points[u - 1];
318 }
319 c2_points[idx] = a;
320 h++;
321 }
322 }
323 }
324 }
325 }
326 cout << "We found " << h << " c2-points: ";
327 Int_vec_print(cout, c2_points, h);
328 cout << endl;
329
330 cout << "filtering the external lines:" << endl;
331 int nb_filtered_lines;
332 long int *filtered_lines;
333 int cnt;
334
335 nb_filtered_lines = 0;
336 filtered_lines = NEW_lint(nb_external_lines);
337 for (i = 0; i < nb_external_lines; i++) {
338 a = external_lines[i];
339 cnt = 0;
340 for (j = 0; j < q + 1; j++) {
341 pt = P->Implementation->Lines[a * (q + 1) + j];
342 if (Sorting.int_vec_search(c2_points, h, pt, idx)) {
343 cnt++;
344 }
345 }
346 if (cnt > 1) {
347 filtered_lines[nb_filtered_lines++] = a;
348 }
349 }
350 cout << "We found " << nb_filtered_lines << " lines of the "
351 << nb_external_lines << " external lines which intersect "
352 "the set of c2 points in at least 2 points" << endl;
353
354#if 1
356 A3 = A2->restricted_action(filtered_lines,
357 nb_filtered_lines, verbose_level);
358
359
360 int target_depth = 6;
364
367 Poset2->init_subset_lattice(A, A3,
368 SaS->Strong_gens,
370
372
374 target_depth,
375 Control2,
376 Poset2,
377 //NULL /* int (*candidate_incremental_check_func)(
378 //int len, int *S, void *data, int verbose_level) */,
379 //NULL /* void *candidate_incremental_check_data */,
380 5 /* verbose_level */);
381
382
383 Gen2->print_orbit_numbers(target_depth);
384
385 int nb_orbits;
386 int *covering_number;
387 int count;
388 int nb_sol = 0;
389
390 nb_orbits = Gen2->nb_orbits_at_level(target_depth);
391 cout << "We found " << nb_orbits << " orbits of subsets "
392 "of filtered external lines of size " << k << endl;
393
394 covering_number = NEW_int(h);
395
396 char fname[1000];
397
398 sprintf(fname,
399 "arc_lifting_simeon_q%d_n%d_d%d_k%d_solutions.txt",
400 q, n, d, k);
401 {
402 ofstream fp(fname);
403
404 long int *S; // the arc
405 int sz, idx, t;
406
407 S = NEW_lint(nb_external_lines);
408
409 for (i = 0; i < nb_orbits; i++) {
410
412
413 SaS = Gen2->get_set_and_stabilizer(target_depth,
414 i /* orbit_at_level */, 0 /* verbose_level */);
415
416 if ((i % 10000) == 0) {
417 cout << "testing orbit " << i << endl;
418 }
419 Int_vec_zero(covering_number, h);
420 for (j = 0; j < h; j++) {
421 for (u = 0; u < target_depth; u++) {
422 a = SaS->data[u];
423 a = filtered_lines[a];
424 if (P->is_incident(c2_points[j], a)) {
425 covering_number[j]++;
426 }
427 }
428 }
429 count = 0;
430 for (j = 0; j < h; j++) {
431 if (covering_number[j]) {
432 count++;
433 }
434 }
435 if (count >= h) {
436 cout << "solution" << endl;
437 cout << "orbit " << i << " / " << nb_orbits << " : ";
438 SaS->print_set_tex(cout);
439 cout << endl;
440 cout << "covering_number: ";
441 Int_vec_print(cout, covering_number, h);
442 cout << endl;
443
444
445 //external_lines[nb_external_lines];
446 // subtract the solution from the set
447 // of external lines to get the arc:
448
449 sz = nb_external_lines;
450 Lint_vec_copy(external_lines, S, nb_external_lines);
451 Sorting.lint_vec_heapsort(S, nb_external_lines);
452
453
454 for (u = 0; u < target_depth; u++) {
455 a = SaS->data[u];
456 a = filtered_lines[a];
457 if (!Sorting.lint_vec_search(S, sz, a, idx, 0)) {
458 cout << "the element a=" << a << " cannot be "
459 "found in the set of external lines" << endl;
460 exit(1);
461 }
462 for (t = idx + 1; t < sz; t++) {
463 S[t - 1] = S[t];
464 }
465 sz--;
466 }
467
468
469 fp << sz;
470 for (t = 0; t < sz; t++) {
471 fp << " " << S[t];
472 }
473 fp << endl;
474
475
476 nb_sol++;
477 }
478
479 //SaS->print_generators_tex(cout);
480
481
482 } // next i
483 fp << -1 << endl;
484
485 FREE_lint(S);
486
487 }
489
490 cout << "number of solutions = " << nb_sol << endl;
491 cout << "written file " << fname << " of size " << Fio.file_size(fname) << endl;
492
493#endif
494
495
496 FREE_int(type);
497}
498
499// #############################################################################
500// global functions
501// #############################################################################
502
503
504static void early_test_func_for_arc_callback(long int *S, int len,
505 long int *candidates, int nb_candidates,
506 long int *good_candidates, int &nb_good_candidates,
507 void *data, int verbose_level)
508{
509
510 arc_lifting_simeon *Simeon = (arc_lifting_simeon *) data;
511 int f_v = (verbose_level >= 1);
512
513 if (f_v) {
514 cout << "early_test_func_for_arc_callback for set ";
515 Lint_vec_print(cout, S, len);
516 cout << endl;
517 }
518 Simeon->early_test_func(S, len,
519 candidates, nb_candidates,
520 good_candidates, nb_good_candidates,
521 verbose_level);
522 if (f_v) {
523 cout << "early_test_func_for_arc_callback done" << endl;
524 }
525}
526
527}}}
a collection of functions related to sorted vectors
int int_vec_search(int *v, int len, int a, int &idx)
Definition: sorting.cpp:1094
int lint_vec_search_linear(long int *v, int len, long int a, int &idx)
Definition: sorting.cpp:699
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
void PG_element_unrank_modified(int *v, int stride, int len, int a)
void finite_field_init(int q, int f_without_tables, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
projective_space_implementation * Implementation
Definition: geometry.h:1940
void line_intersection_type(long int *set, int set_size, int *type, int verbose_level)
void projective_space_init(int n, field_theory::finite_field *F, int f_init_incidence_structure, int verbose_level)
void line_intersection_type_collected(long int *set, int set_size, int *type_collected, int verbose_level)
long int line_through_two_points(long int p1, long int p2)
a permutation group in a fixed action.
Definition: actions.h:99
action * restricted_action(long int *points, int nb_points, int verbose_level)
void element_print_quick(void *elt, std::ostream &ost)
Definition: action_cb.cpp:353
groups::strong_generators * Strong_gens
Definition: actions.h:130
action * induced_action_on_grassmannian(int k, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
Definition: action.cpp:2223
void init_linear_group(field_theory::finite_field *F, int m, int f_projective, int f_general, int f_affine, int f_semilinear, int f_special, data_structures_groups::vector_ge *&nice_gens, int verbose_level)
Definition: action_init.cpp:17
schreier * orbits_on_points_schreier(actions::action *A_given, int verbose_level)
to control the behavior of the poset classification algorithm
data_structures_groups::set_and_stabilizer * get_set_and_stabilizer(int level, int orbit_at_level, int verbose_level)
void compute_orbits_on_subsets(int target_depth, poset_classification_control *PC_control, poset_with_group_action *Poset, int verbose_level)
void init_subset_lattice(actions::action *A, actions::action *A2, groups::strong_generators *Strong_gens, int verbose_level)
void add_testing_without_group(void(*func)(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, void *data, int verbose_level), void *data, int verbose_level)
arc lifting according to Simeon Ball and Ray Hill
Definition: tl_geometry.h:165
poset_classification::poset_with_group_action * Poset
Definition: tl_geometry.h:186
void do_covering_problem(data_structures_groups::set_and_stabilizer *SaS)
poset_classification::poset_classification * Gen
Definition: tl_geometry.h:187
void init(int q, int d, int n, int k, int verbose_level)
void early_test_func(long int *S, int len, long int *candidates, int nb_candidates, long int *good_candidates, int &nb_good_candidates, int verbose_level)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#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 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