Orbiter 2022
Combinatorial Objects
arc_in_projective_space.cpp
Go to the documentation of this file.
1/*
2 * arc_in_projective_space.cpp
3 *
4 * Created on: Nov 26, 2021
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13
14using namespace std;
15
16
17
18namespace orbiter {
19namespace layer1_foundations {
20namespace geometry {
21
22
24{
25 P = NULL;
26
27}
28
30{
31
32}
33
35{
36 int f_v = (verbose_level >= 1);
37
38 if (f_v) {
39 cout << "arc_in_projective_space::init" << endl;
40 }
41
43
44 if (f_v) {
45 cout << "arc_in_projective_space::init done" << endl;
46 }
47}
48
50 long int *the_arc, int &size, int verbose_level)
51{
52 int f_v = (verbose_level >= 1);
53 int frame_data[] = {1,0,0, 0,1,0, 0,0,1, 1,1,1 };
54 int frame[4];
55 int i, j, b, h, idx;
56 int L[3];
57 int v[3];
59
60 if (P->n != 2) {
61 cout << "arc_in_projective_space::PG_2_8_create_conic_plus_nucleus_arc_1 "
62 "P->n != 2" << endl;
63 exit(1);
64 }
65 if (P->q != 8) {
66 cout << "arc_in_projective_space::PG_2_8_create_conic_plus_nucleus_arc_1 "
67 "P->q != 8" << endl;
68 exit(1);
69 }
70 for (i = 0; i < 4; i++) {
71 frame[i] = P->rank_point(frame_data + i * 3);
72 }
73
74 if (f_v) {
75 cout << "frame: ";
76 Int_vec_print(cout, frame, 4);
77 cout << endl;
78 }
79
80 L[0] = P->Implementation->Line_through_two_points[frame[0] * P->N_points + frame[1]];
81 L[1] = P->Implementation->Line_through_two_points[frame[1] * P->N_points + frame[2]];
82 L[2] = P->Implementation->Line_through_two_points[frame[2] * P->N_points + frame[0]];
83
84 if (f_v) {
85 cout << "l1=" << L[0] << " l2=" << L[1] << " l3=" << L[2] << endl;
86 }
87
88 size = 0;
89 for (h = 0; h < 3; h++) {
90 for (i = 0; i < P->r; i++) {
91 b = P->Implementation->Lines[L[h] * P->r + i];
92 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
93 continue;
94 }
95 for (j = size; j > idx; j--) {
96 the_arc[j] = the_arc[j - 1];
97 }
98 the_arc[idx] = b;
99 size++;
100 }
101 }
102 if (f_v) {
103 cout << "there are " << size << " points on the three lines: ";
104 Lint_vec_print(cout, the_arc, size);
105 cout << endl;
106 }
107
108
109 for (i = 1; i < P->q; i++) {
110 v[0] = 1;
111 v[1] = i;
112 v[2] = P->F->mult(i, i);
113 b = P->rank_point(v);
114 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
115 continue;
116 }
117 for (j = size; j > idx; j--) {
118 the_arc[j] = the_arc[j - 1];
119 }
120 the_arc[idx] = b;
121 size++;
122
123 }
124
125 if (f_v) {
126 cout << "arc_in_projective_space::PG_2_8_create_conic_plus_nucleus_arc_1: after adding the rest of the "
127 "conic, there are " << size << " points on the arc: ";
128 Lint_vec_print(cout, the_arc, size);
129 cout << endl;
130 }
131}
132
134 long int *the_arc, int &size, int verbose_level)
135{
136 int f_v = (verbose_level >= 1);
137 int frame_data[] = {1,0,0, 0,1,0, 0,0,1, 1,1,1 };
138 int frame[4];
139 int i, j, b, h, idx;
140 int L[3];
141 int v[3];
143
144 if (P->n != 2) {
145 cout << "arc_in_projective_space::PG_2_8_create_conic_plus_"
146 "nucleus_arc_2 P->n != 2" << endl;
147 exit(1);
148 }
149 if (P->q != 8) {
150 cout << "arc_in_projective_space::PG_2_8_create_conic_plus_"
151 "nucleus_arc_2 P->q != 8" << endl;
152 exit(1);
153 }
154 for (i = 0; i < 4; i++) {
155 frame[i] = P->rank_point(frame_data + i * 3);
156 }
157
158 if (f_v) {
159 cout << "frame: ";
160 Int_vec_print(cout, frame, 4);
161 cout << endl;
162 }
163
164 L[0] = P->Implementation->Line_through_two_points[frame[0] * P->N_points + frame[2]];
165 L[1] = P->Implementation->Line_through_two_points[frame[2] * P->N_points + frame[3]];
166 L[2] = P->Implementation->Line_through_two_points[frame[3] * P->N_points + frame[0]];
167
168 if (f_v) {
169 cout << "l1=" << L[0] << " l2=" << L[1] << " l3=" << L[2] << endl;
170 }
171
172 size = 0;
173 for (h = 0; h < 3; h++) {
174 for (i = 0; i < P->r; i++) {
175 b = P->Implementation->Lines[L[h] * P->r + i];
176 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
177 continue;
178 }
179 for (j = size; j > idx; j--) {
180 the_arc[j] = the_arc[j - 1];
181 }
182 the_arc[idx] = b;
183 size++;
184 }
185 }
186 if (f_v) {
187 cout << "there are " << size << " points on the three lines: ";
188 Lint_vec_print(cout, the_arc, size);
189 cout << endl;
190 }
191
192
193 for (i = 0; i < P->q; i++) {
194 if (i == 1) {
195 v[0] = 0;
196 v[1] = 1;
197 v[2] = 0;
198 }
199 else {
200 v[0] = 1;
201 v[1] = i;
202 v[2] = P->F->mult(i, i);
203 }
204 b = P->rank_point(v);
205 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
206 continue;
207 }
208 for (j = size; j > idx; j--) {
209 the_arc[j] = the_arc[j - 1];
210 }
211 the_arc[idx] = b;
212 size++;
213
214 }
215
216 if (f_v) {
217 cout << "arc_in_projective_space::PG_2_8_create_conic_plus_"
218 "nucleus_arc_2: after adding the rest of the conic, "
219 "there are " << size << " points on the arc: ";
220 Lint_vec_print(cout, the_arc, size);
221 cout << endl;
222 }
223}
224
226 long int *the_arc, int &size, int verbose_level)
227{
228 int f_v = (verbose_level >= 1);
229 int data[] = {
230 0,1,2, 0,1,3, 0,1,4, 0,1,5,
231 1,0,7, 1,0,8, 1,0,9, 1,0,10,
232 1,2,0, 1,3,0, 1,4,0, 1,5,0,
233 1,7,5, 1,8,4, 1,9,3, 1,10,2,
234 1,1,1, 1,1,10, 1,10,1, 1,4,4,
235 1,12,0, 1,0,12
236 };
237 int points[22];
238 int i, j, b, h, idx;
239 long int L[4];
240 int v[3];
242
243 if (P->n != 2) {
244 cout << "arc_in_projective_space::create_Maruta_Hamada_arc "
245 "n != 2" << endl;
246 exit(1);
247 }
248 if (P->q != 13) {
249 cout << "arc_in_projective_space::create_Maruta_Hamada_arc "
250 "q != 13" << endl;
251 exit(1);
252 }
253 for (i = 0; i < 22; i++) {
254 points[i] = P->rank_point(data + i * 3);
255 cout << "point " << i << " has rank " << points[i] << endl;
256 }
257
258 if (f_v) {
259 cout << "arc_in_projective_space::create_Maruta_Hamada_arc "
260 "points: ";
261 Int_vec_print(cout, points, 22);
262 cout << endl;
263 }
264
268 L[3] = P->Implementation->Line_through_two_points[points[20] * P->N_points + points[21]];
269
270 if (f_v) {
271 cout << "L:";
272 Lint_vec_print(cout, L, 4);
273 cout << endl;
274 }
275
276 if (f_v) {
277 for (h = 0; h < 4; h++) {
278 cout << "h=" << h << " : L[h]=" << L[h] << " : " << endl;
279 for (i = 0; i < P->r; i++) {
280 b = P->Implementation->Lines[L[h] * P->r + i];
281 cout << "point " << b << " = ";
282 P->unrank_point(v, b);
284 Int_vec_print(cout, v, 3);
285 cout << endl;
286 }
287 cout << endl;
288 }
289 }
290 size = 0;
291 for (h = 0; h < 4; h++) {
292 for (i = 0; i < P->r; i++) {
293 b = P->Implementation->Lines[L[h] * P->r + i];
294 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
295 continue;
296 }
297 for (j = size; j > idx; j--) {
298 the_arc[j] = the_arc[j - 1];
299 }
300 the_arc[idx] = b;
301 size++;
302 }
303 }
304 if (f_v) {
305 cout << "there are " << size
306 << " points on the quadrilateral: ";
307 Lint_vec_print(cout, the_arc, size);
308 cout << endl;
309 }
310
311
312 // remove the first 16 points:
313 for (i = 0; i < 16; i++) {
314 if (f_v) {
315 cout << "removing point " << i << " : "
316 << points[i] << endl;
317 }
318 if (!Sorting.lint_vec_search(the_arc, size, points[i], idx, 0)) {
319 cout << "error, cannot find point to be removed" << endl;
320 exit(1);
321 }
322 for (j = idx; j < size; j++) {
323 the_arc[j] = the_arc[j + 1];
324 }
325 size--;
326 }
327
328 // add points 16-19:
329 for (i = 16; i < 20; i++) {
330 if (Sorting.lint_vec_search(the_arc, size, points[i], idx, 0)) {
331 cout << "error, special point already there" << endl;
332 exit(1);
333 }
334 for (j = size; j > idx; j--) {
335 the_arc[j] = the_arc[j - 1];
336 }
337 the_arc[idx] = points[i];
338 size++;
339 }
340
341 if (f_v) {
342 cout << "arc_in_projective_space::create_Maruta_Hamada_arc: "
343 "after adding the special point, there are "
344 << size << " points on the arc: ";
345 Lint_vec_print(cout, the_arc, size);
346 cout << endl;
347 }
348
349}
350
352 long int *the_arc, int &size, int verbose_level)
353{
354 int f_v = (verbose_level >= 1);
355 int data[] = {
356 1,6,2, 1,11,4, 1,5,5, 1,2,6, 1,10,7, 1,12,8, 1,7,10, 1,4,11, 1,8,12,
357 0,1,10, 0,1,12, 0,1,4, 1,0,1, 1,0,3, 1,0,9, 1,1,0, 1,3,0, 1,9,0,
358 1,4,4, 1,4,12, 1,12,4, 1,10,10, 1,10,12, 1,12,10
359 };
360 int points[24];
361 int i, j, a;
362 int L[9];
363
364 if (P->n != 2) {
365 cout << "arc_in_projective_space::create_Maruta_Hamada_arc2 "
366 "P->n != 2" << endl;
367 exit(1);
368 }
369 if (P->q != 13) {
370 cout << "arc_in_projective_space::create_Maruta_Hamada_arc2 "
371 "P->q != 13" << endl;
372 exit(1);
373 }
374 for (i = 0; i < 24; i++) {
375 points[i] = P->rank_point(data + i * 3);
376 cout << "point " << i << " has rank " << points[i] << endl;
377 }
378
379 if (f_v) {
380 cout << "arc_in_projective_space::create_Maruta_Hamada_arc2 "
381 "points: ";
382 Int_vec_print(cout, points, 25);
383 cout << endl;
384 }
385 for (i = 0; i < 9; i++) {
386 L[i] = P->Standard_polarity->Point_to_hyperplane[points[i]];
387 }
388 size = 0;
389 for (i = 0; i < 9; i++) {
390 for (j = i + 1; j < 9; j++) {
391 a = P->intersection_of_two_lines(L[i], L[j]);
392 the_arc[size++] = a;
393 }
394 }
395 for (i = 9; i < 24; i++) {
396 the_arc[size++] = points[i];
397 }
398 if (f_v) {
399 cout << "arc_in_projective_space::create_Maruta_Hamada_arc2: "
400 "there are " << size << " points on the arc: ";
401 Lint_vec_print(cout, the_arc, size);
402 cout << endl;
403 }
404}
405
406
408 long int *the_arc, int &size, int verbose_level)
409{
410 int f_v = (verbose_level >= 1);
411 int data[] = {1,1,1, 1,0,0, 0,1,1, 0,1,0, 1,0,1 };
412 int points[5];
413 int i, j, b, h, idx;
414 int L[4];
416
417 if (P->n != 2) {
418 cout << "arc_in_projective_space::create_pasch_arc "
419 "P->n != 2" << endl;
420 exit(1);
421 }
422#if 0
423 if (q != 8) {
424 cout << "arc_in_projective_space::create_pasch_arc "
425 "q != 8" << endl;
426 exit(1);
427 }
428#endif
429 for (i = 0; i < 5; i++) {
430 points[i] = P->rank_point(data + i * 3);
431 }
432
433 if (f_v) {
434 cout << "arc_in_projective_space::create_pasch_arc() points: ";
435 Int_vec_print(cout, points, 5);
436 cout << endl;
437 }
438
439 L[0] = P->Implementation->Line_through_two_points[points[0] * P->N_points + points[1]];
440 L[1] = P->Implementation->Line_through_two_points[points[0] * P->N_points + points[3]];
441 L[2] = P->Implementation->Line_through_two_points[points[2] * P->N_points + points[3]];
442 L[3] = P->Implementation->Line_through_two_points[points[1] * P->N_points + points[4]];
443
444 if (f_v) {
445 cout << "L:";
446 Int_vec_print(cout, L, 4);
447 cout << endl;
448 }
449
450 size = 0;
451 for (h = 0; h < 4; h++) {
452 for (i = 0; i < P->r; i++) {
453 b = P->Implementation->Lines[L[h] * P->r + i];
454 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
455 continue;
456 }
457 for (j = size; j > idx; j--) {
458 the_arc[j] = the_arc[j - 1];
459 }
460 the_arc[idx] = b;
461 size++;
462 }
463 }
464 if (f_v) {
465 cout << "there are " << size << " points on the pasch lines: ";
466 Lint_vec_print(cout, the_arc, size);
467 cout << endl;
468 }
469
470
471 P->v[0] = 1;
472 P->v[1] = 1;
473 P->v[2] = 0;
474 b = P->rank_point(P->v);
475 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
476 cout << "error, special point already there" << endl;
477 exit(1);
478 }
479 for (j = size; j > idx; j--) {
480 the_arc[j] = the_arc[j - 1];
481 }
482 the_arc[idx] = b;
483 size++;
484
485 if (f_v) {
486 cout << "arc_in_projective_space::create_pasch_arc: after "
487 "adding the special point, there are "
488 << size << " points on the arc: ";
489 Lint_vec_print(cout, the_arc, size);
490 cout << endl;
491 }
492}
493
495 long int *the_arc, int &size, int verbose_level)
496{
497 int f_v = (verbose_level >= 1);
498 int data[] = {1,0,0, 0,1,0, 0,0,1 };
499 int points[3];
500 int i, j, a, b, c, h, idx, t;
501 int L[3];
502 int pencil[9];
503 int Pencil[21];
505
506 if (P->n != 2) {
507 cout << "arc_in_projective_space::create_Cheon_arc P->n != 2" << endl;
508 exit(1);
509 }
510#if 0
511 if (P->q != 8) {
512 cout << "arc_in_projective_space::create_Cheon_arc P->q != 8" << endl;
513 exit(1);
514 }
515#endif
516 for (i = 0; i < 9; i++) {
517 pencil[i] = 0;
518 }
519 for (i = 0; i < 21; i++) {
520 Pencil[i] = 0;
521 }
522 for (i = 0; i < 3; i++) {
523 points[i] = P->rank_point(data + i * 3);
524 }
525
526 if (f_v) {
527 cout << "points: ";
528 Int_vec_print(cout, points, 5);
529 cout << endl;
530 }
531
532 L[0] = P->Implementation->Line_through_two_points[points[0] * P->N_points + points[1]];
533 L[1] = P->Implementation->Line_through_two_points[points[1] * P->N_points + points[2]];
534 L[2] = P->Implementation->Line_through_two_points[points[2] * P->N_points + points[0]];
535
536 if (f_v) {
537 cout << "L:";
538 Int_vec_print(cout, L, 3);
539 cout << endl;
540 }
541
542 size = 0;
543 for (h = 0; h < 3; h++) {
544 for (i = 0; i < P->r; i++) {
545 b = P->Implementation->Lines[L[h] * P->r + i];
546 if (Sorting.lint_vec_search(the_arc, size, b, idx, 0)) {
547 continue;
548 }
549 for (j = size; j > idx; j--) {
550 the_arc[j] = the_arc[j - 1];
551 }
552 the_arc[idx] = b;
553 size++;
554 }
555 }
556
557 if (f_v) {
558 cout << "arc_in_projective_space::create_Cheon_arc there are "
559 << size << " points on the 3 lines: ";
560 Lint_vec_print(cout, the_arc, size);
561 cout << endl;
562 }
563
564
565
566
567 for (h = 0; h < 3; h++) {
568
569 if (f_v) {
570 cout << "h=" << h << endl;
571 }
572
573 for (i = 0; i < P->r; i++) {
574 pencil[i] = P->Implementation->Lines_on_point[points[h] * P->r + i];
575 }
576
577
578 j = 0;
579 for (i = 0; i < P->r; i++) {
580 b = pencil[i];
581 if (b == L[0] || b == L[1] || b == L[2])
582 continue;
583 Pencil[h * 7 + j] = b;
584 j++;
585 }
586 if (j != 7) {
587 cout << "j=" << j << endl;
588 exit(1);
589 }
590 }
591 if (f_v) {
592 cout << "Pencil:" << endl;
593 Int_vec_print_integer_matrix_width(cout, Pencil, 3, 7, 7, 4);
594 }
595
596 for (i = 0; i < 7; i++) {
597 a = Pencil[0 * 7 + i];
598 for (j = 0; j < 7; j++) {
599 b = Pencil[1 * 7 + j];
600 if (f_v) {
601 cout << "i=" << i << " a=" << a << " j="
602 << j << " b=" << b << endl;
603 }
605 if (f_v) {
606 cout << "c=" << c << endl;
607 }
608 if (Sorting.lint_vec_search(the_arc, size, c, idx, 0)) {
609 continue;
610 }
611 for (t = size; t > idx; t--) {
612 the_arc[t] = the_arc[t - 1];
613 }
614 the_arc[idx] = c;
615 size++;
616#if 0
617 if (size > 31) {
618 cout << "create_Cheon_arc size=" << size << endl;
619 }
620#endif
621 }
622 }
623 if (f_v) {
624 cout << "there are " << size << " points on the Cheon lines: ";
625 Lint_vec_print(cout, the_arc, size);
626 cout << endl;
627 }
628
629
630}
631
632
634 long int *the_arc, int &size, int verbose_level)
635{
636 int f_v = (verbose_level >= 1);
637 int i;
638 int v[3];
639
640 if (P->n != 2) {
641 cout << "arc_in_projective_space::create_regular_hyperoval "
642 "P->n != 2" << endl;
643 exit(1);
644 }
645
646 for (i = 0; i < P->q; i++) {
647 v[0] = P->F->mult(i, i);
648 v[1] = i;
649 v[2] = 1;
650 the_arc[i] = P->rank_point(v);
651 }
652 v[0] = 1;
653 v[1] = 0;
654 v[2] = 0;
655 the_arc[P->q] = P->rank_point(v);
656
657 v[0] = 0;
658 v[1] = 1;
659 v[2] = 0;
660 the_arc[P->q + 1] = P->rank_point(v);
661
662 size = P->q + 2;
663
664 if (f_v) {
665 cout << "arc_in_projective_space::create_regular_hyperoval: "
666 "there are " << size << " points on the arc: ";
667 Lint_vec_print(cout, the_arc, size);
668 cout << endl;
669 }
670}
671
673 long int *the_arc, int &size,
674 int exponent, int verbose_level)
675{
676 int f_v = (verbose_level >= 1);
677 int i;
678 int v[3];
679
680 if (f_v) {
681 cout << "arc_in_projective_space::create_translation_hyperoval" << endl;
682 cout << "exponent = " << exponent << endl;
683 }
684 if (P->n != 2) {
685 cout << "arc_in_projective_space::create_translation_hyperoval "
686 "P->n != 2" << endl;
687 exit(1);
688 }
689
690 for (i = 0; i < P->q; i++) {
691 v[0] = P->F->frobenius_power(i, exponent);
692 v[1] = i;
693 v[2] = 1;
694 the_arc[i] = P->rank_point(v);
695 }
696 v[0] = 1;
697 v[1] = 0;
698 v[2] = 0;
699 the_arc[P->q] = P->rank_point(v);
700
701 v[0] = 0;
702 v[1] = 1;
703 v[2] = 0;
704 the_arc[P->q + 1] = P->rank_point(v);
705
706 size = P->q + 2;
707
708 if (f_v) {
709 cout << "arc_in_projective_space::create_translation_hyperoval: "
710 "there are " << size << " points on the arc: ";
711 Lint_vec_print(cout, the_arc, size);
712 cout << endl;
713 }
714 if (f_v) {
715 cout << "arc_in_projective_space::create_translation_hyperoval "
716 "done" << endl;
717 }
718}
719
721 long int *the_arc, int &size, int verbose_level)
722{
723 int f_v = (verbose_level >= 1);
724 int i;
725 int v[3];
726
727 if (P->n != 2) {
728 cout << "arc_in_projective_space::create_Segre_hyperoval "
729 "n != 2" << endl;
730 exit(1);
731 }
732
733 for (i = 0; i < P->q; i++) {
734 v[0] = P->F->power(i, 6);
735 v[1] = i;
736 v[2] = 1;
737 the_arc[i] = P->rank_point(v);
738 }
739 v[0] = 1;
740 v[1] = 0;
741 v[2] = 0;
742 the_arc[P->q] = P->rank_point(v);
743
744 v[0] = 0;
745 v[1] = 1;
746 v[2] = 0;
747 the_arc[P->q + 1] = P->rank_point(v);
748
749 size = P->q + 2;
750
751 if (f_v) {
752 cout << "arc_in_projective_space::create_Segre_hyperoval: "
753 "there are " << size << " points on the arc: ";
754 Lint_vec_print(cout, the_arc, size);
755 cout << endl;
756 }
757}
758
760 long int *the_arc, int &size, int verbose_level)
761{
762 int f_v = (verbose_level >= 1);
763 int i;
764 int v[3];
766 ring_theory::longinteger_object a, b, u, u2, g;
767 int exponent;
768 int one_sixth, one_half, five_sixth;
769
770 if (f_v) {
771 cout << "arc_in_projective_space::create_Payne_hyperoval" << endl;
772 }
773 if (P->n != 2) {
774 cout << "arc_in_projective_space::create_Payne_hyperoval P->n != 2" << endl;
775 exit(1);
776 }
777 exponent = P->q - 1;
778 a.create(6, __FILE__, __LINE__);
779 b.create(exponent, __FILE__, __LINE__);
780
781 D.extended_gcd(a, b, g, u, u2, 0 /* verbose_level */);
782 one_sixth = u.as_int();
783 while (one_sixth < 0) {
784 one_sixth += exponent;
785 }
786 if (f_v) {
787 cout << "one_sixth = " << one_sixth << endl;
788 }
789
790 a.create(2, __FILE__, __LINE__);
791 D.extended_gcd(a, b, g, u, u2, 0 /* verbose_level */);
792 one_half = u.as_int();
793 while (one_half < 0) {
794 one_half += exponent;
795 }
796 if (f_v) {
797 cout << "one_half = " << one_half << endl;
798 }
799
800 five_sixth = (5 * one_sixth) % exponent;
801 if (f_v) {
802 cout << "five_sixth = " << five_sixth << endl;
803 }
804
805 for (i = 0; i < P->q; i++) {
806 v[0] = P->F->add3(
807 P->F->power(i, one_sixth),
808 P->F->power(i, one_half),
809 P->F->power(i, five_sixth));
810 v[1] = i;
811 v[2] = 1;
812 the_arc[i] = P->rank_point(v);
813 }
814 v[0] = 1;
815 v[1] = 0;
816 v[2] = 0;
817 the_arc[P->q] = P->rank_point(v);
818
819 v[0] = 0;
820 v[1] = 1;
821 v[2] = 0;
822 the_arc[P->q + 1] = P->rank_point(v);
823
824 size = P->q + 2;
825
826 if (f_v) {
827 cout << "arc_in_projective_space::create_Payne_hyperoval: "
828 "there are " << size << " points on the arc: ";
829 Lint_vec_print(cout, the_arc, size);
830 cout << endl;
831 }
832}
833
835 long int *the_arc, int &size, int verbose_level)
836{
837 int f_v = (verbose_level >= 1);
838 int i;
839 int v[3];
840 int h;
841 int sigma;
842 int exponent, one_half, e1, e2, e3;
844
845 if (f_v) {
846 cout << "arc_in_projective_space::create_Cherowitzo_hyperoval" << endl;
847 }
848 if (P->n != 2) {
849 cout << "arc_in_projective_space::create_Cherowitzo_hyperoval "
850 "P->n != 2" << endl;
851 exit(1);
852 }
853 h = P->F->e;
854 if (EVEN(h)) {
855 cout << "arc_in_projective_space::create_Cherowitzo_hyperoval "
856 "field degree must be odd" << endl;
857 exit(1);
858 }
859 if (P->F->p != 2) {
860 cout << "arc_in_projective_space::create_Cherowitzo_hyperoval "
861 "needs characteristic 2" << endl;
862 exit(1);
863 }
864 exponent = P->q - 1;
865 one_half = (h + 1) >> 1;
866 sigma = NT.i_power_j(2, one_half);
867 e1 = sigma;
868 e2 = (sigma + 2) % exponent;
869 e3 = (3 * sigma + 4) % exponent;
870
871 for (i = 0; i < P->q; i++) {
872 v[0] = P->F->add3(
873 P->F->power(i, e1),
874 P->F->power(i, e2),
875 P->F->power(i, e3));
876 v[1] = i;
877 v[2] = 1;
878 the_arc[i] = P->rank_point(v);
879 }
880 v[0] = 1;
881 v[1] = 0;
882 v[2] = 0;
883 the_arc[P->q] = P->rank_point(v);
884
885 v[0] = 0;
886 v[1] = 1;
887 v[2] = 0;
888 the_arc[P->q + 1] = P->rank_point(v);
889
890 size = P->q + 2;
891
892 if (f_v) {
893 cout << "arc_in_projective_space::create_Cherowitzo_hyperoval: "
894 "there are " << size << " points on the arc: ";
895 Lint_vec_print(cout, the_arc, size);
896 cout << endl;
897 }
898}
899
901 long int *the_arc, int &size, int verbose_level)
902{
903 int f_v = (verbose_level >= 1);
904 int i;
905 int v[3];
906
907 if (f_v) {
908 cout << "arc_in_projective_space::create_OKeefe_Penttila_hyperoval_32"
909 << endl;
910 }
911 if (P->n != 2) {
912 cout << "arc_in_projective_space::create_OKeefe_Penttila_hyperoval_32 "
913 "P->n != 2" << endl;
914 exit(1);
915 }
916 if (P->F->q != 32) {
917 cout << "arc_in_projective_space::create_OKeefe_Penttila_hyperoval_32 "
918 "needs q=32" << endl;
919 exit(1);
920 }
921
922 {
923 arc_basic A;
924
925 A.init(P->F, verbose_level - 1);
926
927 for (i = 0; i < P->q; i++) {
928
929
930 v[0] = A.OKeefe_Penttila_32(i);
931 v[1] = i;
932 v[2] = 1;
933 the_arc[i] = P->rank_point(v);
934 }
935 }
936 v[0] = 1;
937 v[1] = 0;
938 v[2] = 0;
939 the_arc[P->q] = P->rank_point(v);
940
941 v[0] = 0;
942 v[1] = 1;
943 v[2] = 0;
944 the_arc[P->q + 1] = P->rank_point(v);
945
946 size = P->q + 2;
947
948 if (f_v) {
949 cout << "arc_in_projective_space::create_OKeefe_Penttila_hyperoval_32: "
950 "there are " << size << " points on the arc: ";
951 Lint_vec_print(cout, the_arc, size);
952 cout << endl;
953 }
954}
955
957 long int *arc, int arc_sz,
958 int target_sz, int target_d,
960 int verbose_level)
961{
962 int f_v = (verbose_level >= 1);
963 int f_vv = (verbose_level >= 5);
964 int *line_type;
965 int i, j, h, pt;
966 long int *free_points;
967 int nb_free_points;
969
970 if (f_v) {
971 cout << "arc_in_projective_space::arc_lifting_diophant" << endl;
972 }
973
974 free_points = NEW_lint(P->N_points);
975
976 Combi.set_complement_lint(arc, arc_sz,
977 free_points, nb_free_points, P->N_points);
978
979
980
981 line_type = NEW_int(P->N_lines);
982 P->line_intersection_type(arc, arc_sz,
983 line_type, 0 /* verbose_level */);
984 if (f_vv) {
985 cout << "line_type: ";
986 Int_vec_print_fully(cout, line_type, P->N_lines);
987 cout << endl;
988 }
989
990 if (f_vv) {
991 cout << "line type:" << endl;
992 for (i = 0; i < P->N_lines; i++) {
993 cout << i << " : " << line_type[i] << endl;
994 }
995 }
996
998 C.init(line_type, P->N_lines, FALSE, 0);
999 if (f_v) {
1000 cout << "arc_in_projective_space::arc_lifting_diophant line_type:";
1001 C.print_naked(TRUE);
1002 cout << endl;
1003 cout << "nb_free_points=" << nb_free_points << endl;
1004 }
1005
1006
1008 D->open(P->N_lines + 1, nb_free_points);
1009 //D->f_x_max = TRUE;
1010 for (j = 0; j < nb_free_points; j++) {
1011 D->x_min[j] = 0;
1012 D->x_max[j] = 1;
1013 }
1014 D->f_has_sum = TRUE;
1015 D->sum = target_sz - arc_sz;
1016 h = 0;
1017 for (i = 0; i < P->N_lines; i++) {
1018 if (line_type[i] > P->k) {
1019 cout << "arc_in_projective_space::arc_lifting_diophant "
1020 "line_type[i] > P->k" << endl;
1021 exit(1);
1022 }
1023 #if 0
1024 if (line_type[i] < P->k - 1) {
1025 continue;
1026 }
1027 #endif
1028 for (j = 0; j < nb_free_points; j++) {
1029 pt = free_points[j];
1030 if (P->is_incident(pt, i /* line */)) {
1031 D->Aij(h, j) = 1;
1032 }
1033 else {
1034 D->Aij(h, j) = 0;
1035 }
1036 }
1037 D->type[h] = t_LE;
1038 D->RHSi(h) = target_d - line_type[i];
1039 h++;
1040 }
1041
1042
1043 // add one extra row:
1044 for (j = 0; j < nb_free_points; j++) {
1045 D->Aij(h, j) = 1;
1046 }
1047 D->type[h] = t_EQ;
1048 D->RHSi(h) = target_sz - arc_sz;
1049 h++;
1050
1051 D->m = h;
1052
1053 D->init_var_labels(free_points, verbose_level);
1054
1055 if (f_vv) {
1056 cout << "arc_in_projective_space::arc_lifting_diophant "
1057 "The system is:" << endl;
1058 D->print_tight();
1059 }
1060
1061#if 0
1062 if (f_save_system) {
1063 cout << "arc_in_projective_space saving the system "
1064 "to file " << fname_system << endl;
1065 D->save_in_general_format(fname_system, 0 /* verbose_level */);
1066 cout << "arc_in_projective_space saving the system "
1067 "to file " << fname_system << " done" << endl;
1068 D->print();
1069 D->print_tight();
1070 }
1071#endif
1072
1073 FREE_int(line_type);
1074 FREE_lint(free_points);
1075
1076 if (f_v) {
1077 cout << "arc_in_projective_space::arc_lifting_diophant done" << endl;
1078 }
1079
1080}
1081
1083 long int *s_lines, int nb_s_lines,
1084 int target_sz, int arc_d, int arc_d_low, int arc_s,
1085 int f_dualize,
1087 int verbose_level)
1088{
1089 int f_v = (verbose_level >= 1);
1090 int f_vv = (verbose_level >= 5);
1091 int i, j, h, a, line;
1092 long int *other_lines;
1093 int nb_other_lines;
1095
1096 if (f_v) {
1097 cout << "arc_in_projective_space::arc_with_given_set_of_s_lines_diophant" << endl;
1098 }
1099
1100 other_lines = NEW_lint(P->N_points);
1101
1102 Combi.set_complement_lint(s_lines, nb_s_lines,
1103 other_lines, nb_other_lines, P->N_lines);
1104
1105
1106 if (f_dualize) {
1107 if (P->Standard_polarity == NULL) {
1108 cout << "arc_in_projective_space::arc_with_given_set_of_s_lines_diophant "
1109 "Standard_polarity == NULL" << endl;
1110 exit(1);
1111 }
1112 }
1113
1114
1116 D->open(P->N_lines + 1, P->N_points);
1117 //D->f_x_max = TRUE;
1118 for (j = 0; j < P->N_points; j++) {
1119 D->x_min[j] = 0;
1120 D->x_max[j] = 1;
1121 }
1122 D->f_has_sum = TRUE;
1123 D->sum = target_sz;
1124 h = 0;
1125 for (i = 0; i < nb_s_lines; i++) {
1126 if (f_dualize) {
1127 line = P->Standard_polarity->Point_to_hyperplane[s_lines[i]];
1128 }
1129 else {
1130 line = s_lines[i];
1131 }
1132 for (j = 0; j < P->N_points; j++) {
1133 if (P->is_incident(j, line)) {
1134 a = 1;
1135 }
1136 else {
1137 a = 0;
1138 }
1139 D->Aij(h, j) = a;
1140 }
1141 D->type[h] = t_EQ;
1142 D->RHSi(h) = arc_s;
1143 h++;
1144 }
1145 for (i = 0; i < nb_other_lines; i++) {
1146 if (f_dualize) {
1147 line = P->Standard_polarity->Point_to_hyperplane[other_lines[i]];
1148 }
1149 else {
1150 line = other_lines[i];
1151 }
1152 for (j = 0; j < P->N_points; j++) {
1153 if (P->is_incident(j, line)) {
1154 a = 1;
1155 }
1156 else {
1157 a = 0;
1158 }
1159 D->Aij(h, j) = a;
1160 }
1161 D->type[h] = t_INT;
1162 D->RHSi(h) = arc_d;
1163 D->RHS_low_i(h) = arc_d_low;
1164 //D->type[h] = t_LE;
1165 //D->RHSi(h) = arc_d;
1166 h++;
1167 }
1168
1169
1170 // add one extra row:
1171 for (j = 0; j < P->N_points; j++) {
1172 D->Aij(h, j) = 1;
1173 }
1174 D->type[h] = t_EQ;
1175 D->RHSi(h) = target_sz;
1176 h++;
1177
1178 D->m = h;
1179
1180 //D->init_var_labels(N_points, verbose_level);
1181
1182 if (f_vv) {
1183 cout << "arc_in_projective_space::arc_with_given_set_of_s_lines_diophant "
1184 "The system is:" << endl;
1185 D->print_tight();
1186 }
1187
1188#if 0
1189 if (f_save_system) {
1190 cout << "do_arc_lifting saving the system "
1191 "to file " << fname_system << endl;
1192 D->save_in_general_format(fname_system, 0 /* verbose_level */);
1193 cout << "do_arc_lifting saving the system "
1194 "to file " << fname_system << " done" << endl;
1195 D->print();
1196 D->print_tight();
1197 }
1198#endif
1199
1200 FREE_lint(other_lines);
1201
1202 if (f_v) {
1203 cout << "arc_in_projective_space::arc_with_given_set_of_s_lines_diophant done" << endl;
1204 }
1205
1206}
1207
1208
1210 long int *s_lines, int nb_s_lines, int arc_s,
1211 long int *t_lines, int nb_t_lines, int arc_t,
1212 int target_sz, int arc_d, int arc_d_low,
1213 int f_dualize,
1215 int verbose_level)
1216{
1217 int f_v = (verbose_level >= 1);
1218 int f_vv = (verbose_level >= 5);
1219 int i, j, h, a, line;
1220 long int *other_lines;
1221 int nb_other_lines;
1224
1225 if (f_v) {
1226 cout << "arc_in_projective_space::arc_with_two_given_line_sets_diophant" << endl;
1227 }
1228
1229 other_lines = NEW_lint(P->N_points);
1230
1231 Lint_vec_copy(s_lines, other_lines, nb_s_lines);
1232 Lint_vec_copy(t_lines, other_lines + nb_s_lines, nb_t_lines);
1233 Sorting.lint_vec_heapsort(other_lines, nb_s_lines + nb_t_lines);
1234
1235 Combi.set_complement_lint(other_lines, nb_s_lines + nb_t_lines,
1236 other_lines + nb_s_lines + nb_t_lines, nb_other_lines, P->N_lines);
1237
1238
1239 if (f_dualize) {
1240 if (P->Standard_polarity == NULL) {
1241 cout << "arc_in_projective_space::arc_with_two_given_line_sets_diophant "
1242 "Standard_polarity == NULL" << endl;
1243 exit(1);
1244 }
1245 }
1246
1247
1249 D->open(P->N_lines + 1, P->N_points);
1250 //D->f_x_max = TRUE;
1251 for (j = 0; j < P->N_points; j++) {
1252 D->x_min[j] = 0;
1253 D->x_max[j] = 1;
1254 }
1255 D->f_has_sum = TRUE;
1256 D->sum = target_sz;
1257 h = 0;
1258 for (i = 0; i < nb_s_lines; i++) {
1259 if (f_dualize) {
1260 line = P->Standard_polarity->Point_to_hyperplane[s_lines[i]];
1261 }
1262 else {
1263 line = s_lines[i];
1264 }
1265 for (j = 0; j < P->N_points; j++) {
1266 if (P->is_incident(j, line)) {
1267 a = 1;
1268 }
1269 else {
1270 a = 0;
1271 }
1272 D->Aij(h, j) = a;
1273 }
1274 D->type[h] = t_EQ;
1275 D->RHSi(h) = arc_s;
1276 h++;
1277 }
1278 for (i = 0; i < nb_t_lines; i++) {
1279 if (f_dualize) {
1280 line = P->Standard_polarity->Point_to_hyperplane[t_lines[i]];
1281 }
1282 else {
1283 line = t_lines[i];
1284 }
1285 for (j = 0; j < P->N_points; j++) {
1286 if (P->is_incident(j, line)) {
1287 a = 1;
1288 }
1289 else {
1290 a = 0;
1291 }
1292 D->Aij(h, j) = a;
1293 }
1294 D->type[h] = t_EQ;
1295 D->RHSi(h) = arc_t;
1296 h++;
1297 }
1298 for (i = 0; i < nb_other_lines; i++) {
1299 int l;
1300
1301 l = other_lines[nb_s_lines + nb_t_lines + i];
1302 if (f_dualize) {
1304 }
1305 else {
1306 line = l;
1307 }
1308 for (j = 0; j < P->N_points; j++) {
1309 if (P->is_incident(j, line)) {
1310 a = 1;
1311 }
1312 else {
1313 a = 0;
1314 }
1315 D->Aij(h, j) = a;
1316 }
1317 D->type[h] = t_INT;
1318 D->RHSi(h) = arc_d;
1319 D->RHS_low_i(h) = arc_d_low;
1320 //D->type[h] = t_LE;
1321 //D->RHSi(h) = arc_d;
1322 h++;
1323 }
1324
1325
1326 // add one extra row:
1327 for (j = 0; j < P->N_points; j++) {
1328 D->Aij(h, j) = 1;
1329 }
1330 D->type[h] = t_EQ;
1331 D->RHSi(h) = target_sz;
1332 h++;
1333
1334 D->m = h;
1335
1336 //D->init_var_labels(N_points, verbose_level);
1337
1338 if (f_vv) {
1339 cout << "arc_in_projective_space::arc_with_two_given_line_sets_diophant "
1340 "The system is:" << endl;
1341 D->print_tight();
1342 }
1343
1344#if 0
1345 if (f_save_system) {
1346 cout << "do_arc_lifting saving the system "
1347 "to file " << fname_system << endl;
1348 D->save_in_general_format(fname_system, 0 /* verbose_level */);
1349 cout << "do_arc_lifting saving the system "
1350 "to file " << fname_system << " done" << endl;
1351 D->print();
1352 D->print_tight();
1353 }
1354#endif
1355
1356 FREE_lint(other_lines);
1357
1358 if (f_v) {
1359 cout << "arc_in_projective_space::arc_with_two_given_line_sets_diophant done" << endl;
1360 }
1361
1362}
1363
1365 long int *s_lines, int nb_s_lines, int arc_s,
1366 long int *t_lines, int nb_t_lines, int arc_t,
1367 long int *u_lines, int nb_u_lines, int arc_u,
1368 int target_sz, int arc_d, int arc_d_low,
1369 int f_dualize,
1371 int verbose_level)
1372{
1373 int f_v = (verbose_level >= 1);
1374 int f_vv = (verbose_level >= 5);
1375 int i, j, h, a, line;
1376 long int *other_lines;
1377 int nb_other_lines;
1380
1381 if (f_v) {
1382 cout << "arc_in_projective_space::arc_with_three_given_line_sets_diophant" << endl;
1383 }
1384
1385 other_lines = NEW_lint(P->N_points);
1386
1387 Lint_vec_copy(s_lines, other_lines, nb_s_lines);
1388 Lint_vec_copy(t_lines, other_lines + nb_s_lines, nb_t_lines);
1389 Lint_vec_copy(u_lines, other_lines + nb_s_lines + nb_t_lines, nb_u_lines);
1390 Sorting.lint_vec_heapsort(other_lines, nb_s_lines + nb_t_lines + nb_u_lines);
1391
1392 Combi.set_complement_lint(other_lines, nb_s_lines + nb_t_lines + nb_u_lines,
1393 other_lines + nb_s_lines + nb_t_lines + nb_u_lines, nb_other_lines, P->N_lines);
1394
1395
1396 if (f_dualize) {
1397 if (P->Standard_polarity->Point_to_hyperplane == NULL) {
1398 cout << "arc_in_projective_space::arc_with_three_given_line_sets_diophant "
1399 "Polarity_point_to_hyperplane == NULL" << endl;
1400 exit(1);
1401 }
1402 }
1403
1404
1406 D->open(P->N_lines + 1, P->N_points);
1407 //D->f_x_max = TRUE;
1408 for (j = 0; j < P->N_points; j++) {
1409 D->x_min[j] = 0;
1410 D->x_max[j] = 1;
1411 }
1412 D->f_has_sum = TRUE;
1413 D->sum = target_sz;
1414 h = 0;
1415 for (i = 0; i < nb_s_lines; i++) {
1416 if (f_dualize) {
1417 line = P->Standard_polarity->Point_to_hyperplane[s_lines[i]];
1418 }
1419 else {
1420 line = s_lines[i];
1421 }
1422 for (j = 0; j < P->N_points; j++) {
1423 if (P->is_incident(j, line)) {
1424 a = 1;
1425 }
1426 else {
1427 a = 0;
1428 }
1429 D->Aij(h, j) = a;
1430 }
1431 D->type[h] = t_EQ;
1432 D->RHSi(h) = arc_s;
1433 h++;
1434 }
1435 for (i = 0; i < nb_t_lines; i++) {
1436 if (f_dualize) {
1437 line = P->Standard_polarity->Point_to_hyperplane[t_lines[i]];
1438 }
1439 else {
1440 line = t_lines[i];
1441 }
1442 for (j = 0; j < P->N_points; j++) {
1443 if (P->is_incident(j, line)) {
1444 a = 1;
1445 }
1446 else {
1447 a = 0;
1448 }
1449 D->Aij(h, j) = a;
1450 }
1451 D->type[h] = t_EQ;
1452 D->RHSi(h) = arc_t;
1453 h++;
1454 }
1455 for (i = 0; i < nb_u_lines; i++) {
1456 if (f_dualize) {
1457 line = P->Standard_polarity->Point_to_hyperplane[u_lines[i]];
1458 }
1459 else {
1460 line = u_lines[i];
1461 }
1462 for (j = 0; j < P->N_points; j++) {
1463 if (P->is_incident(j, line)) {
1464 a = 1;
1465 }
1466 else {
1467 a = 0;
1468 }
1469 D->Aij(h, j) = a;
1470 }
1471 D->type[h] = t_EQ;
1472 D->RHSi(h) = arc_u;
1473 h++;
1474 }
1475 for (i = 0; i < nb_other_lines; i++) {
1476 int l;
1477
1478 l = other_lines[nb_s_lines + nb_t_lines + nb_u_lines + i];
1479 if (f_dualize) {
1481 }
1482 else {
1483 line = l;
1484 }
1485 for (j = 0; j < P->N_points; j++) {
1486 if (P->is_incident(j, line)) {
1487 a = 1;
1488 }
1489 else {
1490 a = 0;
1491 }
1492 D->Aij(h, j) = a;
1493 }
1494 D->type[h] = t_INT;
1495 D->RHSi(h) = arc_d;
1496 D->RHS_low_i(h) = arc_d_low;
1497 h++;
1498 }
1499
1500
1501 // add one extra row:
1502 for (j = 0; j < P->N_points; j++) {
1503 D->Aij(h, j) = 1;
1504 }
1505 D->type[h] = t_EQ;
1506 D->RHSi(h) = target_sz;
1507 h++;
1508
1509 D->m = h;
1510
1511 //D->init_var_labels(N_points, verbose_level);
1512
1513 if (f_vv) {
1514 cout << "arc_in_projective_space::arc_with_three_given_line_sets_diophant "
1515 "The system is:" << endl;
1516 D->print_tight();
1517 }
1518
1519#if 0
1520 if (f_save_system) {
1521 cout << "arc_in_projective_space::arc_with_three_given_line_sets_diophant saving the system "
1522 "to file " << fname_system << endl;
1523 D->save_in_general_format(fname_system, 0 /* verbose_level */);
1524 cout << "arc_in_projective_space::arc_with_three_given_line_sets_diophant saving the system "
1525 "to file " << fname_system << " done" << endl;
1526 D->print();
1527 D->print_tight();
1528 }
1529#endif
1530
1531 FREE_lint(other_lines);
1532
1533 if (f_v) {
1534 cout << "arc_in_projective_space::arc_with_three_given_line_sets_diophant done" << endl;
1535 }
1536
1537}
1538
1539
1541 int arc_sz, int arc_d,
1542 std::string &secant_lines_text,
1543 std::string &external_lines_as_subset_of_secants_text,
1545 int verbose_level)
1546{
1547 int f_v = (verbose_level >= 1);
1548 int f_vv = (verbose_level >= 5);
1549 int h, i, j, s;
1550 int a, line;
1551 int *secant_lines;
1552 int nb_secant_lines;
1553 int *Idx;
1554 int *external_lines;
1555 int nb_external_lines;
1556 int *other_lines;
1557 int nb_other_lines;
1560
1561 if (f_v) {
1562 cout << "arc_in_projective_space::maximal_arc_by_diophant" << endl;
1563 }
1564
1565 other_lines = NEW_int(P->N_lines);
1566
1567 Int_vec_scan(secant_lines_text, secant_lines, nb_secant_lines);
1568 Int_vec_scan(external_lines_as_subset_of_secants_text, Idx, nb_external_lines);
1569
1570 Sorting.int_vec_heapsort(secant_lines, nb_secant_lines);
1571
1572 Combi.set_complement(
1573 secant_lines, nb_secant_lines,
1574 other_lines, nb_other_lines,
1575 P->N_lines);
1576
1577
1578 external_lines = NEW_int(nb_external_lines);
1579 for (i = 0; i < nb_external_lines; i++) {
1580 external_lines[i] = secant_lines[Idx[i]];
1581 }
1582 h = 0;
1583 j = 0;
1584 for (i = 0; i <= nb_external_lines; i++) {
1585 if (i < nb_external_lines) {
1586 s = Idx[i];
1587 }
1588 else {
1589 s = nb_secant_lines;
1590 }
1591 for (; j < s; j++) {
1592 secant_lines[h] = secant_lines[j];
1593 h++;
1594 }
1595 j++;
1596 }
1597 if (h != nb_secant_lines - nb_external_lines) {
1598 cout << "h != nb_secant_lines - nb_external_lines" << endl;
1599 exit(1);
1600 }
1601 nb_secant_lines = h;
1602
1603 int nb_slack1, nb_pencil_conditions;
1604 int slack1_start;
1605 int nb_eqns;
1606 int nb_vars;
1607 int *pencil_idx;
1608 int *pencil_sub_idx;
1609 int *nb_times_hit;
1610 int pt, sub_idx;
1611
1612 pencil_idx = NEW_int(P->N_lines);
1613 pencil_sub_idx = NEW_int(P->N_lines);
1614 nb_times_hit = NEW_int(P->k);
1615 Int_vec_zero(nb_times_hit, P->k);
1616
1617 pencil_idx[0] = -1;
1618 for (i = 1; i < P->N_lines; i++) {
1619 pt = P->intersection_of_two_lines(i, 0);
1620 if (pt > P->k + 2) {
1621 cout << "pt > k + 2" << endl;
1622 cout << "i=" << i << endl;
1623 cout << "pt=" << pt << endl;
1624 exit(1);
1625 }
1626 if (pt == 0 || pt == 1) {
1627 pencil_idx[i] = -1;
1628 pencil_sub_idx[i] = -1;
1629 continue;
1630 }
1631 if (pt < 4) {
1632 cout << "pt < 4" << endl;
1633 exit(1);
1634 }
1635 pt -= 4;
1636 pencil_idx[i] = pt;
1637 pencil_sub_idx[i] = nb_times_hit[pt];
1638 nb_times_hit[pt]++;
1639 }
1640 for (pt = 0; pt < P->k - 2; pt++) {
1641 if (nb_times_hit[pt] != P->k - 1) {
1642 cout << "nb_times_hit[pt] != k - 1" << endl;
1643 cout << "pt = " << pt << endl;
1644 cout << "nb_times_hit[pt] = " << nb_times_hit[pt] << endl;
1645 exit(1);
1646 }
1647 }
1648
1649 if (nb_other_lines != (P->k - 2) * (P->k - 1)) {
1650 cout << "nb_other_lines != (k - 2) * (k - 1)" << endl;
1651 exit(1);
1652 }
1653 nb_slack1 = nb_other_lines;
1654 nb_pencil_conditions = P->k - 2;
1655 slack1_start = P->N_points;
1656
1657
1658 nb_eqns = P->N_lines + 1 + nb_pencil_conditions;
1659 nb_vars = P->N_points + nb_slack1;
1660
1662 D->open(nb_eqns, nb_vars);
1663 //D->f_x_max = TRUE;
1664 for (j = 0; j < nb_vars; j++) {
1665 D->x_min[j] = 0;
1666 D->x_max[j] = 1;
1667 }
1668 D->f_has_sum = TRUE;
1669 D->sum = arc_sz + (arc_d - 1) * nb_pencil_conditions;
1670 h = 0;
1671 for (i = 0; i < nb_secant_lines; i++) {
1672 line = secant_lines[i];
1673 for (j = 0; j < P->N_points; j++) {
1674 if (P->is_incident(j, line)) {
1675 a = 1;
1676 }
1677 else {
1678 a = 0;
1679 }
1680 D->Aij(h, j) = a;
1681 }
1682 D->type[h] = t_EQ;
1683 D->RHSi(h) = arc_d;
1684 h++;
1685 }
1686 for (i = 0; i < nb_external_lines; i++) {
1687 line = external_lines[i];
1688 for (j = 0; j < P->N_points; j++) {
1689 if (P->is_incident(j, line)) {
1690 a = 1;
1691 }
1692 else {
1693 a = 0;
1694 }
1695 D->Aij(h, j) = a;
1696 }
1697 D->type[h] = t_EQ;
1698 D->RHSi(h) = 0;
1699 h++;
1700 }
1701 for (i = 0; i < nb_other_lines; i++) {
1702 line = other_lines[i];
1703 cout << "other line " << i << " / " << nb_other_lines << " is: " << line << " : ";
1704 for (j = 0; j < P->N_points; j++) {
1705 if (P->is_incident(j, line)) {
1706 a = 1;
1707 }
1708 else {
1709 a = 0;
1710 }
1711 D->Aij(h, j) = a;
1712 }
1713 pt = pencil_idx[line];
1714 sub_idx = pencil_sub_idx[line];
1715 cout << "pt=" << pt << " sub_idx=" << sub_idx << endl;
1716 if (pt < 0) {
1717 cout << "pt < 0" << endl;
1718 exit(1);
1719 }
1720 if (sub_idx < 0) {
1721 cout << "sub_idx < 0" << endl;
1722 exit(1);
1723 }
1724 D->Aij(h, slack1_start + pt * (P->k - 1) + sub_idx) = arc_d;
1725
1726 D->type[h] = t_EQ;
1727 D->RHSi(h) = arc_d;
1728 h++;
1729 }
1730 for (i = 0; i < nb_pencil_conditions; i++) {
1731 D->type[h] = t_EQ;
1732 D->RHSi(h) = arc_d - 1;
1733 for (j = 0; j < P->k - 1; j++) {
1734 D->Aij(h, slack1_start + i * (P->k - 1) + j) = 1;
1735 }
1736 h++;
1737 }
1738 // add one extra row:
1739 for (j = 0; j < P->N_points; j++) {
1740 D->Aij(h, j) = 1;
1741 }
1742 D->type[h] = t_EQ;
1743 D->RHSi(h) = arc_sz;
1744 h++;
1745
1746 if (h != nb_eqns) {
1747 cout << "arc_in_projective_space::maximal_arc_by_diophant h != nb_eqns" << endl;
1748 exit(1);
1749 }
1750
1751 //D->m = h;
1752
1753 //D->init_var_labels(N_points, verbose_level);
1754
1755 if (f_vv) {
1756 cout << "arc_in_projective_space::maximal_arc_by_diophant "
1757 "The system is:" << endl;
1758 D->print_tight();
1759 }
1760
1761 FREE_int(other_lines);
1762 FREE_int(external_lines);
1763
1764 if (f_v) {
1765 cout << "arc_in_projective_space::maximal_arc_by_diophant done" << endl;
1766 }
1767}
1768
1770 int arc_size,
1771 int arc_d,
1772 int arc_d_low,
1773 int arc_s,
1774 std::string arc_input_set,
1775 std::string arc_label,
1776 int verbose_level)
1777{
1778 int f_v = (verbose_level >= 1);
1779
1780 if (f_v) {
1781 cout << "arc_in_projective_space::arc_lifting1" << endl;
1782 }
1783 solvers::diophant *D = NULL;
1784 int f_save_system = TRUE;
1785
1786 long int *the_set_in;
1787 int set_size_in;
1788
1789 Lint_vec_scan(arc_input_set, the_set_in, set_size_in);
1790
1792 the_set_in /*one_lines*/, set_size_in /* nb_one_lines */,
1793 arc_size /*target_sz*/, arc_d /* target_d */,
1794 arc_d_low, arc_s /* target_s */,
1795 TRUE /* f_dualize */,
1796 D,
1797 verbose_level);
1798
1799 if (FALSE) {
1800 D->print_tight();
1801 }
1802
1803 if (f_save_system) {
1804
1805 string fname_system;
1806
1807 fname_system.assign(arc_label);
1808 fname_system.append(".diophant");
1809 cout << "perform_job_for_one_set saving the system "
1810 "to file " << fname_system << endl;
1811 D->save_in_general_format(fname_system, 0 /* verbose_level */);
1812 cout << "perform_job_for_one_set saving the system "
1813 "to file " << fname_system << " done" << endl;
1814 //D->print();
1815 //D->print_tight();
1816 }
1817
1818 long int nb_backtrack_nodes;
1819 long int *Sol;
1820 int nb_sol;
1821
1822 D->solve_all_mckay(nb_backtrack_nodes, INT_MAX, verbose_level);
1823
1824 if (f_v) {
1825 cout << "before D->get_solutions" << endl;
1826 }
1827 D->get_solutions(Sol, nb_sol, verbose_level);
1828 if (f_v) {
1829 cout << "after D->get_solutions, nb_sol=" << nb_sol << endl;
1830 }
1831 string fname_solutions;
1832
1833 fname_solutions.assign(arc_label);
1834 fname_solutions.append(".solutions");
1835
1836 {
1837 ofstream fp(fname_solutions);
1838 int i, j, a;
1839
1840 for (i = 0; i < nb_sol; i++) {
1841 fp << D->sum;
1842 for (j = 0; j < D->sum; j++) {
1843 a = Sol[i * D->sum + j];
1844 fp << " " << a;
1845 }
1846 fp << endl;
1847 }
1848 fp << -1 << " " << nb_sol << endl;
1849 }
1851
1852 cout << "Written file " << fname_solutions << " of size "
1853 << Fio.file_size(fname_solutions) << endl;
1854 FREE_lint(Sol);
1855 FREE_lint(the_set_in);
1856 if (f_v) {
1857 cout << "arc_in_projective_space::arc_lifting1 done" << endl;
1858 }
1859
1860}
1861
1863 int arc_size,
1864 int arc_d,
1865 int arc_d_low,
1866 int arc_s,
1867 std::string arc_input_set,
1868 std::string arc_label,
1869 int arc_t,
1870 std::string t_lines_string,
1871 int verbose_level)
1872{
1873 int f_v = (verbose_level >= 1);
1874
1875 if (f_v) {
1876 cout << "arc_in_projective_space::arc_lifting2" << endl;
1877 }
1878 long int *t_lines;
1879 int nb_t_lines;
1880
1881 Lint_vec_scan(t_lines_string, t_lines, nb_t_lines);
1882
1883 cout << "The t-lines, t=" << arc_t << " are ";
1884 Lint_vec_print(cout, t_lines, nb_t_lines);
1885 cout << endl;
1886
1887
1888 long int *the_set_in;
1889 int set_size_in;
1890
1891 Lint_vec_scan(arc_input_set, the_set_in, set_size_in);
1892
1893
1894 solvers::diophant *D = NULL;
1895 int f_save_system = TRUE;
1896
1898 the_set_in /* s_lines */, set_size_in /* nb_s_lines */, arc_s,
1899 t_lines, nb_t_lines, arc_t,
1900 arc_size /*target_sz*/, arc_d, arc_d_low,
1901 TRUE /* f_dualize */,
1902 D,
1903 verbose_level);
1904
1905 if (FALSE) {
1906 D->print_tight();
1907 }
1908
1909 if (f_save_system) {
1910 string fname_system;
1911
1912 fname_system.assign(arc_label);
1913 fname_system.append(".diophant");
1914
1915 //sprintf(fname_system, "system_%d.diophant", back_end_counter);
1916 cout << "perform_job_for_one_set saving the system "
1917 "to file " << fname_system << endl;
1918 D->save_in_general_format(fname_system, 0 /* verbose_level */);
1919 cout << "perform_job_for_one_set saving the system "
1920 "to file " << fname_system << " done" << endl;
1921 //D->print();
1922 }
1923
1924 long int nb_backtrack_nodes;
1925 long int *Sol;
1926 int nb_sol;
1927
1928 D->solve_all_mckay(nb_backtrack_nodes, INT_MAX, verbose_level);
1929
1930 if (f_v) {
1931 cout << "before D->get_solutions" << endl;
1932 }
1933 D->get_solutions(Sol, nb_sol, verbose_level);
1934 if (f_v) {
1935 cout << "after D->get_solutions, nb_sol=" << nb_sol << endl;
1936 }
1937 string fname_solutions;
1938
1939 fname_solutions.assign(arc_label);
1940 fname_solutions.append(".solutions");
1941
1942 {
1943 ofstream fp(fname_solutions);
1944 int i, j, a;
1945
1946 for (i = 0; i < nb_sol; i++) {
1947 fp << D->sum;
1948 for (j = 0; j < D->sum; j++) {
1949 a = Sol[i * D->sum + j];
1950 fp << " " << a;
1951 }
1952 fp << endl;
1953 }
1954 fp << -1 << " " << nb_sol << endl;
1955 }
1956
1958
1959 cout << "Written file " << fname_solutions << " of size "
1960 << Fio.file_size(fname_solutions) << endl;
1961 FREE_lint(Sol);
1962 FREE_lint(the_set_in);
1963 if (f_v) {
1964 cout << "arc_in_projective_space::arc_lifting2 done" << endl;
1965 }
1966
1967}
1968
1969
1971 int arc_size,
1972 int arc_d,
1973 int arc_d_low,
1974 int arc_s,
1975 std::string arc_input_set,
1976 std::string arc_label,
1977 int arc_t,
1978 std::string t_lines_string,
1979 int arc_u,
1980 std::string u_lines_string,
1981 int verbose_level)
1982{
1983 int f_v = (verbose_level >= 1);
1984
1985 if (f_v) {
1986 cout << "arc_in_projective_space::arc_lifting3" << endl;
1987 }
1988 //int arc_size;
1989 //int arc_d;
1990 solvers::diophant *D = NULL;
1991 int f_save_system = TRUE;
1992
1993 long int *t_lines;
1994 int nb_t_lines;
1995 long int *u_lines;
1996 int nb_u_lines;
1997
1998
1999 Lint_vec_scan(t_lines_string, t_lines, nb_t_lines);
2000 Lint_vec_scan(u_lines_string, u_lines, nb_u_lines);
2001 //lint_vec_print(cout, t_lines, nb_t_lines);
2002 //cout << endl;
2003
2004 cout << "The t-lines, t=" << arc_t << " are ";
2005 Lint_vec_print(cout, t_lines, nb_t_lines);
2006 cout << endl;
2007 cout << "The u-lines, u=" << arc_u << " are ";
2008 Lint_vec_print(cout, u_lines, nb_u_lines);
2009 cout << endl;
2010
2011
2012 long int *the_set_in;
2013 int set_size_in;
2014
2015 Lint_vec_scan(arc_input_set, the_set_in, set_size_in);
2016
2017
2019 the_set_in /* s_lines */, set_size_in /* nb_s_lines */, arc_s,
2020 t_lines, nb_t_lines, arc_t,
2021 u_lines, nb_u_lines, arc_u,
2022 arc_size /*target_sz*/, arc_d, arc_d_low,
2023 TRUE /* f_dualize */,
2024 D,
2025 verbose_level);
2026
2027 if (FALSE) {
2028 D->print_tight();
2029 }
2030 if (f_save_system) {
2031 string fname_system;
2032
2033 fname_system.assign(arc_label);
2034 fname_system.append(".diophant");
2035
2036 cout << "arc_in_projective_space::perform_activity saving the system "
2037 "to file " << fname_system << endl;
2038 D->save_in_general_format(fname_system, 0 /* verbose_level */);
2039 cout << "arc_in_projective_space::perform_activity saving the system "
2040 "to file " << fname_system << " done" << endl;
2041 //D->print();
2042 //D->print_tight();
2043 }
2044
2045 long int nb_backtrack_nodes;
2046 long int *Sol;
2047 int nb_sol;
2048
2049 D->solve_all_mckay(nb_backtrack_nodes, INT_MAX, verbose_level);
2050
2051 if (f_v) {
2052 cout << "before D->get_solutions" << endl;
2053 }
2054 D->get_solutions(Sol, nb_sol, verbose_level);
2055 if (f_v) {
2056 cout << "after D->get_solutions, nb_sol=" << nb_sol << endl;
2057 }
2058 string fname_solutions;
2059
2060 fname_solutions.assign(arc_label);
2061 fname_solutions.append(".solutions");
2062
2063 {
2064 ofstream fp(fname_solutions);
2065 int i, j, a;
2066
2067 for (i = 0; i < nb_sol; i++) {
2068 fp << D->sum;
2069 for (j = 0; j < D->sum; j++) {
2070 a = Sol[i * D->sum + j];
2071 fp << " " << a;
2072 }
2073 fp << endl;
2074 }
2075 fp << -1 << " " << nb_sol << endl;
2076 }
2078
2079 cout << "Written file " << fname_solutions << " of size "
2080 << Fio.file_size(fname_solutions) << endl;
2081 FREE_lint(Sol);
2082 FREE_lint(the_set_in);
2083 if (f_v) {
2084 cout << "arc_in_projective_space::arc_lifting3 done" << endl;
2085 }
2086
2087}
2088
2090 int f_translation, int translation_exponent,
2091 int f_Segre, int f_Payne, int f_Cherowitzo, int f_OKeefe_Penttila,
2092 std::string &label_txt,
2093 std::string &label_tex,
2094 int &nb_pts, long int *&Pts,
2095 int verbose_level)
2096{
2097 int f_v = (verbose_level >= 1);
2098 int n = 2;
2099 int i, d;
2100 int *v;
2102 char str[1000];
2103 char str2[1000];
2104
2105 d = n + 1;
2106
2107 if (f_v) {
2108 cout << "arc_in_projective_space::create_hyperoval" << endl;
2109 }
2110
2111
2112 v = NEW_int(d);
2113 Pts = NEW_lint(P->N_points);
2114
2115 sprintf(str, "_q%d", P->F->q);
2116 sprintf(str2, "\\_q%d", P->F->q);
2117
2118 if (f_translation) {
2120 translation_exponent, verbose_level - 0);
2121 label_txt.assign("hyperoval_translation");
2122 label_txt.append(str);
2123 label_tex.assign("hyperoval\\_translation");
2124 label_tex.append(str2);
2125 }
2126 else if (f_Segre) {
2127 P->Arc_in_projective_space->create_Segre_hyperoval(Pts, nb_pts, verbose_level - 2);
2128 label_txt.assign("hyperoval_Segre");
2129 label_txt.append(str);
2130 label_tex.assign("hyperoval\\_Segre");
2131 label_tex.append(str2);
2132 }
2133 else if (f_Payne) {
2134 P->Arc_in_projective_space->create_Payne_hyperoval(Pts, nb_pts, verbose_level - 2);
2135 label_txt.assign("hyperoval_Payne");
2136 label_txt.append(str);
2137 label_tex.assign("hyperoval\\_Payne");
2138 label_tex.append(str2);
2139 }
2140 else if (f_Cherowitzo) {
2141 P->Arc_in_projective_space->create_Cherowitzo_hyperoval(Pts, nb_pts, verbose_level - 2);
2142 label_txt.assign("hyperoval_Cherowitzo");
2143 label_txt.append(str);
2144 label_tex.assign("hyperoval\\_Cherowitzo");
2145 label_tex.append(str2);
2146 }
2147 else if (f_OKeefe_Penttila) {
2149 verbose_level - 2);
2150 label_txt.assign("hyperoval_OKeefe_Penttila");
2151 label_txt.append(str);
2152 label_tex.assign("hyperoval\\_OKeefe\\_Penttila");
2153 label_tex.append(str2);
2154 }
2155 else {
2156 P->Arc_in_projective_space->create_regular_hyperoval(Pts, nb_pts, verbose_level - 2);
2157 label_txt.assign("hyperoval_regular");
2158 label_txt.append(str);
2159 label_tex.assign("hyperoval\\_regular");
2160 label_tex.append(str2);
2161 }
2162
2163 if (f_v) {
2164 cout << "i : point : projective rank" << endl;
2165 for (i = 0; i < nb_pts; i++) {
2166 P->unrank_point(v, Pts[i]);
2167 if (f_v) {
2168 cout << setw(4) << i << " : ";
2169 Int_vec_print(cout, v, d);
2170 cout << endl;
2171 }
2172 }
2173 }
2174
2175 if (!Sorting.test_if_set_with_return_value_lint(Pts, nb_pts)) {
2176 cout << "arc_in_projective_space::create_hyperoval the set is not a set, "
2177 "something is wrong" << endl;
2178 exit(1);
2179 }
2180
2181 FREE_OBJECT(P);
2182 FREE_int(v);
2183 //FREE_int(L);
2184}
2185
2187 int f_short,
2188 std::string &label_txt,
2189 std::string &label_tex,
2190 int &nb_pts, long int *&Pts,
2191 int verbose_level)
2192{
2193 int f_v = (verbose_level >= 1);
2195 char str[1000];
2196 char str2[1000];
2197
2198 if (f_v) {
2199 cout << "arc_in_projective_space::create_subiaco_oval" << endl;
2200 }
2201
2202 sprintf(str, "_q%d", P->F->q);
2203 sprintf(str2, "\\_q%d", P->F->q);
2204 {
2205 arc_basic A;
2206
2207 A.init(P->F, verbose_level - 1);
2208 A.Subiaco_oval(Pts, nb_pts, f_short, verbose_level);
2209 }
2210 if (f_short) {
2211 label_txt.assign("oval_subiaco_short");
2212 label_txt.append(str);
2213 label_tex.assign("oval\\_subiaco\\_short");
2214 label_tex.append(str2);
2215 }
2216 else {
2217 label_txt.assign("oval_subiaco_long");
2218 label_txt.append(str);
2219 label_tex.assign("oval\\_subiaco\\_long");
2220 label_tex.append(str);
2221 }
2222
2223
2224 if (f_v) {
2225 int i;
2226 int n = 2, d = n + 1;
2227 int *v;
2228
2229 v = NEW_int(d);
2230
2231 cout << "i : point : projective rank" << endl;
2232 for (i = 0; i < nb_pts; i++) {
2233 P->unrank_point(v, Pts[i]);
2234 if (f_v) {
2235 cout << setw(4) << i << " : ";
2236 Int_vec_print(cout, v, d);
2237 cout << endl;
2238 }
2239 }
2240 FREE_int(v);
2241 FREE_OBJECT(P);
2242 }
2243
2244 if (!Sorting.test_if_set_with_return_value_lint(Pts, nb_pts)) {
2245 cout << "create_subiaco_oval the set is not a set, "
2246 "something is wrong" << endl;
2247 exit(1);
2248 }
2249
2250}
2251
2252
2254 std::string &label_txt,
2255 std::string &label_tex,
2256 int &nb_pts, long int *&Pts,
2257 int verbose_level)
2258{
2259 int f_v = (verbose_level >= 1);
2261 char str[1000];
2262 char str2[1000];
2263
2264 if (f_v) {
2265 cout << "arc_in_projective_space::create_subiaco_hyperoval" << endl;
2266 }
2267
2268 {
2269 arc_basic A;
2270
2271 A.init(P->F, verbose_level - 1);
2272 A.Subiaco_hyperoval(Pts, nb_pts, verbose_level);
2273 }
2274
2275 sprintf(str, "_q%d", P->F->q);
2276 sprintf(str2, "\\_q%d", P->F->q);
2277
2278 label_txt.assign("subiaco_hyperoval");
2279 label_txt.append(str);
2280 label_tex.assign("subiaco\\_hyperoval");
2281 label_tex.append(str2);
2282
2283
2284 if (f_v) {
2285 int i;
2286 int n = 2, d = n + 1;
2287 int *v;
2288
2289 v = NEW_int(d);
2290 for (i = 0; i < nb_pts; i++) {
2291 P->unrank_point(v, Pts[i]);
2292 if (f_v) {
2293 cout << setw(4) << i << " : ";
2294 Int_vec_print(cout, v, d);
2295 cout << endl;
2296 }
2297 }
2298 FREE_int(v);
2299 FREE_OBJECT(P);
2300 }
2301
2302 if (!Sorting.test_if_set_with_return_value_lint(Pts, nb_pts)) {
2303 cout << "arc_in_projective_space::create_subiaco_hyperoval "
2304 "the set is not a set, "
2305 "something is wrong" << endl;
2306 exit(1);
2307 }
2308
2309}
2310
2312 std::string &label_txt,
2313 std::string &label_tex,
2314 int &nb_pts, long int *&Pts,
2315 int verbose_level)
2316{
2317 int f_v = (verbose_level >= 1);
2318 int N;
2319
2320 if (f_v) {
2321 cout << "arc_in_projective_space::create_Maruta_Hamada_arc" << endl;
2322 }
2323 if (P->n != 2) {
2324 cout << "arc_in_projective_space::create_Maruta_Hamada_arc P->n != 2" << endl;
2325 exit(1);
2326 }
2327
2328 N = P->N_points;
2329 Pts = NEW_lint(N);
2330
2331 create_Maruta_Hamada_arc2(Pts, nb_pts, verbose_level);
2332
2333 char str[1000];
2334 char str2[1000];
2335 sprintf(str, "Maruta_Hamada_arc2_q%d", P->q);
2336 sprintf(str2, "Maruta\\_Hamada\\_arc2\\_q%d", P->q);
2337 label_txt.assign(str);
2338 label_tex.assign(str);
2339
2340 //FREE_int(Pts);
2341 if (f_v) {
2342 cout << "arc_in_projective_space::create_Maruta_Hamada_arc done" << endl;
2343 }
2344}
2345
2346int arc_in_projective_space::arc_test(long int *input_pts, int nb_pts,
2347 int verbose_level)
2348{
2349 int f_v = (verbose_level >= 1);
2350 int *Pts;
2351 int *Mtx;
2352 int set[3];
2353 int ret = TRUE;
2354 int h, i, N;
2356
2357 if (f_v) {
2358 cout << "arc_in_projective_space::arc_test" << endl;
2359 }
2360 if (P->n != 2) {
2361 cout << "arc_in_projective_space::arc_test P->n != 2" << endl;
2362 exit(1);
2363 }
2364 Pts = NEW_int(nb_pts * 3);
2365 Mtx = NEW_int(3 * 3);
2366 for (i = 0; i < nb_pts; i++) {
2367 P->unrank_point(Pts + i * 3, input_pts[i]);
2368 }
2369 if (f_v) {
2370 cout << "arc_in_projective_space::arc_test Pts=" << endl;
2371 Int_matrix_print(Pts, nb_pts, 3);
2372 }
2373 N = Combi.int_n_choose_k(nb_pts, 3);
2374 for (h = 0; h < N; h++) {
2375 Combi.unrank_k_subset(h, set, nb_pts, 3);
2376 Int_vec_copy(Pts + set[0] * 3, Mtx, 3);
2377 Int_vec_copy(Pts + set[1] * 3, Mtx + 3, 3);
2378 Int_vec_copy(Pts + set[2] * 3, Mtx + 6, 3);
2379 if (P->F->Linear_algebra->rank_of_matrix(Mtx, 3, 0 /* verbose_level */) < 3) {
2380 if (f_v) {
2381 cout << "Points P_" << set[0] << ", P_" << set[1]
2382 << " and P_" << set[2] << " are collinear" << endl;
2383 }
2384 ret = FALSE;
2385 }
2386 }
2387
2388 FREE_int(Pts);
2389 FREE_int(Mtx);
2390 if (f_v) {
2391 cout << "arc_in_projective_space::arc_test done" << endl;
2392 }
2393 return ret;
2394}
2395
2397 long int *arc6,
2398 int *&bisecants, int *&conics, int verbose_level)
2399// bisecants[15 * 3]
2400// conics[6 * 6]
2401{
2402 int f_v = (verbose_level >= 1);
2403 long int i, j, h, pi, pj, Line[2];
2404 long int arc5[5];
2405 int six_coeffs[6];
2406
2407 if (f_v) {
2408 cout << "arc_in_projective_space::compute_bisecants_and_conics" << endl;
2409 }
2410 bisecants = NEW_int(15 * 3);
2411 conics = NEW_int(6 * 6);
2412
2413 h = 0;
2414 for (i = 0; i < 6; i++) {
2415 pi = arc6[i];
2416 for (j = i + 1; j < 6; j++, h++) {
2417 pj = arc6[j];
2418 Line[0] = pi;
2419 Line[1] = pj;
2421 bisecants + h * 3,
2422 0 /* verbose_level */);
2424 bisecants + h * 3, 1, 3);
2425 }
2426 }
2427 if (f_v) {
2428 cout << "arc_in_projective_space::compute_bisecants_and_conics "
2429 "bisecants:" << endl;
2430 Int_matrix_print(bisecants, 15, 3);
2431 }
2432
2433 for (j = 0; j < 6; j++) {
2434 //int deleted_point;
2435
2436 //deleted_point = arc6[j];
2437 Lint_vec_copy(arc6, arc5, j);
2438 Lint_vec_copy(arc6 + j + 1, arc5 + j, 5 - j);
2439
2440#if 0
2441 cout << "deleting point " << j << " / 6:";
2442 int_vec_print(cout, arc5, 5);
2443 cout << endl;
2444#endif
2445
2446 P->determine_conic_in_plane(arc5, 5,
2447 six_coeffs, 0 /* verbose_level */);
2448 P->F->PG_element_normalize_from_front(six_coeffs, 1, 6);
2449 Int_vec_copy(six_coeffs, conics + j * 6, 6);
2450 }
2451
2452 if (f_v) {
2453 cout << "arc_in_projective_space::compute_bisecants_and_conics "
2454 "conics:" << endl;
2455 Int_matrix_print(conics, 6, 6);
2456 }
2457
2458 if (f_v) {
2459 cout << "arc_in_projective_space::compute_bisecants_and_conics "
2460 "done" << endl;
2461 }
2462}
2463
2464}}}
2465
void set_complement_lint(long int *subset, int subset_size, long int *complement, int &size_complement, int universal_set_size)
void set_complement(int *subset, int subset_size, int *complement, int &size_complement, int universal_set_size)
a collection of functions related to sorted vectors
int test_if_set_with_return_value_lint(long int *set, int set_size)
Definition: sorting.cpp:586
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
arcs, ovals, hyperovals etc. in projective planes
Definition: geometry.h:138
void Subiaco_hyperoval(long int *&Pts, int &nb_pts, int verbose_level)
Definition: arc_basic.cpp:324
void init(field_theory::finite_field *F, int verbose_level)
Definition: arc_basic.cpp:34
void Subiaco_oval(long int *&Pts, int &nb_pts, int f_short, int verbose_level)
Definition: arc_basic.cpp:237
void arc_lifting_diophant(long int *arc, int arc_sz, int target_sz, int target_d, solvers::diophant *&D, int verbose_level)
int arc_test(long int *input_pts, int nb_pts, int verbose_level)
void create_subiaco_hyperoval(std::string &label_txt, std::string &label_tex, int &nb_pts, long int *&Pts, int verbose_level)
void arc_lifting3(int arc_size, int arc_d, int arc_d_low, int arc_s, std::string arc_input_set, std::string arc_label, int arc_t, std::string t_lines_string, int arc_u, std::string u_lines_string, int verbose_level)
void create_pasch_arc(long int *the_arc, int &size, int verbose_level)
void create_Payne_hyperoval(long int *the_arc, int &size, int verbose_level)
void create_subiaco_oval(int f_short, std::string &label_txt, std::string &label_tex, int &nb_pts, long int *&Pts, int verbose_level)
void create_regular_hyperoval(long int *the_arc, int &size, int verbose_level)
void arc_lifting2(int arc_size, int arc_d, int arc_d_low, int arc_s, std::string arc_input_set, std::string arc_label, int arc_t, std::string t_lines_string, int verbose_level)
void PG_2_8_create_conic_plus_nucleus_arc_2(long int *the_arc, int &size, int verbose_level)
void create_OKeefe_Penttila_hyperoval_32(long int *the_arc, int &size, int verbose_level)
void create_Segre_hyperoval(long int *the_arc, int &size, int verbose_level)
void create_Cherowitzo_hyperoval(long int *the_arc, int &size, int verbose_level)
void maximal_arc_by_diophant(int arc_sz, int arc_d, std::string &secant_lines_text, std::string &external_lines_as_subset_of_secants_text, solvers::diophant *&D, int verbose_level)
void compute_bisecants_and_conics(long int *arc6, int *&bisecants, int *&conics, int verbose_level)
void PG_2_8_create_conic_plus_nucleus_arc_1(long int *the_arc, int &size, int verbose_level)
void create_Maruta_Hamada_arc(long int *the_arc, int &size, int verbose_level)
void create_translation_hyperoval(long int *the_arc, int &size, int exponent, int verbose_level)
void arc_with_two_given_line_sets_diophant(long int *s_lines, int nb_s_lines, int arc_s, long int *t_lines, int nb_t_lines, int arc_t, int target_sz, int arc_d, int arc_d_low, int f_dualize, solvers::diophant *&D, int verbose_level)
void arc_with_three_given_line_sets_diophant(long int *s_lines, int nb_s_lines, int arc_s, long int *t_lines, int nb_t_lines, int arc_t, long int *u_lines, int nb_u_lines, int arc_u, int target_sz, int arc_d, int arc_d_low, int f_dualize, solvers::diophant *&D, int verbose_level)
void create_Cheon_arc(long int *the_arc, int &size, int verbose_level)
void create_hyperoval(int f_translation, int translation_exponent, int f_Segre, int f_Payne, int f_Cherowitzo, int f_OKeefe_Penttila, std::string &label_txt, std::string &label_tex, int &nb_pts, long int *&Pts, int verbose_level)
void create_Maruta_Hamada_arc2(long int *the_arc, int &size, int verbose_level)
void arc_lifting1(int arc_size, int arc_d, int arc_d_low, int arc_s, std::string arc_input_set, std::string arc_label, int verbose_level)
void arc_with_given_set_of_s_lines_diophant(long int *s_lines, int nb_s_lines, int target_sz, int arc_d, int arc_d_low, int arc_s, int f_dualize, solvers::diophant *&D, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
int determine_conic_in_plane(long int *input_pts, int nb_pts, int *six_coeffs, int verbose_level)
projective_space_implementation * Implementation
Definition: geometry.h:1940
int determine_line_in_plane(long int *two_input_pts, int *three_coeffs, int verbose_level)
void line_intersection_type(long int *set, int set_size, int *type, int verbose_level)
domain to compute with objects of type longinteger
Definition: ring_theory.h:240
void extended_gcd(longinteger_object &a, longinteger_object &b, longinteger_object &g, longinteger_object &u, longinteger_object &v, 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)
diophantine systems of equations (i.e., linear systems over the integers)
Definition: solvers.h:209
void get_solutions(long int *&Sol, int &nb_sol, int verbose_level)
Definition: diophant.cpp:1062
int solve_all_mckay(long int &nb_backtrack_nodes, int maxresults, int verbose_level)
Definition: diophant.cpp:1435
void init_var_labels(long int *labels, int verbose_level)
Definition: diophant.cpp:224
void save_in_general_format(std::string &fname, int verbose_level)
Definition: diophant.cpp:2879
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define Int_vec_print_fully(A, B, C)
Definition: foundations.h:687
#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 Int_vec_print_integer_matrix_width(A, B, C, D, E, F)
Definition: foundations.h:691
#define Int_matrix_print(A, B, C)
Definition: foundations.h:707
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define EVEN(x)
Definition: foundations.h:221
#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