Orbiter 2022
Combinatorial Objects
blt_set_domain.cpp
Go to the documentation of this file.
1/*
2 * blt_set_domain.cpp
3 *
4 * Created on: Apr 6, 2019
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13using namespace std;
14
15
16namespace orbiter {
17namespace layer1_foundations {
18namespace orthogonal_geometry {
19
20
21
23{
24 F = NULL;
26 epsilon = 0;
27 n = 0;
28 q = 0;
29 target_size = 0;
30 degree = 0;
31
32
33 O = NULL;
35 Pts = NULL;
36 Candidates = NULL;
37 P = NULL;
38 G53 = NULL;
39 //null();
40}
41
43{
44 freeself();
45}
46
48{
49}
50
52{
53 int f_v = FALSE;
54
55 if (f_v) {
56 cout << "blt_set_domain::freeself" << endl;
57 }
59 if (f_v) {
60 cout << "blt_set_domain::freeself before O" << endl;
61 }
62 if (O) {
64 }
66 O = NULL;
67 }
68 if (Pts) {
70 }
71 if (Candidates) {
73 }
74 if (P) {
76 }
77 if (G53) {
79 }
80 null();
81 if (f_v) {
82 cout << "blt_set_domain::freeself done" << endl;
83 }
84}
85
86
87
89 int verbose_level)
90{
91 int f_v = (verbose_level >= 1);
93
94 if (f_v) {
95 cout << "blt_set_domain::init" << endl;
96 cout << "blt_set_domain::init "
97 "verbose_level = " << verbose_level << endl;
98 }
99
100
105 n = O->n; // vector space dimension
106 epsilon = O->epsilon;
107
108 char str[1000];
109
110 sprintf(str, "BLT_q%d", q);
111 prefix.assign(str);
112
113
114 target_size = q + 1;
115 degree = O->nb_points;
116
117
118 if (f_v) {
119 cout << "blt_set_domain::init q=" << q
120 << " target_size = " << target_size << endl;
121 }
122
123
125 if (NT.is_prime(q)) {
127 }
128 if (f_v) {
129 cout << "blt_set_domain::init "
130 "f_semilinear=" << f_semilinear << endl;
131 }
132
133
134 if (f_v) {
135 cout << "blt_set_domain::init "
136 "allocating Pts and Candidates" << endl;
137 }
138
139
141
143
144
146
147 if (f_v) {
148 cout << "blt_set_domain::init before P->projective_space_init" << endl;
149 }
150
151
153 FALSE /* f_init_incidence_structure */,
154 verbose_level);
155
156 if (f_v) {
157 cout << "blt_set_domain::init after P->projective_space_init" << endl;
158 }
159
160
162
163 G53->init(5, 3, F, 0 /*verbose_level - 2*/);
164
165 if (f_v) {
166 cout << "blt_set_domain::init finished" << endl;
167 }
168}
169
171 int first_point_of_starter,
172 long int *points, int nb_points, int *point_color,
174 int verbose_level)
175{
176 int f_v = (verbose_level >= 1);
177 long int L;
178 long int L100;
179 long int i, j, k;
180 int c1, c2;
181 int *Pts;
182 int *form_value;
183 int v1[5];
184 int m[5];
185 int f12, f13, f23, d;
186 //long int cnt;
187 int two;
188 int *Pi, *Pj;
190
191 if (f_v) {
192 cout << "blt_set_domain::compute_adjacency_list_fast" << endl;
193 }
194 L = ((long int) nb_points * ((long int) nb_points - 1)) >> 1;
195 L100 = (L / 100) + 1;
196
198 Bitvec->allocate(L);
199
200 Pts = NEW_int(nb_points * 5);
201 form_value = NEW_int(nb_points);
202 O->unrank_point(v1, 1, first_point_of_starter, 0);
203 if (f_v) {
204 cout << "blt_set_domain::compute_adjacency_list_fast unranking points" << endl;
205 }
206 for (i = 0; i < nb_points; i++) {
207 O->unrank_point(Pts + i * 5, 1, points[i], 0);
208 form_value[i] = O->evaluate_bilinear_form(v1, Pts + i * 5, 1);
209 }
210
211 if (f_v) {
212 cout << "blt_set_domain::compute_adjacency_list_fast computing adjacency matrix" << endl;
213 }
214
215 //cnt = 0;
216 two = F->add(1, 1);
217
218 k = 0;
219
220 for (i = 0; i < nb_points; i++) {
221 f12 = form_value[i];
222 c1 = point_color[i];
223 Pi = Pts + i * 5;
224 m[0] = F->mult(Pi[0], two);
225 m[1] = Pi[2];
226 m[2] = Pi[1];
227 m[3] = Pi[4];
228 m[4] = Pi[3];
229
230 for (j = i + 1; j < nb_points; j++, /*cnt++,*/ k++) {
231 //k = Combi.ij2k_lint(i, j, nb_points);
232
233 if ((k % L100) == 0 && k) {
234 cout << "blt_set_domain::compute_adjacency_list_fast "
235 "nb_points=" << nb_points << " progress: "
236 << k / L100
237 << " %" << endl;
238 }
239 c2 = point_color[j];
240 if (c1 == c2) {
241 Bitvec->m_i(k, 0);
242 continue;
243 }
244 f13 = form_value[j];
245 Pj = Pts + j * 5;
246 f23 = F->add5(
247 F->mult(m[0], Pj[0]),
248 F->mult(m[1], Pj[1]),
249 F->mult(m[2], Pj[2]),
250 F->mult(m[3], Pj[3]),
251 F->mult(m[4], Pj[4])
252 );
253 d = F->product3(f12, f13, f23);
254 if (d == 0) {
255 Bitvec->m_i(k, 0);
256 }
257 else {
258 if (O->f_is_minus_square[d]) {
259 Bitvec->m_i(k, 0);
260 }
261 else {
262 Bitvec->m_i(k, 1);
263 }
264 }
265
266 } // next j
267 } // next i
268
269
270
271 FREE_int(Pts);
272 FREE_int(form_value);
273 if (f_v) {
274 cout << "blt_set_domain::compute_adjacency_list_fast done" << endl;
275 }
276}
277
278
279
280void blt_set_domain::compute_colors(int orbit_at_level,
281 long int *starter, int starter_sz,
282 long int special_line,
283 long int *candidates, int nb_candidates,
284 int *&point_color, int &nb_colors,
285 int verbose_level)
286{
287 int f_v = (verbose_level >= 1);
288 int f_vv = (verbose_level >= 2);
289 long int p1, p2;
290 int v1[5];
291 int v2[5];
292 int v3[5];
293 long int *pts_on_special_line;
294 int idx, i;
296
297
298 if (f_v) {
299 cout << "blt_set_domain::compute_colors" << endl;
300 }
301 O->unrank_line(p1, p2, special_line, 0/*verbose_level*/);
302 if (f_vv) {
303 cout << "after unrank_line " << special_line << ":" << endl;
304 cout << "p1=" << p1 << " p2=" << p2 << endl;
305 }
306 O->unrank_point(v1, 1, p1, 0);
307 O->unrank_point(v2, 1, p2, 0);
308 if (f_vv) {
309 cout << "p1=" << p1 << " ";
310 Int_vec_print(cout, v1, 5);
311 cout << endl;
312 cout << "p2=" << p2 << " ";
313 Int_vec_print(cout, v2, 5);
314 cout << endl;
315 }
316 if (p1 != starter[0]) {
317 cout << "p1 != starter[0]" << endl;
318 exit(1);
319 }
320
321 pts_on_special_line = NEW_lint(q + 1);
322 O->points_on_line(p1, p2, pts_on_special_line,
323 0/*verbose_level*/);
324
325 if (f_vv) {
326 cout << "pts_on_special_line:" << endl;
327 Lint_vec_print(cout, pts_on_special_line, q + 1);
328 cout << endl;
329 }
330
331 if (!Sorting.lint_vec_search(pts_on_special_line, q + 1, starter[0], idx, 0)) {
332 cout << "cannot find the first point on the line" << endl;
333 exit(1);
334 }
335 for (i = idx; i < q + 1; i++) {
336 pts_on_special_line[i] = pts_on_special_line[i + 1];
337 }
338 if (f_vv) {
339 cout << "pts_on_special_line without the first "
340 "starter point:" << endl;
341 Lint_vec_print(cout, pts_on_special_line, q);
342 cout << endl;
343 }
344
345 int a, b;
346 int t, c, j, h;
347 int *starter_t;
348
349 starter_t = NEW_int(starter_sz);
350 starter_t[0] = -1;
351 for (i = 1; i < starter_sz; i++) {
352 O->unrank_point(v3, 1, starter[i], 0);
353 a = O->evaluate_bilinear_form(v1, v3, 1);
354 b = O->evaluate_bilinear_form(v2, v3, 1);
355 if (a == 0) {
356 cout << "a == 0, this should not be" << endl;
357 exit(1);
358 }
359 // <v3,t*v1+v2> = t*<v3,v1>+<v3,v2> = t*a+b = 0
360 // Thus, t = -b/a
361 t = O->F->mult(O->F->negate(b), O->F->inverse(a));
362 starter_t[i] = t;
363 }
364
365 if (f_vv) {
366 cout << "starter_t:" << endl;
367 Int_vec_print(cout, starter_t, starter_sz);
368 cout << endl;
369 }
370
371 long int *free_pts;
372 int *open_colors;
373 int *open_colors_inv;
374
375 free_pts = NEW_lint(q);
376 open_colors = NEW_int(q);
377 open_colors_inv = NEW_int(q);
378
379 point_color = NEW_int(nb_candidates);
380
381 nb_colors = q - starter_sz + 1;
382 j = 0;
383 for (i = 0; i < q; i++) {
384 for (h = 1; h < starter_sz; h++) {
385 if (starter_t[h] == i) {
386 break;
387 }
388 }
389 if (h == starter_sz) {
390 free_pts[j] = pts_on_special_line[i];
391 open_colors[j] = i;
392 j++;
393 }
394 }
395 if (j != nb_colors) {
396 cout << "blt_set_domain::compute_colors error: j != nb_colors" << endl;
397 exit(1);
398 }
399 if (f_vv) {
400 cout << "The " << nb_colors << " free points are :" << endl;
401 Lint_vec_print(cout, free_pts, nb_colors);
402 cout << endl;
403 cout << "The " << nb_colors << " open colors are :" << endl;
404 Int_vec_print(cout, open_colors, nb_colors);
405 cout << endl;
406 }
407 for ( ; j < q; j++) {
408 open_colors[j] = starter_t[j - nb_colors + 1];
409 }
410 if (f_vv) {
411 cout << "open_colors :" << endl;
412 Int_vec_print(cout, open_colors, q);
413 cout << endl;
414 }
415 for (i = 0; i < q; i++) {
416 j = open_colors[i];
417 open_colors_inv[j] = i;
418 }
419 if (f_vv) {
420 cout << "open_colors_inv :" << endl;
421 Int_vec_print(cout, open_colors_inv, q);
422 cout << endl;
423 }
424
425
426 for (i = 0; i < nb_candidates; i++) {
427 O->unrank_point(v3, 1, candidates[i], 0);
428 if (f_vv) {
429 cout << "candidate " << i << " / " << nb_candidates
430 << " is " << candidates[i] << " = ";
431 Int_vec_print(cout, v3, 5);
432 cout << endl;
433 }
434 a = O->evaluate_bilinear_form(v1, v3, 1);
435 b = O->evaluate_bilinear_form(v2, v3, 1);
436 if (a == 0) {
437 cout << "a == 0, this should not be" << endl;
438 exit(1);
439 }
440 // <v3,t*v1+v2> = t*<v3,v1>+<v3,v2> = t*a+b = 0
441 // Thus, t = -b/a
442 t = O->F->mult(O->F->negate(b), O->F->inverse(a));
443 c = open_colors_inv[t];
444 if (c >= nb_colors) {
445 cout << "c >= nb_colors" << endl;
446 cout << "i=" << i << endl;
447 cout << "candidates[i]=" << candidates[i] << endl;
448 cout << "as vector: ";
449 Int_vec_print(cout, v3, 5);
450 cout << endl;
451 cout << "a=" << a << endl;
452 cout << "b=" << b << endl;
453 cout << "t=" << t << endl;
454 cout << "c=" << c << endl;
455 cout << "nb_colors=" << nb_colors << endl;
456
457 exit(1);
458 }
459 point_color[i] = c;
460 }
461
462 if (f_vv) {
463 cout << "point colors:" << endl;
464 Int_vec_print(cout, point_color, nb_candidates);
465 cout << endl;
466 }
467
468 FREE_lint(pts_on_special_line);
469 FREE_int(starter_t);
470 FREE_lint(free_pts);
471 FREE_int(open_colors);
472 FREE_int(open_colors_inv);
473 if (f_v) {
474 cout << "blt_set_domain::compute_colors done" << endl;
475 }
476}
477
478
479
480void blt_set_domain::early_test_func(long int *S, int len,
481 long int *candidates, int nb_candidates,
482 long int *good_candidates, int &nb_good_candidates,
483 int verbose_level)
484{
485 int f_v = (verbose_level >= 1);
486 int f_vv = (verbose_level >= 2);
487 int i, j, a;
488 int f_OK;
489 int v[5];
490 int *v1, *v2, *v3;
491 int m1[5];
492 int m3[5];
493 int two;
494 int fxy, fxz, fyz;
495
496 if (f_v) {
497 cout << "blt_set_domain::early_test_func checking set ";
498 Lint_vec_print(cout, S, len);
499 cout << endl;
500 cout << "candidate set of size "
501 << nb_candidates << ":" << endl;
502 Lint_vec_print(cout, candidates, nb_candidates);
503 cout << endl;
504 if (f_vv) {
505 for (i = 0; i < nb_candidates; i++) {
506 O->unrank_point(v, 1, candidates[i],
507 0/*verbose_level - 4*/);
508 cout << "candidate " << i << "="
509 << candidates[i] << ": ";
510 Int_vec_print(cout, v, 5);
511 cout << endl;
512 }
513 }
514 }
515 for (i = 0; i < len; i++) {
516 O->unrank_point(Pts + i * 5, 1,
517 S[i], 0/*verbose_level - 4*/);
518 }
519 for (i = 0; i < nb_candidates; i++) {
520 O->unrank_point(Candidates + i * 5, 1, candidates[i],
521 0/*verbose_level - 4*/);
522 }
523
524 two = O->F->add(1, 1);
525
526
527 if (len == 0) {
528 Lint_vec_copy(candidates, good_candidates, nb_candidates);
529 nb_good_candidates = nb_candidates;
530 }
531 else {
532 nb_good_candidates = 0;
533
534 if (f_vv) {
535 cout << "blt_set_domain::early_test_func before testing" << endl;
536 }
537 for (j = 0; j < nb_candidates; j++) {
538
539
540 if (f_vv) {
541 cout << "blt_set::early_test_func "
542 "testing " << j << " / "
543 << nb_candidates << endl;
544 }
545
546 v1 = Pts;
547 v3 = Candidates + j * 5;
548
549 m1[0] = O->F->mult(two, v1[0]);
550 m1[1] = v1[2];
551 m1[2] = v1[1];
552 m1[3] = v1[4];
553 m1[4] = v1[3];
554
555 //fxz = evaluate_bilinear_form(v1, v3, 1);
556 // too slow !!!
557 fxz = O->F->add5(
558 O->F->mult(m1[0], v3[0]),
559 O->F->mult(m1[1], v3[1]),
560 O->F->mult(m1[2], v3[2]),
561 O->F->mult(m1[3], v3[3]),
562 O->F->mult(m1[4], v3[4])
563 );
564
565
566 if (fxz == 0) {
567 f_OK = FALSE;
568 }
569 else {
570 m3[0] = O->F->mult(two, v3[0]);
571 m3[1] = v3[2];
572 m3[2] = v3[1];
573 m3[3] = v3[4];
574 m3[4] = v3[3];
575
576 f_OK = TRUE;
577 for (i = 1; i < len; i++) {
578 //fxy = evaluate_bilinear_form(v1, v2, 1);
579
580 v2 = Pts + i * 5;
581
582 fxy = O->F->add5(
583 O->F->mult(m1[0], v2[0]),
584 O->F->mult(m1[1], v2[1]),
585 O->F->mult(m1[2], v2[2]),
586 O->F->mult(m1[3], v2[3]),
587 O->F->mult(m1[4], v2[4])
588 );
589
590 //fyz = evaluate_bilinear_form(v2, v3, 1);
591 fyz = O->F->add5(
592 O->F->mult(m3[0], v2[0]),
593 O->F->mult(m3[1], v2[1]),
594 O->F->mult(m3[2], v2[2]),
595 O->F->mult(m3[3], v2[3]),
596 O->F->mult(m3[4], v2[4])
597 );
598
599 a = O->F->product3(fxy, fxz, fyz);
600
601 if (a == 0) {
602 f_OK = FALSE;
603 break;
604 }
605 if (O->f_is_minus_square[a]) {
606 f_OK = FALSE;
607 break;
608 }
609
610 }
611 }
612 if (f_OK) {
613 good_candidates[nb_good_candidates++] =
614 candidates[j];
615 }
616 } // next j
617 } // else
618}
619
620int blt_set_domain::pair_test(int a, int x, int y, int verbose_level)
621// We assume that a is an element
622// of a set S of size at least two such that
623// S \cup \{ x \} is BLT and
624// S \cup \{ y \} is BLT.
625// In order to test if S \cup \{ x, y \}
626// is BLT, we only need to test
627// the triple \{ x,y,a\}
628{
629 int v1[5], v2[5], v3[5];
630 int f12, f13, f23;
631 int d;
632
633 O->unrank_point(v1, 1, a, 0);
634 O->unrank_point(v2, 1, x, 0);
635 O->unrank_point(v3, 1, y, 0);
636 f12 = O->evaluate_bilinear_form(v1, v2, 1);
637 f13 = O->evaluate_bilinear_form(v1, v3, 1);
638 f23 = O->evaluate_bilinear_form(v2, v3, 1);
639 d = O->F->product3(f12, f13, f23);
640 if (d == 0) {
641 return FALSE;
642 }
643 if (O->f_is_minus_square[d]) {
644 return FALSE;
645 }
646 else {
647 return TRUE;
648 }
649
650}
651
652int blt_set_domain::check_conditions(int len, long int *S, int verbose_level)
653{
654 int f_OK = TRUE;
655 int f_BLT_test = FALSE;
656 int f_collinearity_test = FALSE;
657 //int f_v = (verbose_level >= 1);
658 int f_vv = (verbose_level >= 2);
659
660 //f_v = TRUE;
661 //f_vv = TRUE;
662
663 if (f_vv) {
664 cout << "checking set ";
665 Lint_vec_print(cout, S, len);
666 cout << endl;
667 }
668 if (!collinearity_test(S, len, verbose_level)) {
669 f_OK = FALSE;
670 f_collinearity_test = TRUE;
671 }
672 if (!O->BLT_test(len, S, verbose_level)) {
673 f_OK = FALSE;
674 f_BLT_test = TRUE;
675 }
676
677
678 if (f_OK) {
679 if (f_vv) {
680 cout << "OK" << endl;
681 }
682 return TRUE;
683 }
684 else {
685 if (f_vv) {
686 cout << "not OK because of ";
687 if (f_BLT_test) {
688 cout << "BLT test";
689 }
690 if (f_collinearity_test) {
691 cout << "collinearity test";
692 }
693 cout << endl;
694 }
695 return FALSE;
696 }
697}
698
699int blt_set_domain::collinearity_test(long int *S, int len, int verbose_level)
700{
701 int f_v = (verbose_level >= 1);
702 int i;
703 long int x, y;
704 int f_OK = TRUE;
705 int fxy;
706
707 if (f_v) {
708 cout << "blt_set_domain::collinearity_test test for" << endl;
709 for (i = 0; i < len; i++) {
710 O->unrank_point(O->v1, 1, S[i], 0);
711 Int_vec_print(cout, O->v1, n);
712 cout << endl;
713 }
714 }
715 y = S[len - 1];
716 O->unrank_point(O->v1, 1, y, 0);
717
718 for (i = 0; i < len - 1; i++) {
719 x = S[i];
720 O->unrank_point(O->v2, 1, x, 0);
721 fxy = O->evaluate_bilinear_form(O->v1, O->v2, 1);
722
723 if (fxy == 0) {
724 f_OK = FALSE;
725 if (f_v) {
726 cout << "not OK; ";
727 cout << "{x,y}={" << x << ","
728 << y << "} are collinear" << endl;
729 Int_vec_print(cout, O->v1, n);
730 cout << endl;
731 Int_vec_print(cout, O->v2, n);
732 cout << endl;
733 cout << "fxy=" << fxy << endl;
734 }
735 break;
736 }
737 }
738
739 if (f_v) {
740 if (!f_OK) {
741 cout << "collinearity test fails" << endl;
742 }
743 }
744 return f_OK;
745}
746
747void blt_set_domain::print(ostream &ost, long int *S, int len)
748{
749 int i;
750
751 for (i = 0; i < len; i++) {
752 O->unrank_point(O->v1, 1, S[i], 0);
753 Int_vec_print(ost, O->v1, n);
754 ost << endl;
755 }
756}
757
758
759void blt_set_domain::find_free_points(long int *S, int S_sz,
760 long int *&free_pts, int *&free_pt_idx, int &nb_free_pts,
761 int verbose_level)
762{
763 int f_v = (verbose_level >= 1);
764 int f_vv = (verbose_level >= 2);
765 long int *lines_on_pt;
766 long int *Perp;
767 long int i, j, a, b, h, f, fst, len, pt;
769
770 if (f_v) {
771 cout << "blt_set_domain::find_free_points" << endl;
772 }
773 lines_on_pt = NEW_lint(S_sz * (q + 1));
774 for (i = 0; i < S_sz; i++) {
776 lines_on_pt + i * (q + 1),
777 0 /* verbose_level */);
778 }
779
780 if (f_vv) {
781 cout << "blt_set_domain::find_free_points "
782 "Lines on partial BLT set:" << endl;
783 Lint_matrix_print(lines_on_pt, S_sz, q + 1);
784 }
785
786 Perp = NEW_lint(S_sz * (q + 1) * (q + 1));
787 for (i = 0; i < S_sz; i++) {
788 for (j = 0; j < q + 1; j++) {
789 a = lines_on_pt[i * (q + 1) + j];
791 Perp + i * (q + 1) * (q + 1) + j * (q + 1),
792 0 /* verbose_level */);
793 }
794 }
795 if (f_vv) {
796 cout << "blt_set_domain::find_free_points Perp:" << endl;
797 Lint_matrix_print(Perp, S_sz * (q + 1), q + 1);
798 }
799
800
801 C.init_lint(Perp, S_sz * (q + 1) * (q + 1), TRUE, 0);
802
803 C.print(FALSE /* f_reverse */);
804
805
806 // find the points which are in Perp only once:
807 f = C.second_type_first[0];
808 nb_free_pts = C.second_type_len[0];
809 if (f_v) {
810 cout << "blt_set_domain::find_free_points nb_free_pts="
811 << nb_free_pts << endl;
812 }
813 free_pts = NEW_lint(nb_free_pts);
814 free_pt_idx = NEW_int(O->nb_points);
815 for (h = 0; h < O->nb_points; h++) {
816 free_pt_idx[h] = -1;
817 }
818
819 for (h = 0; h < nb_free_pts; h++) {
820 b = C.second_sorting_perm_inv[f + h];
821 fst = C.type_first[b];
822 len = C.type_len[b];
823 if (len != 1) {
824 cout << "blt_set_domain::find_free_points len != 1" << endl;
825 exit(1);
826 }
827 pt = C.data_sorted[fst];
828 //cout << "h=" << h << " b=" << b << " len="
829 //<< len << " pt=" << pt << endl;
830 free_pts[h] = pt;
831 free_pt_idx[pt] = h;
832 }
833
834 FREE_lint(lines_on_pt);
835 FREE_lint(Perp);
836
837 if (f_v) {
838 cout << "blt_set_domain::find_free_points "
839 "There are " << nb_free_pts << " free points" << endl;
840 }
841 if (f_v) {
842 cout << "blt_set_domain::find_free_points done" << endl;
843 }
844}
845
847 int case_number, int nb_cases_total,
848 long int *Starter_set, int starter_size,
849 long int *candidates, int nb_candidates,
850 int f_eliminate_graphs_if_possible,
852 int verbose_level)
853{
854 int f_v = (verbose_level >= 1);
855 int f_vv = (verbose_level >= 1);
856 int special_line;
857 int ret = TRUE;
858
859 if (f_v) {
860 cout << "blt_set_domain::create_graph" << endl;
861 }
862 int *point_color;
863 int nb_colors;
864
865 long int *lines_on_pt;
866
867 lines_on_pt = NEW_lint(1 /*starter_size*/ * (q + 1));
869 Starter_set[0] /*R->rep[0]*/,
870 lines_on_pt, 0 /* verbose_level */);
871
872 if (f_vv) {
873 cout << "Case " << case_number /*orbit_at_level*/
874 << " Lines on partial BLT set:" << endl;
875 Lint_matrix_print(lines_on_pt, 1 /*starter_size*/, q + 1);
876 }
877
878
879 special_line = lines_on_pt[0];
880
881 if (f_v) {
882 cout << "blt_set_domain::create_graph before compute_colors" << endl;
883 }
884 compute_colors(case_number,
885 Starter_set, starter_size,
886 special_line,
887 candidates, nb_candidates,
888 point_color, nb_colors,
889 verbose_level);
890 if (f_v) {
891 cout << "blt_set_domain::create_graph after compute_colors" << endl;
892 }
893
894
896
897 C.init(point_color, nb_candidates, FALSE, 0);
898 if (f_vv) {
899 cout << "blt_set_domain::create_graph Case " << case_number
900 << " / " << nb_cases_total /* R->nb_cases*/
901 << " point colors (1st classification): ";
902 C.print(FALSE /* f_reverse */);
903 cout << endl;
904 }
905
906
908
909 C2.init(point_color, nb_candidates, TRUE, 0);
910 if (f_vv) {
911 cout << "blt_set_domain::create_graph Case " << case_number
912 << " / " << nb_cases_total
913 << " point colors (2nd classification): ";
914 C2.print(FALSE /* f_reverse */);
915 cout << endl;
916 }
917
918
919
920 int f, /*l,*/ idx;
921
922 f = C2.second_type_first[0];
923 //l = C2.second_type_len[0];
924 idx = C2.second_sorting_perm_inv[f + 0];
925#if 0
926 if (C.type_len[idx] != minimal_type_multiplicity) {
927 cout << "idx != minimal_type" << endl;
928 cout << "idx=" << idx << endl;
929 cout << "minimal_type=" << minimal_type << endl;
930 cout << "C.type_len[idx]=" << C.type_len[idx] << endl;
931 cout << "minimal_type_multiplicity="
932 << minimal_type_multiplicity << endl;
933 exit(1);
934 }
935#endif
936 int minimal_type, minimal_type_multiplicity;
937
938 minimal_type = idx;
939 minimal_type_multiplicity = C2.type_len[idx];
940
941 if (f_vv) {
942 cout << "blt_set_domain::create_graph Case " << case_number
943 << " / " << nb_cases_total << " minimal type is "
944 << minimal_type << endl;
945 cout << "blt_set_domain::create_graph Case " << case_number
946 << " / " << nb_cases_total << " minimal_type_multiplicity "
947 << minimal_type_multiplicity << endl;
948 }
949
950 if (f_eliminate_graphs_if_possible) {
951 if (minimal_type_multiplicity == 0) {
952 cout << "blt_set_domain::create_graph Case " << case_number
953 << " / " << nb_cases_total << " Color class "
954 << minimal_type << " is empty, the case is "
955 "eliminated" << endl;
956 ret = FALSE;
957 goto finish;
958 }
959 }
960
961
962
963 if (f_vv) {
964 cout << "blt_set_domain::create_graph Case " << case_number
965 << " / " << nb_cases_total << " Computing adjacency list, "
966 "nb_points=" << nb_candidates << endl;
967 }
968
970
971 if (f_v) {
972 cout << "blt_set_domain::create_graph before compute_adjacency_list_fast" << endl;
973 }
974 compute_adjacency_list_fast(Starter_set[0],
975 candidates, nb_candidates, point_color,
976 Bitvec,
977 verbose_level - 2);
978
979 if (f_vv) {
980 cout << "blt_set_domain::create_graph Case " << case_number
981 << " / " << nb_cases_total << " Computing adjacency "
982 "list done" << endl;
983#if 0
984 cout << "blt_set_domain::create_graph Case " << case_number
985 << " / " << nb_cases_total << " bitvector_length="
986 << bitvector_length << endl;
987#endif
988 }
989
990
991 if (f_v) {
992 cout << "blt_set_domain::create_graph creating colored_graph" << endl;
993 }
994
996
997 {
998 char str[1000];
999 string label, label_tex;
1000
1001 sprintf(str, "BLT_%d", case_number);
1002 label.assign(str);
1003 sprintf(str, "BLT\\_%d", case_number);
1004 label_tex.assign(str);
1005
1006 CG->init(nb_candidates /* nb_points */, nb_colors, 1 /* nb_colors_per_vertex */,
1007 point_color, Bitvec, TRUE,
1008 label, label_tex,
1009 verbose_level - 2);
1010 // Bitvec becomes part of the colored_graph object
1011 }
1012 int i;
1013 for (i = 0; i < nb_candidates; i++) {
1014 CG->points[i] = candidates[i];
1015 }
1016
1017 {
1018
1019 char str[1000];
1020 std::string fname;
1021
1022 sprintf(str, "_graph_%d_%d", starter_size, case_number);
1023 fname.assign(prefix);
1024 fname.append(str);
1025 CG->init_user_data(Starter_set, starter_size, verbose_level - 2);
1026 CG->fname_base.assign(fname);
1027 }
1028
1029
1030 if (f_v) {
1031 cout << "blt_set_domain::create_graph colored_graph created" << endl;
1032 }
1033
1034finish:
1035
1036 FREE_lint(lines_on_pt);
1037 FREE_int(point_color);
1038 if (f_v) {
1039 cout << "blt_set_domain::create_graph done" << endl;
1040 }
1041 return ret;
1042}
1043
1044
1045}}}
1046
compact storage of 0/1-data as bitvectors
a collection of functions related to sorted vectors
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
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 init_lint(long int *data, int data_length, int f_second, int verbose_level)
Definition: tally.cpp:123
int add5(int i1, int i2, int i3, int i4, int i5)
to rank and unrank subspaces of a fixed dimension in F_q^n
Definition: geometry.h:892
void init(int n, int k, field_theory::finite_field *F, int verbose_level)
Definition: grassmann.cpp:70
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
void projective_space_init(int n, field_theory::finite_field *F, int f_init_incidence_structure, int verbose_level)
void init_user_data(long int *data, int data_size, int verbose_level)
void init(int nb_points, int nb_colors, int nb_colors_per_vertex, int *colors, data_structures::bitvector *Bitvec, int f_ownership_of_bitvec, std::string &label, std::string &label_tex, int verbose_level)
int pair_test(int a, int x, int y, 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)
int collinearity_test(long int *S, int len, int verbose_level)
void compute_adjacency_list_fast(int first_point_of_starter, long int *points, int nb_points, int *point_color, data_structures::bitvector *&Bitvec, int verbose_level)
void find_free_points(long int *S, int S_sz, long int *&free_pts, int *&free_pt_idx, int &nb_free_pts, int verbose_level)
void compute_colors(int orbit_at_level, long int *starter, int starter_sz, long int special_line, long int *candidates, int nb_candidates, int *&point_color, int &nb_colors, int verbose_level)
void print(std::ostream &ost, long int *S, int len)
int create_graph(int case_number, int nb_cases_total, long int *Starter_set, int starter_size, long int *candidates, int nb_candidates, int f_eliminate_graphs_if_possible, graph_theory::colored_graph *&CG, int verbose_level)
int check_conditions(int len, long int *S, int verbose_level)
void points_on_line_by_line_rank(long int line_rk, long int *line, int verbose_level)
void lines_on_point_by_line_rank(long int pt, long int *line_pencil_line_ranks, int verbose_level)
void unrank_point(int *v, int stride, long int rk, int verbose_level)
void unrank_line(long int &p1, long int &p2, long int index, int verbose_level)
int BLT_test(int size, long int *set, int verbose_level)
void points_on_line(long int pi, long int pj, long int *line, int verbose_level)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define Lint_matrix_print(A, B, C)
Definition: foundations.h:708
#define FREE_int(p)
Definition: foundations.h:640
#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