Orbiter 2022
Combinatorial Objects
projective_space.cpp
Go to the documentation of this file.
1// projective_space.cpp
2//
3// Anton Betten
4// Jan 17, 2010
5
6#include "foundations.h"
7
8
9using namespace std;
10
11
12#define MAX_NUMBER_OF_LINES_FOR_INCIDENCE_MATRIX 100000
13#define MAX_NUMBER_OF_LINES_FOR_LINE_TABLE 1000000
14#define MAX_NUMBER_OF_POINTS_FOR_POINT_TABLE 1000000
15#define MAX_NB_POINTS_FOR_LINE_THROUGH_TWO_POINTS_TABLE 10000
16#define MAX_NB_POINTS_FOR_LINE_INTERSECTION_TABLE 10000
17
18
19namespace orbiter {
20namespace layer1_foundations {
21namespace geometry {
22
23
25{
27
28 Grass_lines = NULL;
29 Grass_planes = NULL;
30 Grass_hyperplanes = NULL;
31
32 Grass_stack = NULL;
33
34 F = NULL;
35 Go = NULL;
36 n = 0;
37 q = 0;
38
39 N_points = 0;
40 N_lines = 0;
41
42 Nb_subspaces = NULL;
43
44 r = 0;
45 k = 0;
46
47
48 Implementation = NULL;
49
50 Standard_polarity = NULL;
51 Reversal_polarity = NULL;
52
54
55 v = NULL;
56 w = NULL;
57 Mtx = NULL;
58 Mtx2 = NULL;
59}
60
61
62
64{
65 freeself();
66}
67
68
70{
71 int f_v = FALSE;
72
73 if (f_v) {
74 cout << "projective_space::freeself" << endl;
75 }
76 if (Grass_lines) {
77 if (f_v) {
78 cout << "projective_space::freeself "
79 "deleting Grass_lines" << endl;
80 }
82 }
83 if (Grass_planes) {
84 if (f_v) {
85 cout << "projective_space::freeself "
86 "deleting Grass_planes" << endl;
87 }
89 }
91 if (f_v) {
92 cout << "projective_space::freeself "
93 "deleting Grass_hyperplanes" << endl;
94 }
96 }
97 if (Grass_stack) {
98 int i;
99
100 for (i = 1; i < n + 1; i++) {
102 }
103 FREE_pvoid((void **) Grass_stack);
104 }
105
106
107 if (Go) {
108 if (f_v) {
109 cout << "projective_space::freeself deleting Go" << endl;
110 }
112 }
113 if (Nb_subspaces) {
115 }
118 }
119 if (v) {
120 if (f_v) {
121 cout << "projective_space::freeself deleting v" << endl;
122 }
123 FREE_int(v);
124 }
125 if (w) {
126 FREE_int(w);
127 }
128 if (Mtx) {
129 FREE_int(Mtx);
130 }
131 if (Mtx2) {
132 FREE_int(Mtx2);
133 }
134
135 if (Implementation) {
137 }
138
139 if (Standard_polarity) {
141 }
142 if (Reversal_polarity) {
144 }
145
146 if (f_v) {
147 cout << "projective_space::freeself done" << endl;
148 }
149}
150
152 int f_init_incidence_structure,
153 int verbose_level)
154// n is projective dimension
155{
156 int f_v = (verbose_level >= 1);
157 int i;
160
164
165 if (f_v) {
166 cout << "projective_space::projective_space_init PG(" << n << "," << q << ")" << endl;
167 cout << "f_init_incidence_structure="
168 << f_init_incidence_structure << endl;
169 }
170
171 v = NEW_int(n + 1);
172 w = NEW_int(n + 1);
173 Mtx = NEW_int(3 * (n + 1));
174 Mtx2 = NEW_int(3 * (n + 1));
175
177 Grass_lines->init(n + 1, 2, F, verbose_level - 2);
178 if (n > 2) {
180 Grass_planes->init(n + 1, 3, F, verbose_level - 2);
181 }
182 if (n >= 2) {
184 Grass_hyperplanes->init(n + 1, n, F, verbose_level - 2);
185 }
186
187 Grass_stack = (grassmann **) NEW_pvoid(n + 1);
188 Grass_stack[0] = NULL;
189 for (i = 1; i < n + 1; i++) {
191 if (f_v) {
192 cout << "projective_space::projective_space_init before Grass_stack[i]->init i=" << i << endl;
193 }
194 Grass_stack[i]->init(n + 1, i, F, verbose_level - 2);
195 }
196
197 if (f_v) {
198 cout << "projective_space::projective_space_init computing number of "
199 "subspaces of each dimension:" << endl;
200 }
201 Nb_subspaces = NEW_lint(n + 1);
202 if (n < 10) {
203 for (i = 0; i <= n; i++) {
204 if (f_v) {
205 cout << "projective_space::projective_space_init computing number of "
206 "subspaces of dimension " << i + 1 << endl;
207 }
209 a,
210 n + 1, i + 1, q, 0 /*verbose_level - 2*/);
211 Nb_subspaces[i] = a.as_lint();
212 //Nb_subspaces[i] = generalized_binomial(n + 1, i + 1, q);
213 }
214
216 a,
217 n, 1, q, 0 /*verbose_level - 2*/);
218 r = a.as_int();
219 //r = generalized_binomial(n, 1, q);
220 }
221 else {
222 for (i = 0; i <= n; i++) {
223 if (f_v) {
224 cout << "projective_space::projective_space_init computing number of "
225 "subspaces of dimension " << i + 1 << endl;
226 }
227 Nb_subspaces[i] = 0;
228 }
229 r = 0;
230 }
231 N_points = Nb_subspaces[0]; // generalized_binomial(n + 1, 1, q);
232 if (f_v) {
233 cout << "projective_space::projective_space_init N_points=" << N_points << endl;
234 }
235 N_lines = Nb_subspaces[1]; // generalized_binomial(n + 1, 2, q);
236 if (f_v) {
237 cout << "projective_space::projective_space_init N_lines=" << N_lines << endl;
238 }
239 if (f_v) {
240 cout << "projective_space::projective_space_init r=" << r << endl;
241 }
242 k = q + 1; // number of points on a line
243 if (f_v) {
244 cout << "projective_space::projective_space_init k=" << k << endl;
245 }
246
248
249
250 if (f_init_incidence_structure) {
251 if (f_v) {
252 cout << "projective_space::projective_space_init calling "
253 "init_incidence_structure" << endl;
254 }
255 init_incidence_structure(verbose_level);
256 if (f_v) {
257 cout << "projective_space::projective_space_init "
258 "init_incidence_structure done" << endl;
259 }
260 }
261 else {
262 if (f_v) {
263 cout << "projective_space::projective_space_init we don't initialize "
264 "the incidence structure data" << endl;
265 }
266 }
267 if (f_v) {
268
269 cout << "projective_space::projective_space_init n=" << n
270 << " q=" << q << " done" << endl;
271 }
272}
273
275{
276 int f_v = (verbose_level >= 1);
277
278 if (f_v) {
279 cout << "projective_space::init_incidence_structure" << endl;
280 }
281
283
284
285 if (f_v) {
286 cout << "projective_space::init_incidence_structure "
287 "before projective_space_implementation->init" << endl;
288 }
289 Implementation->init(this, 0 /*verbose_level*/);
290 if (f_v) {
291 cout << "projective_space::init_incidence_structure "
292 "after projective_space_implementation->init" << endl;
293 }
294
295
296 if (n >= 2) {
297 if (f_v) {
298 cout << "projective_space_implementation::init before init_polarity" << endl;
299 }
300
301 init_polarity(verbose_level);
302
303
304 if (f_v) {
305 cout << "projective_space_implementation::init after init_polarity" << endl;
306 }
307 }
308
309
310
311 if (f_v) {
312 cout << "projective_space::init_incidence_structure done" << endl;
313 }
314}
315
316void projective_space::init_polarity(int verbose_level)
317// uses Grass_hyperplanes
318{
319 int f_v = (verbose_level >= 1);
320
321 if (f_v) {
322 cout << "projective_space::init_polarity" << endl;
323 }
325
326 if (f_v) {
327 cout << "projective_space::init_polarity before Standard_polarity->init_standard_polarity" << endl;
328 }
329 Standard_polarity->init_standard_polarity(this, verbose_level);
330 if (f_v) {
331 cout << "projective_space::init_polarity after Standard_polarity->init_standard_polarity" << endl;
332 }
333
335
336 if (f_v) {
337 cout << "projective_space::init_polarity before Standard_polarity->init_reversal_polarity" << endl;
338 }
339 Reversal_polarity->init_reversal_polarity(this, verbose_level);
340 if (f_v) {
341 cout << "projective_space::init_polarity after Standard_polarity->init_reversal_polarity" << endl;
342 }
343
344
345
346 if (f_v) {
347 cout << "projective_space::init_polarity done" << endl;
348 }
349
350}
351void projective_space::intersect_with_line(long int *set, int set_sz,
352 int line_rk, long int *intersection, int &sz, int verbose_level)
353{
354 int f_v = (verbose_level >= 1);
355 int i, b, idx;
356 long int a;
357 int *L;
359
360 if (f_v) {
361 cout << "projective_space::intersect_with_line" << endl;
362 }
363 L = Implementation->Lines + line_rk * k;
364 sz = 0;
365 for (i = 0; i < set_sz; i++) {
366 a = set[i];
367 b = a;
368 if (b != a) {
369 cout << "projective_space::intersect_with_line data loss" << endl;
370 exit(1);
371 }
372 if (Sorting.int_vec_search(L, k, b, idx)) {
373 intersection[sz++] = a;
374 }
375 }
376 if (f_v) {
377 cout << "projective_space::intersect_with_line done" << endl;
378 }
379}
380
382 long int line_rk, long int *line, int verbose_level)
383// needs line[k]
384{
385 int f_v = (verbose_level >= 1);
386
387 if (f_v) {
388 cout << "projective_space::create_points_on_line" << endl;
389 }
390 int a, b;
391
392 Grass_lines->unrank_lint(line_rk, 0/*verbose_level - 4*/);
393 for (a = 0; a < k; a++) {
394 F->PG_element_unrank_modified(v, 1, 2, a);
396 0 /* verbose_level */);
397 F->PG_element_rank_modified(w, 1, n + 1, b);
398 line[a] = b;
399 }
400 if (f_v) {
401 cout << "projective_space::create_points_on_line done" << endl;
402 }
403}
404
406 long int point_rk, long int *line_pencil, int verbose_level)
407{
408 int f_v = (verbose_level >= 1);
409 int a, b, i, d;
410 int *v;
411 int *w;
412 int *Basis;
413
414 if (f_v) {
415 cout << "projective_space::create_lines_on_point" << endl;
416 }
417 d = n + 1;
418 v = NEW_int(d);
419 w = NEW_int(n);
420 Basis = NEW_int(2 * d);
421
422 F->PG_element_unrank_modified(v, 1, d, point_rk);
423 for (i = 0; i < n + 1; i++) {
424 if (v[i]) {
425 break;
426 }
427 }
428 if (i == n + 1) {
429 cout << "projective_space::create_lines_on_point zero vector" << endl;
430 exit(1);
431 }
432 for (a = 0; a < r; a++) {
434 Int_vec_copy(v, Basis, d);
435 Int_vec_copy(w, Basis + d, i);
436 Basis[d + i] = 0;
437 Int_vec_copy(w + i, Basis + d + i + 1, n - i);
438 b = Grass_lines->rank_lint_here(Basis, 0 /*verbose_level*/);
439 line_pencil[a] = b;
440 }
441 FREE_int(v);
442 FREE_int(w);
443 FREE_int(Basis);
444 if (f_v) {
445 cout << "projective_space::create_lines_on_point done" << endl;
446 }
447}
448
450 long int point_rk, long int plane_rk,
451 long int *line_pencil, int verbose_level)
452// assumes that line_pencil[q + 1] has been allocated
453{
454 int f_v = (verbose_level >= 1);
455 int a, b, idx, d, rk, i;
456 int *v;
457 int *w;
458 int *Basis;
459 int *Plane;
460 int *M;
461
462 if (f_v) {
463 cout << "projective_space::create_lines_on_point_but_inside_a_plane" << endl;
464 }
465 if (n < 3) {
466 cout << "projective_space::create_lines_on_point_but_inside_a_plane n < 3" << endl;
467 exit(1);
468 }
469 d = n + 1;
470 v = NEW_int(d);
471 w = NEW_int(n);
472 Basis = NEW_int(2 * d);
473 Plane = NEW_int(3 * d);
474 M = NEW_int(4 * d);
475
476 Grass_planes->unrank_lint_here(Plane, plane_rk, 0 /*verbose_level*/);
477
478 F->PG_element_unrank_modified(v, 1, d, point_rk);
479 for (idx = 0; idx < n + 1; idx++) {
480 if (v[idx]) {
481 break;
482 }
483 }
484 if (idx == n + 1) {
485 cout << "projective_space::create_lines_on_point_but_inside_a_plane zero vector" << endl;
486 exit(1);
487 }
488 i = 0;
489 for (a = 0; a < r; a++) {
491 Int_vec_copy(v, Basis, d);
492 Int_vec_copy(w, Basis + d, idx);
493 Basis[d + idx] = 0;
494 Int_vec_copy(w + idx, Basis + d + idx + 1, n - idx);
495
496
497 Int_vec_copy(Plane, M, 3 * d);
498 Int_vec_copy(Basis + d, M + 3 * d, d);
499 rk = F->Linear_algebra->rank_of_rectangular_matrix(M, 4, d, 0 /* verbose_level*/);
500 if (rk == 3) {
501 b = Grass_lines->rank_lint_here(Basis, 0 /*verbose_level*/);
502 line_pencil[i++] = b;
503 }
504
505 }
506 if (i != q + 1) {
507 cout << "projective_space::create_lines_on_point_but_inside_a_plane i != q + 1" << endl;
508 exit(1);
509 }
510 FREE_int(v);
511 FREE_int(w);
512 FREE_int(Basis);
513 FREE_int(Plane);
514 FREE_int(M);
515 if (f_v) {
516 cout << "projective_space::create_lines_on_point_but_inside_a_plane done" << endl;
517 }
518}
519
520
522 long int line_rk, int pt_rk, int verbose_level)
523// pt_rk is between 0 and q-1.
524{
525 int f_v = (verbose_level >= 1);
526 int b;
527 int v[2];
528
529 if (f_v) {
530 cout << "projective_space::create_point_on_line" << endl;
531 }
532 Grass_lines->unrank_lint(line_rk, 0/*verbose_level - 4*/);
533 if (f_v) {
534 cout << "projective_space::create_point_on_line line:" << endl;
536 }
537
538 F->PG_element_unrank_modified(v, 1, 2, pt_rk);
539 if (f_v) {
540 cout << "projective_space::create_point_on_line v=" << endl;
541 Int_vec_print(cout, v, 2);
542 cout << endl;
543 }
544
546 0 /* verbose_level */);
547 if (f_v) {
548 cout << "projective_space::create_point_on_line w=" << endl;
549 Int_vec_print(cout, w, n + 1);
550 cout << endl;
551 }
552
553 F->PG_element_rank_modified(w, 1, n + 1, b);
554
555 if (f_v) {
556 cout << "projective_space::create_point_on_line b = " << b << endl;
557 }
558 return b;
559}
560
562 int &m, int &n,
563 int *&Inc, int verbose_level)
564{
565 int f_v = (verbose_level >= 1);
566 int i, h, j;
567
568 if (f_v) {
569 cout << "projective_space::make_incidence_matrix" << endl;
570 }
571 m = N_points;
572 n = N_lines;
573 Inc = NEW_int(m * n);
574 Int_vec_zero(Inc, m * n);
575 for (i = 0; i < N_points; i++) {
576 for (h = 0; h < r; h++) {
577 j = Implementation->Lines_on_point[i * r + h];
578 Inc[i * n + j] = 1;
579 }
580 }
581 if (f_v) {
582 cout << "projective_space::make_incidence_matrix "
583 "done" << endl;
584 }
585}
586
588 std::vector<int> &Pts, std::vector<int> &Lines,
589 int *&Inc, int verbose_level)
590{
591 int f_v = (verbose_level >= 1);
592 int i, j, a, b;
593 int nb_pts, nb_lines;
594
595 if (f_v) {
596 cout << "projective_space::make_incidence_matrix" << endl;
597 }
598
599 nb_pts = Pts.size();
600 nb_lines = Lines.size();
601 Inc = NEW_int(nb_pts * nb_lines);
602 Int_vec_zero(Inc, nb_pts * nb_lines);
603 for (i = 0; i < nb_pts; i++) {
604 a = Pts[i];
605 for (j = 0; j < nb_lines; j++) {
606 b = Lines[j];
607 if (is_incident(a, b)) {
608 Inc[i * nb_lines + j] = 1;
609 }
610 }
611 }
612 if (f_v) {
613 cout << "projective_space::make_incidence_matrix done" << endl;
614 }
615}
616
617int projective_space::is_incident(int pt, int line)
618{
619 int f_v = FALSE;
620 long int rk;
621
622 if (TRUE /*incidence_bitvec == NULL*/) {
623 Grass_lines->unrank_lint(line, 0/*verbose_level - 4*/);
624
625 if (f_v) {
626 cout << "projective_space::is_incident "
627 "line=" << endl;
629 }
630 Int_vec_copy(Grass_lines->M, Mtx, 2 * (n + 1));
631 F->PG_element_unrank_modified(Mtx + 2 * (n + 1), 1, n + 1, pt);
632 if (f_v) {
633 cout << "point:" << endl;
634 Int_vec_print(cout, Mtx + 2 * (n + 1), n + 1);
635 cout << endl;
636 }
637
639 3, n + 1, Mtx2, v /* base_cols */,
640 0 /*verbose_level*/);
641 if (f_v) {
642 cout << "rk = " << rk << endl;
643 }
644 if (rk == 3) {
645 return FALSE;
646 }
647 else {
648 return TRUE;
649 }
650 }
651 else {
652 //a = (long int) pt * (long int) N_lines + (long int) line;
653 //return bitvector_s_i(incidence_bitvec, a);
654 return Implementation->Bitmatrix->s_ij(pt, line);
655 }
656}
657
658void projective_space::incidence_m_ii(int pt, int line, int a)
659{
660 //long int b;
661
662 if (Implementation->Bitmatrix == NULL) {
663 cout << "projective_space::incidence_m_ii "
664 "Bitmatrix == NULL" << endl;
665 exit(1);
666 }
667 //b = (long int) pt * (long int) N_lines + (long int) line;
668 //bitvector_m_ii(incidence_bitvec, b, a);
669
671}
672
674 incidence_structure *&Inc,
675 data_structures::partitionstack *&Stack, int verbose_level)
676// points vs lines
677{
678 int f_v = (verbose_level >= 1);
679 int *M;
680 int i, j, h;
681
682 if (f_v) {
683 cout << "projective_space::make_incidence_structure_and_partition" << endl;
684 cout << "N_points=" << N_points << endl;
685 cout << "N_lines=" << N_lines << endl;
686 }
688
689
690 if (f_v) {
691 cout << "projective_space::make_incidence_structure_and_partition "
692 "allocating M of size "
693 << N_points * N_lines << endl;
694 }
695 M = NEW_int(N_points * N_lines);
696 if (f_v) {
697 cout << "projective_space::make_incidence_structure_and_partition "
698 "after allocating M of size "
699 << N_points * N_lines << endl;
700 }
702
703 if (Implementation->Lines_on_point == NULL) {
704 cout << "projective_space::make_incidence_structure_and_partition "
705 "Lines_on_point == NULL" << endl;
706 exit(1);
707 }
708 for (i = 0; i < N_points; i++) {
709 for (h = 0; h < r; h++) {
710 j = Implementation->Lines_on_point[i * r + h];
711 M[i * N_lines + j] = 1;
712 }
713 }
714 if (f_v) {
715 cout << "projective_space::make_incidence_structure_and_partition "
716 "before Inc->init_by_matrix" << endl;
717 }
718 Inc->init_by_matrix(N_points, N_lines, M, verbose_level - 1);
719 if (f_v) {
720 cout << "projective_space::make_incidence_structure_and_partition "
721 "after Inc->init_by_matrix" << endl;
722 }
723 FREE_int(M);
724
725
727 Stack->allocate(N_points + N_lines, 0 /* verbose_level */);
729 Stack->split_cell(0 /* verbose_level */);
730 Stack->sort_cells();
731
732 if (f_v) {
733 cout << "projective_space::make_incidence_structure_and_partition done" << endl;
734 }
735}
736
738 int row_type, int col_type,
739 int *&Incma, int &nb_rows, int &nb_cols,
740 int verbose_level)
741// row_type, col_type are the vector space dimensions of the objects
742// indexing rows and columns.
743{
744 int f_v = (verbose_level >= 1);
745 int i, j, rk;
746 int *Basis;
747 int *Basis2;
748 int *base_cols;
749 int d = n + 1;
750
751 if (f_v) {
752 cout << "projective_space::incma_for_type_ij" << endl;
753 cout << "row_type = " << row_type << endl;
754 cout << "col_type = " << col_type << endl;
755 }
756 if (col_type < row_type) {
757 cout << "projective_space::incma_for_type_ij "
758 "col_type < row_type" << endl;
759 exit(1);
760 }
761 if (col_type < 0) {
762 cout << "projective_space::incma_for_type_ij "
763 "col_type < 0" << endl;
764 exit(1);
765 }
766 if (col_type > n + 1) {
767 cout << "projective_space::incma_for_type_ij "
768 "col_type > P->n + 1" << endl;
769 exit(1);
770 }
771 nb_rows = nb_rk_k_subspaces_as_lint(row_type);
772 nb_cols = nb_rk_k_subspaces_as_lint(col_type);
773
774
775 Basis = NEW_int(3 * d * d);
776 Basis2 = NEW_int(3 * d * d);
777 base_cols = NEW_int(d);
778
779 Incma = NEW_int(nb_rows * nb_cols);
780 Int_vec_zero(Incma, nb_rows * nb_cols);
781 for (i = 0; i < nb_rows; i++) {
782 if (row_type == 1) {
783 unrank_point(Basis, i);
784 }
785 else if (row_type == 2) {
786 unrank_line(Basis, i);
787 }
788 else if (row_type == 3) {
789 unrank_plane(Basis, i);
790 }
791 else {
792 cout << "projective_space::incma_for_type_ij "
793 "row_type " << row_type
794 << " not yet implemented" << endl;
795 exit(1);
796 }
797 for (j = 0; j < nb_cols; j++) {
798 if (col_type == 1) {
799 unrank_point(Basis + row_type * d, j);
800 }
801 else if (col_type == 2){
802 unrank_line(Basis + row_type * d, j);
803 }
804 else if (col_type == 3) {
805 unrank_plane(Basis + row_type * d, j);
806 }
807 else {
808 cout << "projective_space::incma_for_type_ij "
809 "col_type " << col_type
810 << " not yet implemented" << endl;
811 exit(1);
812 }
814 row_type + col_type, d, Basis2, base_cols,
815 0 /*verbose_level*/);
816 if (rk == col_type) {
817 Incma[i * nb_cols + j] = 1;
818 }
819 }
820 }
821
822 FREE_int(Basis);
823 FREE_int(Basis2);
824 FREE_int(base_cols);
825 if (f_v) {
826 cout << "projective_space::incma_for_type_ij done" << endl;
827 }
828}
829
831 int row_type, int col_type,
834 int verbose_level)
835{
836 int f_v = (verbose_level >= 1);
837 int *Incma;
838 int nb_rows, nb_cols;
839
840 if (f_v) {
841 cout << "projective_space::incidence_and_stack_for_type_ij" << endl;
842 }
844 row_type, col_type,
845 Incma, nb_rows, nb_cols,
846 verbose_level);
847 if (f_v) {
848 cout << "projective_space::incidence_and_stack_for_type_ij "
849 "before Inc->init_by_matrix" << endl;
850 }
852 Inc->init_by_matrix(nb_rows, nb_cols, Incma, verbose_level - 1);
853 if (f_v) {
854 cout << "projective_space::incidence_and_stack_for_type_ij "
855 "after Inc->init_by_matrix" << endl;
856 }
857 FREE_int(Incma);
858
859
861 Stack->allocate(nb_rows + nb_cols, 0 /* verbose_level */);
862 Stack->subset_continguous(nb_rows, nb_cols);
863 Stack->split_cell(0 /* verbose_level */);
864 Stack->sort_cells();
865
866 if (f_v) {
867 cout << "projective_space::incidence_and_stack_for_type_ij done" << endl;
868 }
869}
870
872{
875 long int N;
876 int d = n + 1;
877
878 C.q_binomial(aa, d, k, q, 0/*verbose_level*/);
879 N = aa.as_lint();
880 return N;
881}
882
883void projective_space::print_set_of_points(ostream &ost, long int *Pts, int nb_pts)
884{
885 int h, I;
886 int *v;
887
888 v = NEW_int(n + 1);
889
890 for (I = 0; I < (nb_pts + 39) / 40; I++) {
891 ost << "$$" << endl;
892 ost << "\\begin{array}{|r|r|r|}" << endl;
893 ost << "\\hline" << endl;
894 ost << "i & \\mbox{Rank} & \\mbox{Point} \\\\" << endl;
895 ost << "\\hline" << endl;
896 ost << "\\hline" << endl;
897 for (h = 0; h < 40; h++) {
898 if (I * 40 + h < nb_pts) {
899 unrank_point(v, Pts[I * 40 + h]);
900 ost << I * 40 + h << " & " << Pts[I * 40 + h] << " & ";
901 Int_vec_print(ost, v, n + 1);
902 ost << "\\\\" << endl;
903 }
904 }
905 ost << "\\hline" << endl;
906 ost << "\\end{array}" << endl;
907 ost << "$$" << endl;
908 }
909 FREE_int(v);
910}
911
913{
914 int *v;
915 int i;
916
917 v = NEW_int(n + 1);
918 cout << "All points in PG(" << n << "," << q << "):" << endl;
919 for (i = 0; i < N_points; i++) {
920 unrank_point(v, i);
921 cout << setw(3) << i << " : ";
922 Int_vec_print(cout, v, n + 1);
923 cout << endl;
924 }
925 FREE_int(v);
926}
927
929{
930 long int b;
931 int verbose_level = 0;
932
933 int f_v = (verbose_level >= 1);
934
935 if (f_v) {
936 cout << "projective_space::rank_point" << endl;
937 }
938
939 F->PG_element_rank_modified_lint(v, 1, n + 1, b);
940
941 if (f_v) {
942 cout << "projective_space::rank_point done" << endl;
943 }
944 return b;
945}
946
947void projective_space::unrank_point(int *v, long int rk)
948{
949 F->PG_element_unrank_modified_lint(v, 1, n + 1, rk);
950}
951
952void projective_space::unrank_points(int *v, long int *Rk, int sz)
953{
954 int i;
955
956 for (i = 0; i < sz; i++) {
957 F->PG_element_unrank_modified_lint(v + i * (n + 1), 1, n + 1, Rk[i]);
958 }
959}
960
961long int projective_space::rank_line(int *basis)
962{
963 long int b;
964
965 b = Grass_lines->rank_lint_here(basis, 0/*verbose_level - 4*/);
966 return b;
967}
968
969void projective_space::unrank_line(int *basis, long int rk)
970{
971 Grass_lines->unrank_lint_here(basis, rk, 0/*verbose_level - 4*/);
972}
973
974void projective_space::unrank_lines(int *v, long int *Rk, int nb)
975{
976 int i;
977
978 for (i = 0; i < nb; i++) {
980 v + i * 2 * (n + 1), Rk[i], 0 /* verbose_level */);
981 }
982}
983
985{
986 long int b;
987
988 if (Grass_planes == NULL) {
989 cout << "projective_space::rank_plane "
990 "Grass_planes == NULL" << endl;
991 exit(1);
992 }
993 b = Grass_planes->rank_lint_here(basis, 0/*verbose_level - 4*/);
994 return b;
995}
996
997void projective_space::unrank_plane(int *basis, long int rk)
998{
999 if (Grass_planes == NULL) {
1000 cout << "projective_space::unrank_plane "
1001 "Grass_planes == NULL" << endl;
1002 exit(1);
1003 }
1004 Grass_planes->unrank_lint_here(basis, rk, 0/*verbose_level - 4*/);
1005}
1006
1008 long int p1, long int p2)
1009{
1010 long int b;
1011
1013 unrank_point(Grass_lines->M + n + 1, p2);
1014 b = Grass_lines->rank_lint(0/*verbose_level - 4*/);
1015 return b;
1016}
1017
1019 long int l1, long int l2)
1020{
1022
1023 if (Implementation->Lines) {
1025 Implementation->Lines + l1 * k, Implementation->Lines + l2 * k, k, k);
1026 }
1027 else {
1029 }
1030}
1031
1033 long int l1, long int l2)
1034{
1035 int *Mtx;
1036 int m, rk;
1037
1038 m = n + 1;
1039 Mtx = NEW_int(4 * m);
1040 Grass_lines->unrank_lint_here(Mtx, l1, 0/*verbose_level - 4*/);
1041 Grass_lines->unrank_lint_here(Mtx + 2 * m, l2, 0/*verbose_level - 4*/);
1042 rk = F->Linear_algebra->Gauss_easy(Mtx, 4, m);
1043 FREE_int(Mtx);
1044 if (rk == 4) {
1045 return TRUE;
1046 }
1047 else {
1048 return FALSE;
1049 }
1050}
1051
1053// formerly intersection_of_two_lines_in_a_plane
1054{
1055 int *Mtx1;
1056 int *Mtx3;
1057 int b, r;
1058
1059 int d = n + 1;
1060 int D = 2 * d;
1061
1062
1063 Mtx1 = NEW_int(d * d);
1064 Mtx3 = NEW_int(D * d);
1065
1066 Grass_lines->unrank_lint_here(Mtx1, l1, 0/*verbose_level - 4*/);
1067 F->Linear_algebra->perp_standard(d, 2, Mtx1, 0);
1068 Int_vec_copy(Mtx1 + 2 * d, Mtx3, (d - 2) * d);
1069 Grass_lines->unrank_lint_here(Mtx1, l2, 0/*verbose_level - 4*/);
1070 F->Linear_algebra->perp_standard(d, 2, Mtx1, 0);
1071 Int_vec_copy(Mtx1 + 2 * d, Mtx3 + (d - 2) * d, (d - 2) * d);
1072 r = F->Linear_algebra->Gauss_easy(Mtx3, 2 * (d - 2), d);
1073 if (r < d - 1) {
1074 cout << "projective_space::intersection_of_two_lines r < d - 1, "
1075 "the lines do not intersect" << endl;
1076 exit(1);
1077 }
1078 if (r > d - 1) {
1079 cout << "projective_space::intersection_of_two_lines r > d - 1, "
1080 "something is wrong" << endl;
1081 exit(1);
1082 }
1083 F->Linear_algebra->perp_standard(d, d - 1, Mtx3, 0);
1084 b = rank_point(Mtx3 + (d - 1) * d);
1085
1086 FREE_int(Mtx1);
1087 FREE_int(Mtx3);
1088
1089 return b;
1090}
1091
1092
1094 long int *two_input_pts,
1095 int *three_coeffs,
1096 int verbose_level)
1097// returns FALSE is the rank of the coefficient matrix is not 2.
1098// TRUE otherwise.
1099{
1100 int f_v = (verbose_level >= 1);
1101 int f_vv = (verbose_level >= 2);
1102 int *coords; // [nb_pts * 3];
1103 int *system; // [nb_pts * 3];
1104 int kernel[3 * 3];
1105 int base_cols[3];
1106 int i, x, y, z, rk;
1107 int kernel_m, kernel_n;
1108 int nb_pts = 2;
1109
1110 if (f_v) {
1111 cout << "projective_space::determine_line_in_plane" << endl;
1112 }
1113 if (n != 2) {
1114 cout << "projective_space::determine_line_in_plane "
1115 "n != 2" << endl;
1116 exit(1);
1117 }
1118
1119
1120
1121 coords = NEW_int(nb_pts * 3);
1122 system = NEW_int(nb_pts * 3);
1123 for (i = 0; i < nb_pts; i++) {
1124 unrank_point(coords + i * 3, two_input_pts[i]);
1125 }
1126 if (f_vv) {
1127 cout << "projective_space::determine_line_in_plane "
1128 "points:" << endl;
1130 coords, nb_pts, 3, 3, F->log10_of_q);
1131 }
1132 for (i = 0; i < nb_pts; i++) {
1133 x = coords[i * 3 + 0];
1134 y = coords[i * 3 + 1];
1135 z = coords[i * 3 + 2];
1136 system[i * 3 + 0] = x;
1137 system[i * 3 + 1] = y;
1138 system[i * 3 + 2] = z;
1139 }
1140 if (f_v) {
1141 cout << "projective_space::determine_line_in_plane system:" << endl;
1143 system, nb_pts, 3, 3, F->log10_of_q);
1144 }
1145
1146
1147
1148 rk = F->Linear_algebra->Gauss_simple(system,
1149 nb_pts, 3, base_cols, verbose_level - 2);
1150 if (rk != 2) {
1151 if (f_v) {
1152 cout << "projective_space::determine_line_in_plane "
1153 "system undetermined" << endl;
1154 }
1155 return FALSE;
1156 }
1157 F->Linear_algebra->matrix_get_kernel(system, 2, 3, base_cols, rk,
1158 kernel_m, kernel_n, kernel, 0 /* verbose_level */);
1159 if (f_v) {
1160 cout << "projective_space::determine_line_in_plane line:" << endl;
1161 Int_vec_print_integer_matrix_width(cout, kernel, 1, 3, 3, F->log10_of_q);
1162 }
1163 for (i = 0; i < 3; i++) {
1164 three_coeffs[i] = kernel[i];
1165 }
1166 FREE_int(coords);
1167 FREE_int(system);
1168 return TRUE;
1169}
1170
1171
1173 long int *Arc6, int verbose_level)
1174{
1175 int f_v = (verbose_level >= 1);
1176
1177 if (f_v) {
1178 cout << "projective_space::nonconical_six_arc_get_nb_Eckardt_points" << endl;
1179 }
1180
1181 geometry_global Gg;
1183 int nb_E;
1184
1185 E = Gg.compute_eckardt_point_info(this, Arc6, 0/*verbose_level*/);
1186
1187 nb_E = E->nb_E;
1188
1189 FREE_OBJECT(E);
1190 return nb_E;
1191}
1192
1193
1194
1195int projective_space::conic_test(long int *S, int len, int pt, int verbose_level)
1196{
1197 int f_v = (verbose_level >= 1);
1198 int ret = TRUE;
1199 int subset[5];
1200 long int the_set[6];
1201 int six_coeffs[6];
1202 int i;
1204
1205 if (f_v) {
1206 cout << "projective_space::conic_test" << endl;
1207 }
1208 if (len < 5) {
1209 return TRUE;
1210 }
1211 Combi.first_k_subset(subset, len, 5);
1212 while (TRUE) {
1213 for (i = 0; i < 5; i++) {
1214 the_set[i] = S[subset[i]];
1215 }
1216 the_set[5] = pt;
1218 the_set, 6, six_coeffs, 0 /*verbose_level*/)) {
1219 ret = FALSE;
1220 break;
1221 }
1222
1223 if (!Combi.next_k_subset(subset, len, 5)) {
1224 ret = TRUE;
1225 break;
1226 }
1227 }
1228 if (f_v) {
1229 cout << "projective_space::conic_test done" << endl;
1230 }
1231 return ret;
1232}
1233
1234
1236{
1237 int v[3];
1238 int c[6];
1239 int x, y, z, s, i;
1240
1241 unrank_point(v, pt);
1242 x = v[0];
1243 y = v[1];
1244 z = v[2];
1245 c[0] = F->mult(x, x);
1246 c[1] = F->mult(y, y);
1247 c[2] = F->mult(z, z);
1248 c[3] = F->mult(x, y);
1249 c[4] = F->mult(x, z);
1250 c[5] = F->mult(y, z);
1251 s = 0;
1252 for (i = 0; i < 6; i++) {
1253 s = F->add(s, F->mult(six_coeffs[i], c[i]));
1254 }
1255 if (s == 0) {
1256 return TRUE;
1257 }
1258 else {
1259 return FALSE;
1260 }
1261 }
1262
1264 long int *input_pts, int nb_pts,
1265 int *six_coeffs,
1266 int verbose_level)
1267// returns FALSE if the rank of the coefficient
1268// matrix is not 5. TRUE otherwise.
1269{
1270 int f_v = (verbose_level >= 1);
1271 int f_vv = (verbose_level >= 2);
1272 int *coords; // [nb_pts * 3];
1273 int *system; // [nb_pts * 6];
1274 int kernel[6 * 6];
1275 int base_cols[6];
1276 int i, x, y, z, rk;
1277 int kernel_m, kernel_n;
1278
1279 if (f_v) {
1280 cout << "projective_space::determine_conic_in_plane" << endl;
1281 }
1282 if (n != 2) {
1283 cout << "projective_space::determine_conic_in_plane "
1284 "n != 2" << endl;
1285 exit(1);
1286 }
1287 if (nb_pts < 5) {
1288 cout << "projective_space::determine_conic_in_plane "
1289 "need at least 5 points" << endl;
1290 exit(1);
1291 }
1292
1293 if (!Arc_in_projective_space->arc_test(input_pts, nb_pts, verbose_level)) {
1294 if (f_v) {
1295 cout << "projective_space::determine_conic_in_plane "
1296 "some 3 of the points are collinear" << endl;
1297 }
1298 return FALSE;
1299 }
1300
1301
1302 coords = NEW_int(nb_pts * 3);
1303 system = NEW_int(nb_pts * 6);
1304 for (i = 0; i < nb_pts; i++) {
1305 unrank_point(coords + i * 3, input_pts[i]);
1306 }
1307 if (f_vv) {
1308 cout << "projective_space::determine_conic_in_plane "
1309 "points:" << endl;
1311 coords, nb_pts, 3, 3, F->log10_of_q);
1312 }
1313 for (i = 0; i < nb_pts; i++) {
1314 x = coords[i * 3 + 0];
1315 y = coords[i * 3 + 1];
1316 z = coords[i * 3 + 2];
1317 system[i * 6 + 0] = F->mult(x, x);
1318 system[i * 6 + 1] = F->mult(y, y);
1319 system[i * 6 + 2] = F->mult(z, z);
1320 system[i * 6 + 3] = F->mult(x, y);
1321 system[i * 6 + 4] = F->mult(x, z);
1322 system[i * 6 + 5] = F->mult(y, z);
1323 }
1324 if (f_v) {
1325 cout << "projective_space::determine_conic_in_plane "
1326 "system:" << endl;
1328 system, nb_pts, 6, 6, F->log10_of_q);
1329 }
1330
1331
1332
1333 rk = F->Linear_algebra->Gauss_simple(system, nb_pts,
1334 6, base_cols, verbose_level - 2);
1335 if (rk != 5) {
1336 if (f_v) {
1337 cout << "projective_space::determine_conic_in_plane "
1338 "system undetermined" << endl;
1339 }
1340 return FALSE;
1341 }
1342 F->Linear_algebra->matrix_get_kernel(system, 5, 6, base_cols, rk,
1343 kernel_m, kernel_n, kernel, 0 /* verbose_level */);
1344 if (f_v) {
1345 cout << "projective_space::determine_conic_in_plane "
1346 "conic:" << endl;
1348 kernel, 1, 6, 6, F->log10_of_q);
1349 }
1350 for (i = 0; i < 6; i++) {
1351 six_coeffs[i] = kernel[i];
1352 }
1353 FREE_int(coords);
1354 FREE_int(system);
1355 if (f_v) {
1356 cout << "projective_space::determine_conic_in_plane done" << endl;
1357 }
1358 return TRUE;
1359}
1360
1361
1364 int nb_pts, long int *Pts, int *coeff10,
1365 int verbose_level)
1366{
1367 //verbose_level = 1;
1368 int f_v = (verbose_level >= 1);
1369 int i, j, r, d;
1370 int *Pt_coord;
1371 int *System;
1372 int *base_cols;
1373
1374 if (f_v) {
1375 cout << "projective_space::determine_cubic_in_plane" << endl;
1376 }
1377 d = n + 1;
1378 Pt_coord = NEW_int(nb_pts * d);
1379 System = NEW_int(nb_pts * Poly_3_3->get_nb_monomials());
1380 base_cols = NEW_int(Poly_3_3->get_nb_monomials());
1381
1382 if (f_v) {
1383 cout << "projective_space::determine_cubic_in_plane list of "
1384 "points:" << endl;
1385 Lint_vec_print(cout, Pts, nb_pts);
1386 cout << endl;
1387 }
1388 for (i = 0; i < nb_pts; i++) {
1389 unrank_point(Pt_coord + i * d, Pts[i]);
1390 }
1391 if (f_v) {
1392 cout << "projective_space::determine_cubic_in_plane matrix of "
1393 "point coordinates:" << endl;
1394 Int_matrix_print(Pt_coord, nb_pts, d);
1395 }
1396
1397 for (i = 0; i < nb_pts; i++) {
1398 for (j = 0; j < Poly_3_3->get_nb_monomials(); j++) {
1399 System[i * Poly_3_3->get_nb_monomials() + j] =
1400 Poly_3_3->evaluate_monomial(j, Pt_coord + i * d);
1401 }
1402 }
1403 if (f_v) {
1404 cout << "projective_space::determine_cubic_in_plane "
1405 "The system:" << endl;
1406 Int_matrix_print(System, nb_pts, Poly_3_3->get_nb_monomials());
1407 }
1408 r = F->Linear_algebra->Gauss_simple(System, nb_pts, Poly_3_3->get_nb_monomials(),
1409 base_cols, 0 /* verbose_level */);
1410 if (f_v) {
1411 cout << "projective_space::determine_cubic_in_plane "
1412 "The system in RREF:" << endl;
1413 Int_matrix_print(System, r, Poly_3_3->get_nb_monomials());
1414 }
1415 if (f_v) {
1416 cout << "projective_space::determine_cubic_in_plane "
1417 "The system has rank " << r << endl;
1418 }
1419
1420 if (r != 9) {
1421 cout << "r != 9" << endl;
1422 exit(1);
1423 }
1424 int kernel_m, kernel_n;
1425
1426 F->Linear_algebra->matrix_get_kernel(System, r, Poly_3_3->get_nb_monomials(),
1427 base_cols, r,
1428 kernel_m, kernel_n, coeff10, 0 /* verbose_level */);
1429
1430
1431 FREE_int(Pt_coord);
1432 FREE_int(System);
1433 FREE_int(base_cols);
1434 if (f_v) {
1435 cout << "projective_space::determine_cubic_in_plane done" << endl;
1436 }
1437 return r;
1438}
1439
1440
1442 long int *nine_pts_or_more,
1443 int nb_pts, int *ten_coeffs, int verbose_level)
1444{
1445 int f_v = (verbose_level >= 1);
1446 int f_vv = (verbose_level >= 2);
1447 int *coords; // [nb_pts * 4]
1448 int *system; // [nb_pts * 10]
1449 int kernel[10 * 10];
1450 int base_cols[10];
1451 int i, x, y, z, w, rk;
1452 int kernel_m, kernel_n;
1453
1454 if (f_v) {
1455 cout << "projective_space::determine_quadric_in_solid" << endl;
1456 }
1457 if (n != 3) {
1458 cout << "projective_space::determine_quadric_in_solid "
1459 "n != 3" << endl;
1460 exit(1);
1461 }
1462 if (nb_pts < 9) {
1463 cout << "projective_space::determine_quadric_in_solid "
1464 "you need to give at least 9 points" << endl;
1465 exit(1);
1466 }
1467 coords = NEW_int(nb_pts * 4);
1468 system = NEW_int(nb_pts * 10);
1469 for (i = 0; i < nb_pts; i++) {
1470 unrank_point(coords + i * 4, nine_pts_or_more[i]);
1471 }
1472 if (f_vv) {
1473 cout << "projective_space::determine_quadric_in_solid "
1474 "points:" << endl;
1476 coords, nb_pts, 4, 4, F->log10_of_q);
1477 }
1478 for (i = 0; i < nb_pts; i++) {
1479 x = coords[i * 4 + 0];
1480 y = coords[i * 4 + 1];
1481 z = coords[i * 4 + 2];
1482 w = coords[i * 4 + 3];
1483 system[i * 10 + 0] = F->mult(x, x);
1484 system[i * 10 + 1] = F->mult(y, y);
1485 system[i * 10 + 2] = F->mult(z, z);
1486 system[i * 10 + 3] = F->mult(w, w);
1487 system[i * 10 + 4] = F->mult(x, y);
1488 system[i * 10 + 5] = F->mult(x, z);
1489 system[i * 10 + 6] = F->mult(x, w);
1490 system[i * 10 + 7] = F->mult(y, z);
1491 system[i * 10 + 8] = F->mult(y, w);
1492 system[i * 10 + 9] = F->mult(z, w);
1493 }
1494 if (f_v) {
1495 cout << "projective_space::determine_quadric_in_solid "
1496 "system:" << endl;
1498 system, nb_pts, 10, 10, F->log10_of_q);
1499 }
1500
1501
1502
1503 rk = F->Linear_algebra->Gauss_simple(system,
1504 nb_pts, 10, base_cols, verbose_level - 2);
1505 if (rk != 9) {
1506 cout << "projective_space::determine_quadric_in_solid "
1507 "system underdetermined" << endl;
1508 cout << "rk=" << rk << endl;
1509 exit(1);
1510 }
1511 F->Linear_algebra->matrix_get_kernel(system, 9, 10, base_cols, rk,
1512 kernel_m, kernel_n, kernel, 0 /* verbose_level */);
1513 if (f_v) {
1514 cout << "projective_space::determine_quadric_in_solid "
1515 "conic:" << endl;
1517 kernel, 1, 10, 10, F->log10_of_q);
1518 }
1519 for (i = 0; i < 10; i++) {
1520 ten_coeffs[i] = kernel[i];
1521 }
1522 if (f_v) {
1523 cout << "projective_space::determine_quadric_in_solid done" << endl;
1524 }
1525}
1526
1528 int *six_coeffs,
1529 long int *points, int &nb_points, int verbose_level)
1530{
1531 int f_v = (verbose_level >= 1);
1532 int f_vv = (verbose_level >= 2);
1533 int v[3];
1534 int i, a;
1535
1536 if (f_v) {
1537 cout << "projective_space::conic_points_brute_force" << endl;
1538 }
1539 nb_points = 0;
1540 for (i = 0; i < N_points; i++) {
1541 unrank_point(v, i);
1542 a = F->Linear_algebra->evaluate_conic_form(six_coeffs, v);
1543 if (f_vv) {
1544 cout << "point " << i << " = ";
1545 Int_vec_print(cout, v, 3);
1546 cout << " gives a value of " << a << endl;
1547 }
1548 if (a == 0) {
1549 if (f_vv) {
1550 cout << "point " << i << " = ";
1551 Int_vec_print(cout, v, 3);
1552 cout << " lies on the conic" << endl;
1553 }
1554 points[nb_points++] = i;
1555 }
1556 }
1557 if (f_v) {
1558 cout << "projective_space::conic_points_brute_force done, "
1559 "we found " << nb_points << " points" << endl;
1560 }
1561 if (f_vv) {
1562 cout << "They are : ";
1563 Lint_vec_print(cout, points, nb_points);
1564 cout << endl;
1565 }
1566 if (f_v) {
1567 cout << "projective_space::conic_points_brute_force done" << endl;
1568 }
1569}
1570
1572 int *ten_coeffs,
1573 long int *points, int &nb_points, int verbose_level)
1574// quadric in PG(3,q)
1575{
1576 int f_v = (verbose_level >= 1);
1577 int f_vv = (verbose_level >= 2);
1578 int v[3];
1579 long int i, a;
1580
1581 if (f_v) {
1582 cout << "projective_space::quadric_points_brute_force" << endl;
1583 }
1584 nb_points = 0;
1585 for (i = 0; i < N_points; i++) {
1586 unrank_point(v, i);
1588 if (f_vv) {
1589 cout << "point " << i << " = ";
1590 Int_vec_print(cout, v, 3);
1591 cout << " gives a value of " << a << endl;
1592 }
1593 if (a == 0) {
1594 if (f_vv) {
1595 cout << "point " << i << " = ";
1596 Int_vec_print(cout, v, 4);
1597 cout << " lies on the quadric" << endl;
1598 }
1599 points[nb_points++] = i;
1600 }
1601 }
1602 if (f_v) {
1603 cout << "projective_space::quadric_points_brute_force done, "
1604 "we found " << nb_points << " points" << endl;
1605 }
1606 if (f_vv) {
1607 cout << "They are : ";
1608 Lint_vec_print(cout, points, nb_points);
1609 cout << endl;
1610 }
1611 if (f_v) {
1612 cout << "projective_space::quadric_points_brute_force done" << endl;
1613 }
1614}
1615
1617 long int *five_pts, int *six_coeffs,
1618 long int *points, int &nb_points, int verbose_level)
1619{
1620 int f_v = (verbose_level >= 1);
1621 int f_vv = (verbose_level >= 2);
1622 int Gram_matrix[9];
1623 int Basis[9];
1624 int Basis2[9];
1625 int v[3], w[3];
1626 int i, j, l, a = 0, av, ma, b, bv, t;
1627
1628
1629 if (f_v) {
1630 cout << "projective_space::conic_points" << endl;
1631 }
1632 if (n != 2) {
1633 cout << "projective_space::conic_points n != 2" << endl;
1634 exit(1);
1635 }
1636 Gram_matrix[0 * 3 + 0] = F->add(six_coeffs[0], six_coeffs[0]);
1637 Gram_matrix[1 * 3 + 1] = F->add(six_coeffs[1], six_coeffs[1]);
1638 Gram_matrix[2 * 3 + 2] = F->add(six_coeffs[2], six_coeffs[2]);
1639 Gram_matrix[0 * 3 + 1] = Gram_matrix[1 * 3 + 0] = six_coeffs[3];
1640 Gram_matrix[0 * 3 + 2] = Gram_matrix[2 * 3 + 0] = six_coeffs[4];
1641 Gram_matrix[1 * 3 + 2] = Gram_matrix[2 * 3 + 1] = six_coeffs[5];
1642 if (f_vv) {
1643 cout << "projective_space::conic_points Gram matrix:" << endl;
1645 Gram_matrix, 3, 3, 3, F->log10_of_q);
1646 }
1647
1648 unrank_point(Basis, five_pts[0]);
1649 for (i = 1; i < 5; i++) {
1650 unrank_point(Basis + 3, five_pts[i]);
1651 a = F->Linear_algebra->evaluate_bilinear_form(3, Basis, Basis + 3, Gram_matrix);
1652 if (a) {
1653 break;
1654 }
1655 }
1656 if (i == 5) {
1657 cout << "projective_space::conic_points did not "
1658 "find non-orthogonal vector" << endl;
1659 exit(1);
1660 }
1661 if (a != 1) {
1662 av = F->inverse(a);
1663 for (i = 0; i < 3; i++) {
1664 Basis[3 + i] = F->mult(av, Basis[3 + i]);
1665 }
1666 }
1667 if (f_v) {
1668 cout << "projective_space::conic_points "
1669 "Hyperbolic pair:" << endl;
1671 Basis, 2, 3, 3, F->log10_of_q);
1672 }
1673 F->Linear_algebra->perp(3, 2, Basis, Gram_matrix, 0 /* verbose_level */);
1674 if (f_v) {
1675 cout << "projective_space::conic_points perp:" << endl;
1677 Basis, 3, 3, 3, F->log10_of_q);
1678 }
1679 a = F->Linear_algebra->evaluate_conic_form(six_coeffs, Basis + 6);
1680 if (f_v) {
1681 cout << "projective_space::conic_points "
1682 "form value = " << a << endl;
1683 }
1684 if (a == 0) {
1685 cout << "projective_space::conic_points "
1686 "the form is degenerate or we are in "
1687 "characteristic zero" << endl;
1688 exit(1);
1689 }
1690 l = F->log_alpha(a);
1691 if ((l % 2) == 0) {
1692 j = l / 2;
1693 b = F->alpha_power(j);
1694 bv = F->inverse(b);
1695 for (i = 0; i < 3; i++) {
1696 Basis[6 + i] = F->mult(bv, Basis[6 + i]);
1697 }
1698 a = F->Linear_algebra->evaluate_conic_form(six_coeffs, Basis + 6);
1699 if (f_v) {
1700 cout << "form value = " << a << endl;
1701 }
1702 }
1703 for (i = 0; i < 3; i++) {
1704 Basis2[3 + i] = Basis[6 + i];
1705 }
1706 for (i = 0; i < 3; i++) {
1707 Basis2[0 + i] = Basis[0 + i];
1708 }
1709 for (i = 0; i < 3; i++) {
1710 Basis2[6 + i] = Basis[3 + i];
1711 }
1712 if (f_v) {
1713 cout << "Basis2:" << endl;
1715 Basis2, 3, 3, 3, F->log10_of_q);
1716 }
1717 // Now the form is a^{-1}y_1^2 = y_0y_2
1718 // (or, equivalently, a^{-1}y_1^2 - y_0y_2 = 0)
1719 // and the quadratic form on (0,1,0) in y-coordinates is a.
1720 //
1721 // In the y-coordinates, the points on this conic are
1722 // (1,0,0) and (t^2,t,-a) for t \in GF(q).
1723 // In the x-coordinates, the points are
1724 // (1,0,0) * Basis2 and (t^2,t,-a) * Basis2 for t \in GF(q).
1725
1726 v[0] = 1;
1727 v[1] = 0;
1728 v[2] = 0;
1729
1730 F->Linear_algebra->mult_vector_from_the_left(v, Basis2, w, 3, 3);
1731 if (f_v) {
1732 cout << "vector corresponding to 100:" << endl;
1733 Int_vec_print(cout, w, 3);
1734 cout << endl;
1735 }
1736 b = rank_point(w);
1737 points[0] = b;
1738 nb_points = 1;
1739
1740 ma = F->negate(a);
1741
1742 for (t = 0; t < F->q; t++) {
1743 v[0] = F->mult(t, t);
1744 v[1] = t;
1745 v[2] = ma;
1746 F->Linear_algebra->mult_vector_from_the_left(v, Basis2, w, 3, 3);
1747 if (f_v) {
1748 cout << "vector corresponding to t=" << t << ":" << endl;
1749 Int_vec_print(cout, w, 3);
1750 cout << endl;
1751 }
1752 b = rank_point(w);
1753 points[nb_points++] = b;
1754 }
1755 if (f_vv) {
1756 cout << "projective_space::conic_points conic points:" << endl;
1757 Lint_vec_print(cout, points, nb_points);
1758 cout << endl;
1759 }
1760 if (f_v) {
1761 cout << "projective_space::conic_points done" << endl;
1762 }
1763}
1764
1766 int *six_coeffs,
1767 long int *points, int nb_points,
1768 long int *tangents, int verbose_level)
1769{
1770 int f_v = (verbose_level >= 1);
1771 int f_vv = (verbose_level >= 2);
1772 //int v[3];
1773 int Basis[9];
1774 int Gram_matrix[9];
1775 int i;
1776
1777 if (f_v) {
1778 cout << "projective_space::find_tangent_lines_to_conic" << endl;
1779 }
1780 if (n != 2) {
1781 cout << "projective_space::find_tangent_lines_to_conic "
1782 "n != 2" << endl;
1783 exit(1);
1784 }
1785 Gram_matrix[0 * 3 + 0] = F->add(six_coeffs[0], six_coeffs[0]);
1786 Gram_matrix[1 * 3 + 1] = F->add(six_coeffs[1], six_coeffs[1]);
1787 Gram_matrix[2 * 3 + 2] = F->add(six_coeffs[2], six_coeffs[2]);
1788 Gram_matrix[0 * 3 + 1] = Gram_matrix[1 * 3 + 0] = six_coeffs[3];
1789 Gram_matrix[0 * 3 + 2] = Gram_matrix[2 * 3 + 0] = six_coeffs[4];
1790 Gram_matrix[1 * 3 + 2] = Gram_matrix[2 * 3 + 1] = six_coeffs[5];
1791
1792 for (i = 0; i < nb_points; i++) {
1793 unrank_point(Basis, points[i]);
1794 F->Linear_algebra->perp(3, 1, Basis, Gram_matrix, 0 /* verbose_level */);
1795 if (f_vv) {
1796 cout << "perp:" << endl;
1798 Basis, 3, 3, 3, F->log10_of_q);
1799 }
1800 tangents[i] = rank_line(Basis + 3);
1801 if (f_vv) {
1802 cout << "tangent at point " << i << " is "
1803 << tangents[i] << endl;
1804 }
1805 }
1806 if (f_v) {
1807 cout << "projective_space::find_tangent_lines_to_conic done" << endl;
1808 }
1809}
1810
1811
1812
1813
1814
1815
1817 long int *set, int set_size, int *type, int verbose_level)
1818// type[N_lines]
1819{
1820 int f_v = (verbose_level >= 1);
1821 int i, j, a, b;
1822
1823 if (f_v) {
1824 cout << "projective_space::line_intersection_type" << endl;
1825 }
1826 if (Implementation->Lines_on_point == NULL) {
1827 line_intersection_type_basic(set, set_size, type, verbose_level);
1828 }
1829 else {
1830 for (i = 0; i < N_lines; i++) {
1831 type[i] = 0;
1832 }
1833 for (i = 0; i < set_size; i++) {
1834 a = set[i];
1835 for (j = 0; j < r; j++) {
1836 b = Implementation->Lines_on_point[a * r + j];
1837 type[b]++;
1838 }
1839 }
1840 }
1841 if (f_v) {
1842 cout << "projective_space::line_intersection_type done" << endl;
1843 }
1844}
1845
1847 long int *set, int set_size, int *type, int verbose_level)
1848// type[N_lines]
1849{
1850 int f_v = (verbose_level >= 1);
1851 long int rk, h, d;
1852 int *M;
1853
1854 if (f_v) {
1855 cout << "projective_space::line_intersection_type_basic" << endl;
1856 }
1857 d = n + 1;
1858 M = NEW_int(3 * d);
1859 for (rk = 0; rk < N_lines; rk++) {
1860 type[rk] = 0;
1861 Grass_lines->unrank_lint(rk, 0 /* verbose_level */);
1862 for (h = 0; h < set_size; h++) {
1863 Int_vec_copy(Grass_lines->M, M, 2 * d);
1864 unrank_point(M + 2 * d, set[h]);
1866 3, d, 0 /*verbose_level*/) == 2) {
1867 type[rk]++;
1868 }
1869 } // next h
1870 } // next rk
1871 FREE_int(M);
1872 if (f_v) {
1873 cout << "projective_space::line_intersection_type_basic done" << endl;
1874 }
1875}
1876
1878 long int *lines_by_rank, int nb_lines,
1879 long int *set, int set_size, int *type, int verbose_level)
1880// type[nb_lines]
1881{
1882 int f_v = (verbose_level >= 1);
1883 long int rk, h, d, u;
1884 int *M;
1885
1886 if (f_v) {
1887 cout << "projective_space::line_intersection_type_basic_given_a_set_of_lines" << endl;
1888 }
1889 d = n + 1;
1890 M = NEW_int(3 * d);
1891 for (u = 0; u < nb_lines; u++) {
1892 rk = lines_by_rank[u];
1893 type[u] = 0;
1894 Grass_lines->unrank_lint(rk, 0 /* verbose_level */);
1895 for (h = 0; h < set_size; h++) {
1896 Int_vec_copy(Grass_lines->M, M, 2 * d);
1897 unrank_point(M + 2 * d, set[h]);
1899 3, d, 0 /*verbose_level*/) == 2) {
1900 type[u]++;
1901 }
1902 } // next h
1903 } // next rk
1904 FREE_int(M);
1905 if (f_v) {
1906 cout << "projective_space::line_intersection_type_basic_given_a_set_of_lines done" << endl;
1907 }
1908}
1909
1910
1912 long int *set, int set_size, int *type, int verbose_level)
1913// type[N_lines]
1914{
1915 int f_v = (verbose_level >= 1);
1916 int f_vv = FALSE;
1917 long int rk, h, i, j, d, cnt, i1;
1918 int *M;
1919 int *M2;
1920 int *Pts1;
1921 int *Pts2;
1922 long int *set1;
1923 long int *set2;
1924 int *cnt1;
1925 int sz1, sz2;
1926 int *f_taken;
1927 int nb_pts_in_hyperplane;
1928 int idx;
1929 geometry_global Gg;
1931
1932 if (f_v) {
1933 cout << "projective_space::line_intersection_type_through_hyperplane "
1934 "set_size=" << set_size << endl;
1935 }
1936 d = n + 1;
1937 M = NEW_int(3 * d);
1938 M2 = NEW_int(3 * d);
1939 set1 = NEW_lint(set_size);
1940 set2 = NEW_lint(set_size);
1941 sz1 = 0;
1942 sz2 = 0;
1943 for (i = 0; i < set_size; i++) {
1944 unrank_point(M, set[i]);
1945 if (f_vv) {
1946 cout << set[i] << " : ";
1947 Int_vec_print(cout, M, d);
1948 cout << endl;
1949 }
1950 if (M[d - 1] == 0) {
1951 set1[sz1++] = set[i];
1952 }
1953 else {
1954 set2[sz2++] = set[i];
1955 }
1956 }
1957
1958 Sorting.lint_vec_heapsort(set1, sz1);
1959
1960 if (f_vv) {
1961 cout << "projective_space::line_intersection_type_through_hyperplane "
1962 "sz1=" << sz1 << " sz2=" << sz2 << endl;
1963 }
1964
1965
1966 // do the line type in the hyperplane:
1967 line_intersection_type_basic(set1, sz1, type, verbose_level);
1968 nb_pts_in_hyperplane = Gg.nb_PG_elements(n - 1, q);
1969 if (f_vv) {
1970 cout << "projective_space::line_intersection_type_through_hyperplane "
1971 "nb_pts_in_hyperplane="
1972 << nb_pts_in_hyperplane << endl;
1973 }
1974
1975 cnt1 = NEW_int(nb_pts_in_hyperplane);
1976 Pts1 = NEW_int(nb_pts_in_hyperplane * d);
1977 Pts2 = NEW_int(sz2 * d);
1978
1979 Int_vec_zero(cnt1, nb_pts_in_hyperplane);
1980 for (i = 0; i < nb_pts_in_hyperplane; i++) {
1981 F->PG_element_unrank_modified(Pts1 + i * d, 1, n, i);
1982 Pts1[i * d + d - 1] = 0;
1983 F->PG_element_rank_modified_lint(Pts1 + i * d, 1, n + 1, i1);
1984
1985 // i1 is the rank of the hyperplane point
1986 // inside the larger space:
1987 //unrank_point(Pts1 + i * d, set1[i]);
1988 if (Sorting.lint_vec_search(set1, sz1, i1, idx, 0)) {
1989 cnt1[i] = 1;
1990 }
1991 }
1992 for (i = 0; i < sz2; i++) {
1993 unrank_point(Pts2 + i * d, set2[i]);
1994 }
1995
1996 f_taken = NEW_int(sz2);
1997 for (i = 0; i < nb_pts_in_hyperplane; i++) {
1998 if (f_vv) {
1999 cout << "projective_space::line_intersection_type_through_hyperplane "
2000 "checking lines through point " << i
2001 << " / " << nb_pts_in_hyperplane << ":" << endl;
2002 }
2003 Int_vec_zero(f_taken, sz2);
2004 for (j = 0; j < sz2; j++) {
2005 if (f_taken[j]) {
2006 continue;
2007 }
2008 if (f_vv) {
2009 cout << "projective_space::line_intersection_type_through_hyperplane "
2010 "j=" << j << " / " << sz2 << ":" << endl;
2011 }
2012 Int_vec_copy(Pts1 + i * d, M, d);
2013 Int_vec_copy(Pts2 + j * d, M + d, d);
2014 f_taken[j] = TRUE;
2015 if (f_vv) {
2016 Int_matrix_print(M, 2, d);
2017 }
2018 rk = Grass_lines->rank_lint_here(M, 0 /* verbose_level */);
2019 if (f_vv) {
2020 cout << "projective_space::line_intersection_type_through_hyperplane "
2021 "line rk=" << rk << " cnt1="
2022 << cnt1[rk] << ":" << endl;
2023 }
2024 cnt = 1 + cnt1[i];
2025 for (h = j + 1; h < sz2; h++) {
2026 Int_vec_copy(M, M2, 2 * d);
2027 Int_vec_copy(Pts2 + h * d, M2 + 2 * d, d);
2029 3, d, 0 /*verbose_level*/) == 2) {
2030 cnt++;
2031 f_taken[h] = TRUE;
2032 }
2033 }
2034 type[rk] = cnt;
2035 }
2036 }
2037 FREE_int(f_taken);
2038 FREE_int(M);
2039 FREE_int(M2);
2040 FREE_lint(set1);
2041 FREE_lint(set2);
2042 FREE_int(Pts1);
2043 FREE_int(Pts2);
2044 FREE_int(cnt1);
2045
2046 if (f_v) {
2047 cout << "projective_space::line_intersection_type_through_hyperplane "
2048 "done" << endl;
2049 }
2050}
2051
2053 long int *set, int set_size,
2054 long int *lines, int &nb_lines, int max_lines,
2055 int verbose_level)
2056// finds the secant lines as an ordered set (secant variety).
2057// this is done by looping over all pairs of points and creating the
2058// line that is spanned by the two points.
2059{
2060 int f_v = (verbose_level >= 1);
2061 int i, j, rk, d, h, idx;
2062 int *M;
2064
2065 if (f_v) {
2066 cout << "projective_space::find_secant_lines "
2067 "set_size=" << set_size << endl;
2068 }
2069 d = n + 1;
2070 M = NEW_int(2 * d);
2071 nb_lines = 0;
2072 for (i = 0; i < set_size; i++) {
2073 for (j = i + 1; j < set_size; j++) {
2074 unrank_point(M, set[i]);
2075 unrank_point(M + d, set[j]);
2076 rk = Grass_lines->rank_lint_here(M, 0 /* verbose_level */);
2077
2078 if (!Sorting.lint_vec_search(lines, nb_lines, rk, idx, 0)) {
2079 if (nb_lines == max_lines) {
2080 cout << "projective_space::find_secant_lines "
2081 "nb_lines == max_lines" << endl;
2082 exit(1);
2083 }
2084 for (h = nb_lines; h > idx; h--) {
2085 lines[h] = lines[h - 1];
2086 }
2087 lines[idx] = rk;
2088 nb_lines++;
2089 }
2090 }
2091 }
2092 FREE_int(M);
2093 if (f_v) {
2094 cout << "projective_space::find_secant_lines done" << endl;
2095 }
2096}
2097
2099 std::vector<long int> &Points,
2100 std::vector<long int> &Lines,
2101 int verbose_level)
2102// finds all lines which are completely contained in the set of points
2103// First, finds all lines in the set which lie
2104// in the hyperplane x_d = 0.
2105// Then finds all remaining lines.
2106// The lines are not arranged according to a double six.
2107{
2108 int f_v = (verbose_level >= 1);
2109 int f_vv = (verbose_level >= 2);
2110 int f_vvv = FALSE;
2111 long int rk;
2112 long int h, i, j, d, a, b;
2113 int idx;
2114 int *M;
2115 int *M2;
2116 int *Pts1;
2117 int *Pts2;
2118 long int *set1;
2119 long int *set2;
2120 int sz1, sz2;
2121 int *f_taken;
2123
2124 if (f_v) {
2125 cout << "projective_space::find_lines_which_are_contained "
2126 "set_size=" << Points.size() << endl;
2127 }
2128 //nb_lines = 0;
2129 d = n + 1;
2130 M = NEW_int(3 * d);
2131 M2 = NEW_int(3 * d);
2132 set1 = NEW_lint(Points.size());
2133 set2 = NEW_lint(Points.size());
2134 sz1 = 0;
2135 sz2 = 0;
2136 for (i = 0; i < Points.size(); i++) {
2137 unrank_point(M, Points[i]);
2138 if (f_vvv) {
2139 cout << Points[i] << " : ";
2140 Int_vec_print(cout, M, d);
2141 cout << endl;
2142 }
2143 if (M[d - 1] == 0) {
2144 set1[sz1++] = Points[i];
2145 }
2146 else {
2147 set2[sz2++] = Points[i];
2148 }
2149 }
2150
2151 // set1 is the set of points whose last coordinate is zero.
2152 // set2 is the set of points whose last coordinate is nonzero.
2153 Sorting.lint_vec_heapsort(set1, sz1);
2154 Sorting.lint_vec_heapsort(set2, sz2);
2155
2156 if (f_vv) {
2157 cout << "projective_space::find_lines_which_are_contained "
2158 "sz1=" << sz1 << " sz2=" << sz2 << endl;
2159 }
2160
2161
2162 // find all secants in the hyperplane:
2163 long int *secants;
2164 int n2, nb_secants;
2165
2166 n2 = (sz1 * (sz1 - 1)) >> 1;
2167 // n2 is an upper bound on the number of secant lines
2168
2169 secants = NEW_lint(n2);
2170
2171
2172 if (f_v) {
2173 cout << "projective_space::find_lines_which_are_contained "
2174 "before find_secant_lines" << endl;
2175 }
2176
2177 find_secant_lines(set1, sz1,
2178 secants, nb_secants, n2,
2179 0/*verbose_level - 3*/);
2180
2181 if (f_v) {
2182 cout << "projective_space::find_lines_which_are_contained "
2183 "after find_secant_lines" << endl;
2184 }
2185
2186 if (f_vv) {
2187 cout << "projective_space::find_lines_which_are_contained "
2188 "we found " << nb_secants
2189 << " secants in the hyperplane" << endl;
2190 }
2191
2192 // first we test the secants and
2193 // find those which are lines on the surface:
2194 if (f_vv) {
2195 cout << "projective_space::find_lines_which_are_contained "
2196 "testing secants, nb_secants=" << nb_secants << endl;
2197 }
2198
2199 //nb_lines = 0;
2200 for (i = 0; i < nb_secants; i++) {
2201 rk = secants[i];
2202 Grass_lines->unrank_lint_here(M, rk, 0 /* verbose_level */);
2203 if (f_vvv) {
2204 cout << "testing secant " << i << " / " << nb_secants
2205 << " which is line " << rk << ":" << endl;
2206 Int_matrix_print(M, 2, d);
2207 }
2208
2209 int coeffs[2];
2210
2211 // loop over all points on the line:
2212 for (a = 0; a < q + 1; a++) {
2213
2214 // unrank a point on the projective line:
2215 F->PG_element_unrank_modified(coeffs, 1, 2, a);
2216 Int_vec_copy(M, M2, 2 * d);
2217
2218 // map the point to the line at hand.
2219 // form the linear combination:
2220 // coeffs[0] * row0 of M2 + coeffs[1] * row1 of M2:
2221 for (h = 0; h < d; h++) {
2222 M2[2 * d + h] = F->add(
2223 F->mult(coeffs[0], M2[0 * d + h]),
2224 F->mult(coeffs[1], M2[1 * d + h]));
2225 }
2226
2227 // rank the test point and see
2228 // if it belongs to the surface:
2229 F->PG_element_rank_modified_lint(M2 + 2 * d, 1, d, b);
2230 if (!Sorting.lint_vec_search(set1, sz1, b, idx, 0)) {
2231 break;
2232 }
2233 }
2234 if (a == q + 1) {
2235 // all q + 1 points of the secant line
2236 // belong to the surface, so we
2237 // found a line on the surface in the hyperplane.
2238 //lines[nb_lines++] = rk;
2239 if (f_vv) {
2240 cout << "secant " << i << " / " << nb_secants
2241 << " of rank " << rk << " is contained, adding" << endl;
2242 }
2243 Lines.push_back(rk);
2244 }
2245 }
2246 FREE_lint(secants);
2247
2248 if (f_v) {
2249 cout << "projective_space::find_lines_which_are_contained "
2250 "We found " << Lines.size() << " in the hyperplane" << endl;
2251 //lint_vec_print(cout, lines, nb_lines);
2252 cout << endl;
2253 }
2254
2255
2256
2257 Pts1 = NEW_int(sz1 * d);
2258 Pts2 = NEW_int(sz2 * d);
2259
2260 for (i = 0; i < sz1; i++) {
2261 unrank_point(Pts1 + i * d, set1[i]);
2262 }
2263 for (i = 0; i < sz2; i++) {
2264 unrank_point(Pts2 + i * d, set2[i]);
2265 }
2266
2267 if (f_vv) {
2268 cout << "projective_space::find_lines_which_are_contained "
2269 "checking lines through points of the hyperplane, sz1=" << sz1 << endl;
2270 }
2271
2272 f_taken = NEW_int(sz2);
2273 for (i = 0; i < sz1; i++) {
2274 if (f_vvv) {
2275 cout << "projective_space::find_lines_which_are_contained "
2276 "checking lines through hyperplane point " << i
2277 << " / " << sz1 << ":" << endl;
2278 }
2279
2280 // consider a point P1 on the surface and in the hyperplane
2281
2282 Int_vec_zero(f_taken, sz2);
2283 for (j = 0; j < sz2; j++) {
2284 if (f_taken[j]) {
2285 continue;
2286 }
2287 if (f_vvv) {
2288 cout << "projective_space::find_lines_which_are_contained "
2289 "i=" << i << " j=" << j << " / " << sz2 << ":" << endl;
2290 }
2291
2292 // consider a point P2 on the surface
2293 // but not in the hyperplane:
2294
2295 Int_vec_copy(Pts1 + i * d, M, d);
2296 Int_vec_copy(Pts2 + j * d, M + d, d);
2297
2298 f_taken[j] = TRUE;
2299
2300 if (f_vvv) {
2301 Int_matrix_print(M, 2, d);
2302 }
2303
2304 rk = Grass_lines->rank_lint_here(M, 0 /* verbose_level */);
2305 if (f_vvv) {
2306 cout << "projective_space::find_lines_which_are_contained "
2307 "line rk=" << rk << ":" << endl;
2308 }
2309
2310 // test the q-1 points on the line through the P1 and P2
2311 // (but excluding P1 and P2 themselves):
2312 for (a = 1; a < q; a++) {
2313 Int_vec_copy(M, M2, 2 * d);
2314
2315 // form the linear combination P3 = P1 + a * P2:
2316 for (h = 0; h < d; h++) {
2317 M2[2 * d + h] =
2318 F->add(
2319 M2[0 * d + h],
2320 F->mult(a, M2[1 * d + h]));
2321 }
2322 // row 2 of M2 contains the coordinates of the point P3:
2323 F->PG_element_rank_modified_lint(M2 + 2 * d, 1, d, b);
2324 if (!Sorting.lint_vec_search(set2, sz2, b, idx, 0)) {
2325 break;
2326 }
2327 else {
2328 if (f_vvv) {
2329 cout << "eliminating point " << idx << endl;
2330 }
2331 // we don't need to consider this point for P2:
2332 f_taken[idx] = TRUE;
2333 }
2334 }
2335 if (a == q) {
2336 // The line P1P2 is contained in the surface.
2337 // Add it to lines[]
2338#if 0
2339 if (nb_lines == max_lines) {
2340 cout << "projective_space::find_lines_which_are_"
2341 "contained nb_lines == max_lines" << endl;
2342 exit(1);
2343 }
2344#endif
2345 //lines[nb_lines++] = rk;
2346 if (f_vvv) {
2347 cout << "adding line " << rk << " nb_lines="
2348 << Lines.size() << endl;
2349 }
2350 Lines.push_back(rk);
2351 if (f_vvv) {
2352 cout << "adding line " << rk << " nb_lines="
2353 << Lines.size() << " done" << endl;
2354 }
2355 }
2356 }
2357 }
2358 FREE_int(M);
2359 FREE_int(M2);
2360 FREE_lint(set1);
2361 FREE_lint(set2);
2362 FREE_int(Pts1);
2363 FREE_int(Pts2);
2364 FREE_int(f_taken);
2365
2366 if (f_v) {
2367 cout << "projective_space::find_lines_which_are_contained done" << endl;
2368 }
2369}
2370
2371
2373 long int *point_rks, int nb_points,
2374 long int *plane_rks, int nb_planes,
2375 int *&M, int verbose_level)
2376// M[nb_points * nb_planes]
2377{
2378 int f_v = (verbose_level >= 1);
2379 int rk, d, i, j;
2380 int *M1;
2381 int *M2;
2382 int *Pts;
2383 grassmann *G;
2384
2385 if (f_v) {
2386 cout << "projective_space::plane_intersection_type_basic" << endl;
2387 }
2388 d = n + 1;
2389 M1 = NEW_int(4 * d);
2390 M2 = NEW_int(4 * d);
2391 Pts = NEW_int(nb_points * d);
2392 G = NEW_OBJECT(grassmann);
2393
2394 G->init(d, 3, F, 0 /* verbose_level */);
2395
2396 M = NEW_int(nb_points * nb_planes);
2397 Int_vec_zero(M, nb_points * nb_planes);
2398
2399 // unrank all point here so we don't
2400 // have to do it again in the loop
2401 for (i = 0; i < nb_points; i++) {
2402 unrank_point(Pts + i * d, point_rks[i]);
2403 }
2404
2405 for (j = 0; j < nb_planes; j++) {
2406 if (rk && (rk % ONE_MILLION) == 0) {
2407 cout << "projective_space::plane_intersection_type_basic "
2408 "rk=" << rk << endl;
2409 }
2410 rk = plane_rks[j];
2411 G->unrank_lint_here(M1, rk, 0 /* verbose_level */);
2412
2413 // check which points are contained in the plane:
2414 for (i = 0; i < nb_points; i++) {
2415
2416 Int_vec_copy(M1, M2, 3 * d);
2417 //unrank_point(M2 + 3 * d, set[h]);
2418 Int_vec_copy(Pts + i * d, M2 + 3 * d, d);
2419
2421 4, d, 0 /*verbose_level*/) == 3) {
2422 // the point lies in the plane,
2423 // increment the intersection count:
2424 M[i * nb_planes + j] = 1;
2425 }
2426 } // next h
2427
2428 } // next rk
2429 FREE_int(M1);
2430 FREE_int(M2);
2431 FREE_int(Pts);
2432 FREE_OBJECT(G);
2433 if (f_v) {
2434 cout << "projective_space::plane_intersection_type_basic done" << endl;
2435 }
2436}
2437
2438
2439
2441 long int *set, int set_size,
2442 int *type, int verbose_level)
2443// type[N_planes]
2444{
2445 int f_v = (verbose_level >= 1);
2446 int rk, h, d, N_planes;
2447 int *M1;
2448 int *M2;
2449 int *Pts;
2450 grassmann *G;
2451
2452 if (f_v) {
2453 cout << "projective_space::plane_intersection_type_basic" << endl;
2454 }
2455 d = n + 1;
2456 M1 = NEW_int(4 * d);
2457 M2 = NEW_int(4 * d);
2458 Pts = NEW_int(set_size * d);
2459 G = NEW_OBJECT(grassmann);
2460
2461 G->init(d, 3, F, 0 /* verbose_level */);
2462
2463 N_planes = nb_rk_k_subspaces_as_lint(3);
2464 if (f_v) {
2465 cout << "projective_space::plane_intersection_type_basic "
2466 "N_planes=" << N_planes << endl;
2467 }
2468
2469 // unrank all point here so we don't
2470 // have to do it again in the loop
2471 for (h = 0; h < set_size; h++) {
2472 unrank_point(Pts + h * d, set[h]);
2473 }
2474
2475 for (rk = 0; rk < N_planes; rk++) {
2476 if (rk && (rk % ONE_MILLION) == 0) {
2477 cout << "projective_space::plane_intersection_type_basic "
2478 "rk=" << rk << endl;
2479 }
2480 type[rk] = 0;
2481 G->unrank_lint_here(M1, rk, 0 /* verbose_level */);
2482
2483 // check which points are contained in the plane:
2484 for (h = 0; h < set_size; h++) {
2485
2486 Int_vec_copy(M1, M2, 3 * d);
2487 //unrank_point(M2 + 3 * d, set[h]);
2488 Int_vec_copy(Pts + h * d, M2 + 3 * d, d);
2489
2491 4, d, 0 /*verbose_level*/) == 3) {
2492 // the point lies in the plane,
2493 // increment the intersection count:
2494 type[rk]++;
2495 }
2496 } // next h
2497
2498 } // next rk
2499 FREE_int(M1);
2500 FREE_int(M2);
2501 FREE_int(Pts);
2502 FREE_OBJECT(G);
2503 if (f_v) {
2504 cout << "projective_space::plane_intersection_type_basic done" << endl;
2505 }
2506}
2507
2509 long int *set, int set_size, int *type,
2510 int verbose_level)
2511// type[N_hyperplanes]
2512{
2513 int f_v = (verbose_level >= 1);
2514 int rk, h, d, N_hyperplanes;
2515 int *M;
2516 int *Pts;
2517 grassmann *G;
2518
2519 if (f_v) {
2520 cout << "projective_space::hyperplane_intersection_type_basic" << endl;
2521 }
2522 d = n + 1;
2523 M = NEW_int(4 * d);
2524 Pts = NEW_int(set_size * d);
2525 G = NEW_OBJECT(grassmann);
2526
2527 G->init(d, d - 1, F, 0 /* verbose_level */);
2528
2529 N_hyperplanes = nb_rk_k_subspaces_as_lint(d - 1);
2530
2531 // unrank all point here so we don't
2532 // have to do it again in the loop
2533 for (h = 0; h < set_size; h++) {
2534 unrank_point(Pts + h * d, set[h]);
2535 }
2536
2537 for (rk = 0; rk < N_hyperplanes; rk++) {
2538 type[rk] = 0;
2539 G->unrank_lint(rk, 0 /* verbose_level */);
2540
2541 // check which points are contained in the hyperplane:
2542 for (h = 0; h < set_size; h++) {
2543
2544 Int_vec_copy(G->M, M, (d - 1) * d);
2545 //unrank_point(M + (d - 1) * d, set[h]);
2546 Int_vec_copy(Pts + h * d, M + (d - 1) * d, d);
2547
2549 d, d, 0 /*verbose_level*/) == d - 1) {
2550 // the point lies in the hyperplane,
2551 // increment the intersection count:
2552 type[rk]++;
2553 }
2554 } // next h
2555
2556 } // next rk
2557 FREE_int(M);
2558 FREE_int(Pts);
2559 FREE_OBJECT(G);
2560 if (f_v) {
2561 cout << "projective_space::hyperplane_intersection_type_basic done" << endl;
2562 }
2563}
2564
2565
2566
2568 long int *set, int set_size, int *type_collected,
2569 int verbose_level)
2570// type[set_size + 1]
2571{
2572 int f_v = (verbose_level >= 1);
2573 int rk, h, d, cnt;
2574 int *M;
2575 int *Pts;
2576
2577 if (f_v) {
2578 cout << "projective_space::line_intersection_type_collected" << endl;
2579 }
2580 d = n + 1;
2581 M = NEW_int(3 * d);
2582 Pts = NEW_int(set_size * d);
2583 Int_vec_zero(type_collected, set_size + 1);
2584
2585 // unrank all point here so we don't
2586 // have to do it again in the loop
2587 for (h = 0; h < set_size; h++) {
2588 unrank_point(Pts + h * d, set[h]);
2589 }
2590
2591 // loop over all lines:
2592 for (rk = 0; rk < N_lines; rk++) {
2593 Grass_lines->unrank_lint(rk, 0 /* verbose_level */);
2594 cnt = 0;
2595
2596 // find which points in the set lie on the line:
2597 for (h = 0; h < set_size; h++) {
2598
2599 Int_vec_copy(Grass_lines->M, M, 2 * d);
2600
2601
2602 //unrank_point(M + 2 * d, set[h]);
2603 Int_vec_copy(Pts + h * d, M + 2 * d, d);
2604
2605 // test if the point lies on the line:
2607 3, d, 0 /*verbose_level*/) == 2) {
2608
2609 // yes, increment the counter
2610 cnt++;
2611 }
2612 } // next h
2613
2614 // cnt is the number of points on the line:
2615 // increment the line type vector at cnt:
2616 type_collected[cnt]++;
2617
2618 } // next rk
2619 FREE_int(M);
2620 FREE_int(Pts);
2621 if (f_v) {
2622 cout << "projective_space::line_intersection_type_collected done" << endl;
2623 }
2624}
2625
2627 long int *set_of_lines, int set_size,
2628 int *type, int verbose_level)
2629{
2630 int i, j, a, b;
2631
2632 for (i = 0; i < N_points; i++) {
2633 type[i] = 0;
2634 }
2635 for (i = 0; i < set_size; i++) {
2636 a = set_of_lines[i];
2637 for (j = 0; j < k; j++) {
2638 b = Implementation->Lines[a * k + j];
2639 type[b]++;
2640 }
2641 }
2642}
2643
2645 int *set_of_lines, int set_size,
2646 int *type, int verbose_level)
2647{
2648 int i, j, a, b;
2649
2650 for (i = 0; i < N_points; i++) {
2651 type[i] = 0;
2652 }
2653 for (i = 0; i < set_size; i++) {
2654 a = set_of_lines[i];
2655 for (j = 0; j < k; j++) {
2656 b = Implementation->Lines[a * k + j];
2657 type[b]++;
2658 }
2659 }
2660}
2661
2663 long int *set, int set_size,
2664 long int *external_lines, int &nb_external_lines,
2665 int verbose_level)
2666{
2667 int *type;
2668 int i;
2669
2670 nb_external_lines = 0;
2671 type = NEW_int(N_lines);
2672 line_intersection_type(set, set_size, type, verbose_level);
2673 for (i = 0; i < N_lines; i++) {
2674 if (type[i]) {
2675 continue;
2676 }
2677 external_lines[nb_external_lines++] = i;
2678 }
2679 FREE_int(type);
2680}
2681
2683 long int *set, int set_size,
2684 long int *tangent_lines, int &nb_tangent_lines,
2685 int verbose_level)
2686{
2687 int *type;
2688 int i;
2689
2690 nb_tangent_lines = 0;
2691 type = NEW_int(N_lines);
2692 line_intersection_type(set, set_size, type, verbose_level);
2693 for (i = 0; i < N_lines; i++) {
2694 if (type[i] != 1) {
2695 continue;
2696 }
2697 tangent_lines[nb_tangent_lines++] = i;
2698 }
2699 FREE_int(type);
2700}
2701
2703 long int *set, int set_size,
2704 long int *secant_lines, int &nb_secant_lines,
2705 int verbose_level)
2706{
2707 int *type;
2708 int i;
2709
2710 nb_secant_lines = 0;
2711 type = NEW_int(N_lines);
2712 line_intersection_type(set, set_size, type, verbose_level);
2713 for (i = 0; i < N_lines; i++) {
2714 if (type[i] != 2) {
2715 continue;
2716 }
2717 secant_lines[nb_secant_lines++] = i;
2718 }
2719 FREE_int(type);
2720}
2721
2723 long int *set, int set_size, int k,
2724 long int *secant_lines, int &nb_secant_lines,
2725 int verbose_level)
2726{
2727 int *type;
2728 int i;
2729
2730 nb_secant_lines = 0;
2731 type = NEW_int(N_lines);
2732 line_intersection_type(set, set_size, type, verbose_level);
2733 for (i = 0; i < N_lines; i++) {
2734 if (type[i] != k) {
2735 continue;
2736 }
2737 secant_lines[nb_secant_lines++] = i;
2738 }
2739 FREE_int(type);
2740}
2741
2742
2744 long int *&pts, int &nb_pts, int verbose_level)
2745{
2746 int f_v = (verbose_level >= 1);
2747 int f_vv = (verbose_level >= 2);
2748 int f_vvv = (verbose_level >= 3);
2749 int *M;
2750 int *Basis;
2751 int *N; // local coordinates w.r.t. basis
2752 int *base_cols;
2753 int *z;
2754 int rk;
2755 int len;
2756 int i, j;
2758
2759 if (f_v) {
2760 cout << "projective_space::Baer_subline" << endl;
2761 }
2762 if (ODD(F->e)) {
2763 cout << "projective_space::Baer_subline field degree "
2764 "must be even (because we need a "
2765 "quadratic subfield)" << endl;
2766 exit(1);
2767 }
2768 len = n + 1;
2769 M = NEW_int(3 * len);
2770 base_cols = NEW_int(len);
2771 z = NEW_int(len);
2772 for (j = 0; j < 3; j++) {
2773 unrank_point(M + j * len, pts3[j]);
2774 }
2775 if (f_vv) {
2776 cout << "projective_space::Baer_subline" << endl;
2777 cout << "M=" << endl;
2779 M, 3, len, len, F->log10_of_q);
2780 }
2781 rk = F->Linear_algebra->Gauss_simple(M,
2782 3, len, base_cols, verbose_level - 3);
2783 if (f_vv) {
2784 cout << "projective_space::Baer_subline" << endl;
2785 cout << "has rank " << rk << endl;
2786 cout << "base_cols=";
2787 Int_vec_print(cout, base_cols, rk);
2788 cout << endl;
2789 cout << "basis:" << endl;
2791 M, rk, len, len, F->log10_of_q);
2792 }
2793
2794 if (rk != 2) {
2795 cout << "projective_space::Baer_subline: rk should "
2796 "be 2 (points are not collinear)" << endl;
2797 exit(1);
2798 }
2799
2800 Basis = NEW_int(rk * len);
2801 for (j = 0; j < rk * len; j++) {
2802 Basis[j] = M[j];
2803 }
2804 if (f_vv) {
2805 cout << "projective_space::Baer_subline basis:" << endl;
2807 Basis, rk, len, len, F->log10_of_q);
2808 }
2809
2810 N = NEW_int(3 * rk);
2811 for (j = 0; j < 3; j++) {
2812 unrank_point(M + j * len, pts3[j]);
2813 //cout << "M + j * len:";
2814 //int_vec_print(cout, M + j * len, len);
2815 //cout << endl;
2816 //cout << "basis:" << endl;
2817 //print_integer_matrix_width(cout,
2818 //Basis, rk, 5, 5, P4->F->log10_of_q);
2819
2821 rk, len, Basis, base_cols,
2822 M + j * len, N + j * rk, verbose_level - 3);
2823 }
2824 //cout << "after reduce_mod_subspace_and_get_
2825 //coefficient_vector: M=" << endl;
2826 //print_integer_matrix_width(cout, M, 3, len, len, F->log10_of_q);
2827 //cout << "(should be all zeros)" << endl;
2828 if (f_vv) {
2829 cout << "projective_space::Baer_subline "
2830 "local coordinates in the subspace are N=" << endl;
2832 N, 3, rk, rk, F->log10_of_q);
2833 }
2834 int *Frame;
2835 int *base_cols2;
2836 int rk2, a;
2837
2838 Frame = NEW_int(2 * 3);
2839 base_cols2 = NEW_int(3);
2840 for (j = 0; j < 3; j++) {
2841 for (i = 0; i < 2; i++) {
2842 Frame[i * 3 + j] = N[j * 2 + i];
2843 }
2844 }
2845 if (f_vv) {
2846 cout << "projective_space::Baer_subline "
2847 "Frame=" << endl;
2849 Frame, 2, 3, 3, F->log10_of_q);
2850 }
2851 rk2 = F->Linear_algebra->Gauss_simple(Frame,
2852 2, 3, base_cols2, verbose_level - 3);
2853 if (rk2 != 2) {
2854 cout << "projective_space::Baer_subline: "
2855 "rk2 should be 2" << endl;
2856 exit(1);
2857 }
2858 if (f_vv) {
2859 cout << "projective_space::Baer_subline "
2860 "after Gauss Frame=" << endl;
2862 Frame, 2, 3, 3, F->log10_of_q);
2863 cout << "projective_space::Baer_subline "
2864 "base_cols2=";
2865 Int_vec_print(cout, base_cols2, rk2);
2866 cout << endl;
2867 }
2868 for (i = 0; i < 2; i++) {
2869 a = Frame[i * 3 + 2];
2870 for (j = 0; j < 2; j++) {
2871 N[i * 2 + j] = F->mult(a, N[i * 2 + j]);
2872 }
2873 }
2874 if (f_vv) {
2875 cout << "projective_space::Baer_subline "
2876 "local coordinates in the subspace are N=" << endl;
2877 Int_vec_print_integer_matrix_width(cout, N, 3, rk, rk, F->log10_of_q);
2878 }
2879
2880#if 0
2881 int *Local_pts;
2882 int *Local_pts_sorted;
2883 int w[2];
2884
2885
2886 Local_pts = NEW_int(nb_pts);
2887 Local_pts_sorted = NEW_int(nb_pts);
2888
2889 for (i = 0; i < nb_pts; i++) {
2890 for (j = 0; j < 2; j++) {
2891 w[j] = N[i * 2 + j];
2892 }
2893 PG_element_rank_modified(*F, w, 1, 2, a);
2894 Local_pts[i] = a;
2895 Local_pts_sorted[i] = a;
2896 }
2897 int_vec_heapsort(Local_pts_sorted, nb_pts);
2898 if (f_vv) {
2899 cout << "Local_pts=" << endl;
2900 int_vec_print(cout, Local_pts, nb_pts);
2901 cout << endl;
2902 cout << "Local_pts_sorted=" << endl;
2903 int_vec_print(cout, Local_pts_sorted, nb_pts);
2904 cout << endl;
2905 }
2906#endif
2907
2908
2909 int q0, index, t;
2910
2911
2912 q0 = NT.i_power_j(F->p, F->e >> 1);
2913 index = (F->q - 1) / (q0 - 1);
2914
2915 nb_pts = q0 + 1;
2916 pts = NEW_lint(nb_pts);
2917
2918
2919 if (f_vv) {
2920 cout << "projective_space::Baer_subline q0=" << q0 << endl;
2921 cout << "projective_space::Baer_subline index=" << index << endl;
2922 cout << "projective_space::Baer_subline nb_pts=" << nb_pts << endl;
2923 }
2924
2925#if 0
2926 for (i = 0; i < 3; i++) {
2927 for (j = 0; j < len; j++) {
2928 if (i < 2) {
2929 z[j] = Basis[i * len + j];
2930 }
2931 else {
2932 z[j] = F->add(Basis[0 * len + j], Basis[1 * len + j]);
2933 }
2934 }
2935 pts[i] = rank_point(z);
2936 }
2937#endif
2938 for (t = 0; t < 3; t++) {
2939 if (f_vvv) {
2940 cout << "t=" << t << endl;
2941 }
2942 F->Linear_algebra->mult_vector_from_the_left(N + t * 2, Basis, z, 2, len);
2943 if (f_vvv) {
2944 cout << "z=w*Basis";
2945 Int_vec_print(cout, z, len);
2946 cout << endl;
2947 }
2948 a = rank_point(z);
2949 pts[t] = a;
2950 }
2951 for (t = 2; t < q0; t++) {
2952 a = F->alpha_power((t - 1) * index);
2953 if (f_vvv) {
2954 cout << "t=" << t << " a=" << a << endl;
2955 }
2956 for (j = 0; j < 2; j++) {
2957 w[j] = F->add(N[0 * 2 + j], F->mult(a, N[1 * 2 + j]));
2958 }
2959 if (f_vvv) {
2960 cout << "w=";
2961 Int_vec_print(cout, w, 2);
2962 cout << endl;
2963 }
2964 F->Linear_algebra->mult_vector_from_the_left(w, Basis, z, 2, len);
2965 if (f_vvv) {
2966 cout << "z=w*Basis";
2967 Int_vec_print(cout, z, len);
2968 cout << endl;
2969 }
2970 a = rank_point(z);
2971 pts[t + 1] = a;
2972 if (f_vvv) {
2973 cout << "rank=" << a << endl;
2974 }
2975#if 0
2976 PG_element_rank_modified(*F, w, 1, 2, a);
2977 pts[t] = a;
2978 if (!int_vec_search(Local_pts_sorted, nb_pts, a, idx)) {
2979 ret = FALSE;
2980 if (f_vv) {
2981 cout << "did not find this point in the list of "
2982 "points, hence not contained in Baer subline" << endl;
2983 }
2984 goto done;
2985 }
2986#endif
2987
2988 }
2989
2990 if (f_vv) {
2991 cout << "projective_space::Baer_subline The Baer subline is";
2992 Lint_vec_print(cout, pts, nb_pts);
2993 cout << endl;
2994 print_set(pts, nb_pts);
2995 }
2996
2997
2998
2999
3000 FREE_int(N);
3001 FREE_int(M);
3002 FREE_int(base_cols);
3003 FREE_int(Basis);
3004 FREE_int(Frame);
3005 FREE_int(base_cols2);
3006 FREE_int(z);
3007}
3008
3010{
3011 //ost << "\\parindent=0pt" << endl;
3012 ost << "$q = " << F->q << "$\\\\" << endl;
3013 ost << "$p = " << F->p << "$\\\\" << endl;
3014 ost << "$e = " << F->e << "$\\\\" << endl;
3015 ost << "$n = " << n << "$\\\\" << endl;
3016 ost << "Number of points = " << N_points << "\\\\" << endl;
3017 ost << "Number of lines = " << N_lines << "\\\\" << endl;
3018 ost << "Number of lines on a point = " << r << "\\\\" << endl;
3019 ost << "Number of points on a line = " << k << "\\\\" << endl;
3020}
3021
3024 int verbose_level)
3025{
3026 int f_v = (verbose_level >= 1);
3027
3028 if (f_v) {
3029 cout << "projective_space::report" << endl;
3030 }
3031
3032 ost << "\\subsection*{The projective space ${\\rm \\PG}(" << n << "," << F->q << ")$}" << endl;
3033 ost << "\\noindent" << endl;
3034 ost << "\\arraycolsep=2pt" << endl;
3035 ost << "\\parindent=0pt" << endl;
3036 ost << "$q = " << F->q << "$\\\\" << endl;
3037 ost << "$p = " << F->p << "$\\\\" << endl;
3038 ost << "$e = " << F->e << "$\\\\" << endl;
3039 ost << "$n = " << n << "$\\\\" << endl;
3040 ost << "Number of points = " << N_points << "\\\\" << endl;
3041 ost << "Number of lines = " << N_lines << "\\\\" << endl;
3042 ost << "Number of lines on a point = " << r << "\\\\" << endl;
3043 ost << "Number of points on a line = " << k << "\\\\" << endl;
3044
3045 //ost<< "\\clearpage" << endl << endl;
3046 //ost << "\\section{The Finite Field with $" << q << "$ Elements}" << endl;
3047 //F->cheat_sheet(ost, verbose_level);
3048
3049#if 0
3050 if (f_v) {
3051 cout << "projective_space::report before incidence_matrix_save_csv" << endl;
3052 }
3053 incidence_matrix_save_csv();
3054 if (f_v) {
3055 cout << "projective_space::report after incidence_matrix_save_csv" << endl;
3056 }
3057#endif
3058
3059 if (n == 2) {
3060 //ost << "\\clearpage" << endl << endl;
3061 ost << "\\subsection*{The plane}" << endl;
3062 string fname_base;
3063 char str[1000];
3064 long int *set;
3065 int i;
3066
3067 set = NEW_lint(N_points);
3068 for (i = 0; i < N_points; i++) {
3069 set[i] = i;
3070 }
3071 sprintf(str, "plane_of_order_%d", q);
3072 fname_base.assign(str);
3073
3075
3076 Pt.draw_point_set_in_plane(fname_base,
3077 O,
3078 this,
3079 set, N_points,
3080 TRUE /*f_point_labels*/,
3081 verbose_level);
3082 FREE_lint(set);
3083 ost << "{\\scriptsize" << endl;
3084 ost << "$$" << endl;
3085 ost << "\\input " << fname_base << "_draw.tex" << endl;
3086 ost << "$$" << endl;
3087 ost << "}%%" << endl;
3088 }
3089
3090 //ost << "\\clearpage" << endl << endl;
3091 ost << "\\subsection*{The points of ${\\rm \\PG}(" << n << "," << F->q << ")$}" << endl;
3092 cheat_sheet_points(ost, verbose_level);
3093
3094 //cheat_sheet_point_table(ost, verbose_level);
3095
3096
3097#if 0
3098 //ost << "\\clearpage" << endl << endl;
3099 cheat_sheet_points_on_lines(ost, verbose_level);
3100
3101 //ost << "\\clearpage" << endl << endl;
3102 cheat_sheet_lines_on_points(ost, verbose_level);
3103#endif
3104
3105 // report subspaces:
3106 int k;
3107
3108 for (k = 1; k < n; k++) {
3109 //ost << "\\clearpage" << endl << endl;
3110 if (k == 1) {
3111 ost << "\\subsection*{The lines of ${\\rm \\PG}(" << n << "," << F->q << ")$}" << endl;
3112 }
3113 else if (k == 2) {
3114 ost << "\\subsection*{The planes of ${\\rm \\PG}(" << n << "," << F->q << ")$}" << endl;
3115 }
3116 else {
3117 ost << "\\subsection*{The subspaces of dimension " << k << " of ${\\rm \\PG}(" << n << "," << F->q << ")$}" << endl;
3118 }
3119 //ost << "\\section{Subspaces of dimension " << k << "}" << endl;
3120 if (f_v) {
3121 cout << "projective_space::report before cheat_sheet_subspaces, k=" << k << endl;
3122 }
3123 cheat_sheet_subspaces(ost, k, verbose_level);
3124 if (f_v) {
3125 cout << "projective_space::report after cheat_sheet_subspaces, k=" << k << endl;
3126 }
3127 }
3128
3129
3130#if 0
3131 if (n >= 2 && N_lines < 25) {
3132 //ost << "\\clearpage" << endl << endl;
3133 ost << "\\section*{Line intersections}" << endl;
3134 cheat_sheet_line_intersection(ost, verbose_level);
3135 }
3136
3137
3138 if (n >= 2 && N_points < 25) {
3139 //ost << "\\clearpage" << endl << endl;
3140 ost << "\\section*{Line through point-pairs}" << endl;
3141 cheat_sheet_line_through_pairs_of_points(ost, verbose_level);
3142 }
3143#endif
3144
3149
3154
3155 ost << "\\subsection*{The polynomial rings associated "
3156 "with ${\\rm \\PG}(" << n << "," << F->q << ")$}" << endl;
3157 Poly1->init(F,
3158 n + 1 /* nb_vars */, 1 /* degree */,
3159 FALSE /* f_init_incidence_structure */,
3160 t_PART,
3161 verbose_level);
3162 Poly2->init(F,
3163 n + 1 /* nb_vars */, 2 /* degree */,
3164 FALSE /* f_init_incidence_structure */,
3165 t_PART,
3166 verbose_level);
3167 Poly3->init(F,
3168 n + 1 /* nb_vars */, 3 /* degree */,
3169 FALSE /* f_init_incidence_structure */,
3170 t_PART,
3171 verbose_level);
3172 Poly4->init(F,
3173 n + 1 /* nb_vars */, 4 /* degree */,
3174 FALSE /* f_init_incidence_structure */,
3175 t_PART,
3176 verbose_level);
3177
3178 Poly1->print_monomial_ordering(ost);
3179 Poly2->print_monomial_ordering(ost);
3180 Poly3->print_monomial_ordering(ost);
3181 Poly4->print_monomial_ordering(ost);
3182
3183 FREE_OBJECT(Poly1);
3184 FREE_OBJECT(Poly2);
3185 FREE_OBJECT(Poly3);
3186 FREE_OBJECT(Poly4);
3187
3188 if (f_v) {
3189 cout << "projective_space::report done" << endl;
3190 }
3191
3192}
3193
3195{
3196 int f_v = (verbose_level >= 1);
3197
3198 if (f_v) {
3199 cout << "projective_space::export_incidence_matrix_to_csv" << endl;
3200 }
3201
3202 int i, j, k;
3203 int *T;
3205
3206 T = NEW_int(N_points * N_lines);
3207 for (i = 0; i < N_points; i++) {
3208 for (j = 0; j < N_lines; j++) {
3209 if (is_incident(i, j)) {
3210 k = 1;
3211 }
3212 else {
3213 k = 0;
3214 }
3215 T[i * N_lines + j] = k;
3216 }
3217 }
3218 string fname;
3219
3221
3222 Fio.int_matrix_write_csv(fname, T, N_points, N_lines);
3223
3224 if (f_v) {
3225 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
3226 }
3227
3228 FREE_int(T);
3229 if (f_v) {
3230 cout << "projective_space::export_incidence_matrix_to_csv done" << endl;
3231 }
3232}
3233
3235{
3236 char str[1000];
3237
3238 sprintf(str, "PG_n%d_q%d", n, q);
3239 fname.assign(str);
3240 fname.append("_incidence_matrix.csv");
3241}
3242
3243
3246 int verbose_level)
3247{
3248 int f_v = (verbose_level >= 1);
3249
3250
3251 if (f_v) {
3252 cout << "projective_space::create_latex_report" << endl;
3253 }
3254
3255 {
3256 char str[1000];
3257 string fname;
3258 char title[1000];
3259 char author[1000];
3260
3261 snprintf(str, 1000, "PG_%d_%d.tex", n, F->q);
3262 fname.assign(str);
3263 snprintf(title, 1000, "Cheat Sheet PG($%d,%d$)", n, F->q);
3264 //strcpy(author, "");
3265 author[0] = 0;
3266
3267
3268 {
3269 ofstream ost(fname);
3271
3272 L.head(ost,
3273 FALSE /* f_book*/,
3274 TRUE /* f_title */,
3275 title, author,
3276 FALSE /* f_toc */,
3277 FALSE /* f_landscape */,
3278 TRUE /* f_12pt */,
3279 TRUE /* f_enlarged_page */,
3280 TRUE /* f_pagenumbers */,
3281 NULL /* extra_praeamble */);
3282
3283
3284 if (f_v) {
3285 cout << "projective_space::create_latex_report before P->report" << endl;
3286 }
3287 report(ost, O, verbose_level);
3288 if (f_v) {
3289 cout << "projective_space::create_latex_report after P->report" << endl;
3290 }
3291
3292
3293 L.foot(ost);
3294
3295 }
3297
3298 cout << "written file " << fname << " of size "
3299 << Fio.file_size(fname) << endl;
3300 }
3301
3302 if (f_v) {
3303 cout << "projective_space::create_latex_report done" << endl;
3304 }
3305}
3306
3308{
3309 int f_v = (verbose_level >= 1);
3310
3311
3312 if (f_v) {
3313 cout << "projective_space::create_latex_report_for_Grassmannian" << endl;
3314 }
3315
3316 {
3317 char str[1000];
3318 string fname;
3319 char title[1000];
3320 char author[1000];
3321
3322 snprintf(str, 1000, "Gr_%d_%d_%d.tex", n + 1, k, F->q);
3323 fname.assign(str);
3324 snprintf(title, 1000, "Cheat Sheet ${\\rm Gr}_{%d,%d,%d}$", n + 1, k, F->q);
3325 //strcpy(author, "");
3326 author[0] = 0;
3327
3328
3329 {
3330 ofstream ost(fname);
3332
3333 L.head(ost,
3334 FALSE /* f_book*/,
3335 TRUE /* f_title */,
3336 title, author,
3337 FALSE /* f_toc */,
3338 FALSE /* f_landscape */,
3339 TRUE /* f_12pt */,
3340 TRUE /* f_enlarged_page */,
3341 TRUE /* f_pagenumbers */,
3342 NULL /* extra_praeamble */);
3343
3344
3345 if (f_v) {
3346 cout << "projective_space::create_latex_report_for_Grassmannian "
3347 "before cheat_sheet_subspaces, k=" << k << endl;
3348 }
3349 cheat_sheet_subspaces(ost, k - 1, verbose_level);
3350 if (f_v) {
3351 cout << "projective_space::create_latex_report_for_Grassmannian "
3352 "after cheat_sheet_subspaces, k=" << k << endl;
3353 }
3354
3355
3356 L.foot(ost);
3357
3358 }
3360
3361 cout << "written file " << fname << " of size "
3362 << Fio.file_size(fname) << endl;
3363 }
3364
3365 if (f_v) {
3366 cout << "projective_space::create_latex_report_for_Grassmannian done" << endl;
3367 }
3368}
3369
3372 incidence_structure *&Inc,
3373 data_structures::partitionstack *&Stack, int verbose_level)
3374{
3375 int f_v = (verbose_level >= 1);
3376
3377 if (f_v) {
3378 cout << "projective_space::compute_decomposition" << endl;
3379 }
3380 if (f_v) {
3381 cout << "projective_space::compute_decomposition "
3382 "before incidence_and_stack_for_type_ij" << endl;
3383 }
3385 1 /* row_type */, 2 /* col_type */,
3386 Inc,
3387 Stack,
3388 0 /*verbose_level*/);
3389 if (f_v) {
3390 cout << "projective_space::compute_decomposition "
3391 "after incidence_and_stack_for_type_ij" << endl;
3392 }
3393
3394 int i, j, sz;
3395
3396 for (i = 1; i < S1->ht; i++) {
3397 if (f_v) {
3398 cout << "projective_space::compute_decomposition "
3399 "before Stack->split_cell (S1) i=" << i << endl;
3400 }
3401 Stack->split_cell(
3402 S1->pointList + S1->startCell[i],
3403 S1->cellSize[i], verbose_level);
3404 }
3405 int *set;
3406 set = NEW_int(Inc->nb_rows + Inc->nb_cols);
3407 for (i = 1; i < S2->ht; i++) {
3408 sz = S2->cellSize[i];
3409 Int_vec_copy(S2->pointList + S2->startCell[i], set, sz);
3410 for (j = 0; j < sz; j++) {
3411 set[j] += Inc->nb_rows;
3412 }
3413 if (f_v) {
3414 cout << "projective_space::compute_decomposition "
3415 "before Stack->split_cell (S2) i=" << i << endl;
3416 }
3417 Stack->split_cell(set, sz, 0 /*verbose_level*/);
3418 }
3419 FREE_int(set);
3420 if (f_v) {
3421 cout << "projective_space::compute_decomposition done" << endl;
3422 }
3423
3424}
3425
3429 incidence_structure *&Inc,
3431 int verbose_level)
3432{
3433 int f_v = (verbose_level >= 1);
3434
3435 if (f_v) {
3436 cout << "projective_space::compute_decomposition_based_on_tally" << endl;
3437 }
3438 if (f_v) {
3439 cout << "projective_space::compute_decomposition_based_on_tally "
3440 "before incidence_and_stack_for_type_ij" << endl;
3441 }
3443 1 /* row_type */, 2 /* col_type */,
3444 Inc,
3445 Stack,
3446 0 /*verbose_level*/);
3447 if (f_v) {
3448 cout << "projective_space::compute_decomposition_based_on_tally "
3449 "after incidence_and_stack_for_type_ij" << endl;
3450 }
3451
3452 int i, j, sz;
3453
3454 for (i = T1->nb_types - 1; i >= 1; i--) {
3455 if (f_v) {
3456 cout << "projective_space::compute_decomposition_based_on_tally "
3457 "before Stack->split_cell (S1) i=" << i << endl;
3458 }
3459 Stack->split_cell(
3460 T1->sorting_perm_inv + T1->type_first[i],
3461 T1->type_len[i], verbose_level);
3462 }
3463 int *set;
3464 set = NEW_int(Inc->nb_rows + Inc->nb_cols);
3465 for (i = T2->nb_types - 1; i >= 1; i--) {
3466 sz = T2->type_len[i];
3467 Int_vec_copy(T2->sorting_perm_inv + T2->type_first[i], set, sz);
3468 for (j = 0; j < sz; j++) {
3469 set[j] += Inc->nb_rows;
3470 }
3471 if (f_v) {
3472 cout << "projective_space::compute_decomposition_based_on_tally "
3473 "before Stack->split_cell (S2) i=" << i << endl;
3474 }
3475 Stack->split_cell(set, sz, 0 /*verbose_level*/);
3476 }
3477 FREE_int(set);
3478 if (f_v) {
3479 cout << "projective_space::compute_decomposition_based_on_tally done" << endl;
3480 }
3481
3482}
3483
3485 long int rk_in, long int &rk_out, int verbose_level)
3486{
3487 int f_v = (verbose_level >= 1);
3488 int f_vv = (verbose_level >= 2);
3489 int *A;
3490 int d;
3491 grassmann *Gr_k;
3492 grassmann *Gr_dmk;
3493
3494 if (f_v) {
3495 cout << "projective_space::polarity_rank_k_subspace, k=" << k << endl;
3496 }
3497 d = n + 1;
3498 Gr_k = Grass_stack[k];
3499 Gr_dmk = Grass_stack[d - k];
3500
3501 A = NEW_int(d * d);
3502
3503 Gr_k->unrank_lint_here(A, rk_in, 0 /*verbose_level - 4*/);
3504 if (f_vv) {
3505 cout << "projective_space::polarity_rank_k_subspace subspace " << rk_in << ":" << endl;
3507 A, k, d, d,
3508 F->log10_of_q + 1);
3509 }
3510 F->Linear_algebra->perp_standard(d, k, A, 0);
3511 if (FALSE) {
3512 cout << "projective_space::polarity_rank_k_subspace after F->perp_standard:" << endl;
3514 A, d, d, d,
3515 F->log10_of_q + 1);
3516 }
3517 rk_out = Gr_dmk->rank_lint_here(A + k *d, 0 /*verbose_level - 4*/);
3518 if (f_vv) {
3519 cout << "projective_space::polarity_rank_k_subspace perp is " << endl;
3520 Int_vec_print_integer_matrix_width(cout, A + k * d, d - k, d, d, F->log10_of_q + 1);
3521 cout << "which has rank " << rk_out << endl;
3522 }
3523
3524 FREE_int(A);
3525 if (f_v) {
3526 cout << "projective_space::polarity_rank_k_subspace done" << endl;
3527 }
3528}
3529
3530
3531}}}
3532
3533
3534
3535
information about the Eckardt points of a surface derived from a six-arc
void q_binomial_no_table(ring_theory::longinteger_object &a, int n, int k, int q, int verbose_level)
void q_binomial(ring_theory::longinteger_object &a, int n, int k, int q, int verbose_level)
data structure for set partitions following Jeffrey Leon
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(long int *v, int len, long int a, int &idx, int verbose_level)
Definition: sorting.cpp:1157
int test_if_sets_are_disjoint_assuming_sorted(int *set1, int *set2, int sz1, int sz2)
Definition: sorting.cpp:2790
a statistical analysis of data consisting of single integers
void PG_element_rank_modified(int *v, int stride, int len, int &a)
void PG_element_unrank_modified(int *v, int stride, int len, int a)
void PG_element_unrank_modified_lint(int *v, int stride, int len, long int a)
void PG_element_rank_modified_lint(int *v, int stride, int len, long int &a)
arcs, ovals, hyperovals etc. in projective planes
Definition: geometry.h:182
int arc_test(long int *input_pts, int nb_pts, int verbose_level)
various functions related to geometries
Definition: geometry.h:721
algebraic_geometry::eckardt_point_info * compute_eckardt_point_info(projective_space *P2, long int *arc6, int verbose_level)
to rank and unrank subspaces of a fixed dimension in F_q^n
Definition: geometry.h:892
void unrank_lint(long int rk, int verbose_level)
Definition: grassmann.cpp:343
long int rank_lint_here(int *Mtx, int verbose_level)
Definition: grassmann.cpp:275
void unrank_lint_here(int *Mtx, long int rk, int verbose_level)
Definition: grassmann.cpp:269
void init(int n, int k, field_theory::finite_field *F, int verbose_level)
Definition: grassmann.cpp:70
interface for various incidence geometries
Definition: geometry.h:1099
void init_by_matrix(int m, int n, int *M, int verbose_level)
a polarity between points and hyperplanes in PG(n,q)
Definition: geometry.h:1857
void init_standard_polarity(projective_space *P, int verbose_level)
Definition: polarity.cpp:39
void init_reversal_polarity(projective_space *P, int verbose_level)
Definition: polarity.cpp:172
internal representation of a projective space PG(n,q)
Definition: geometry.h:1885
void cheat_sheet_line_intersection(std::ostream &f, int verbose_level)
void conic_points(long int *five_pts, int *six_coeffs, long int *points, int &nb_points, int verbose_level)
void point_types_of_line_set(long int *set_of_lines, int set_size, int *type, int verbose_level)
void compute_decomposition_based_on_tally(data_structures::tally *T1, data_structures::tally *T2, incidence_structure *&Inc, data_structures::partitionstack *&Stack, int verbose_level)
void hyperplane_intersection_type_basic(long int *set, int set_size, int *type, int verbose_level)
void find_k_secant_lines(long int *set, int set_size, int k, long int *secant_lines, int &nb_secant_lines, int verbose_level)
void compute_decomposition(data_structures::partitionstack *S1, data_structures::partitionstack *S2, incidence_structure *&Inc, data_structures::partitionstack *&Stack, int verbose_level)
int determine_conic_in_plane(long int *input_pts, int nb_pts, int *six_coeffs, int verbose_level)
void polarity_rank_k_subspace(int k, long int rk_in, long int &rk_out, int verbose_level)
int test_if_lines_are_disjoint_from_scratch(long int l1, long int l2)
void find_external_lines(long int *set, int set_size, long int *external_lines, int &nb_external_lines, int verbose_level)
void create_points_on_line(long int line_rk, long int *line, int verbose_level)
void point_types_of_line_set_int(int *set_of_lines, int set_size, int *type, int verbose_level)
projective_space_implementation * Implementation
Definition: geometry.h:1940
void intersect_with_line(long int *set, int set_sz, int line_rk, long int *intersection, int &sz, int verbose_level)
void plane_intersection_type_basic(long int *set, int set_size, int *type, int verbose_level)
void point_plane_incidence_matrix(long int *point_rks, int nb_points, long int *plane_rks, int nb_planes, int *&M, int verbose_level)
void incma_for_type_ij(int row_type, int col_type, int *&Incma, int &nb_rows, int &nb_cols, int verbose_level)
void quadric_points_brute_force(int *ten_coeffs, long int *points, int &nb_points, int verbose_level)
void report(std::ostream &ost, graphics::layered_graph_draw_options *O, int verbose_level)
void cheat_sheet_points_on_lines(std::ostream &f, int verbose_level)
void line_intersection_type_basic(long int *set, int set_size, int *type, int verbose_level)
void create_latex_report_for_Grassmannian(int k, int verbose_level)
int determine_line_in_plane(long int *two_input_pts, int *three_coeffs, int verbose_level)
int nonconical_six_arc_get_nb_Eckardt_points(long int *Arc6, int verbose_level)
void find_secant_lines(long int *set, int set_size, long int *lines, int &nb_lines, int max_lines, int verbose_level)
void cheat_sheet_lines_on_points(std::ostream &f, int verbose_level)
void line_intersection_type_through_hyperplane(long int *set, int set_size, int *type, int verbose_level)
void find_tangent_lines(long int *set, int set_size, long int *tangent_lines, int &nb_tangent_lines, int verbose_level)
void find_tangent_lines_to_conic(int *six_coeffs, long int *points, int nb_points, long int *tangents, int verbose_level)
void print_set_of_points(std::ostream &ost, long int *Pts, int nb_pts)
int determine_cubic_in_plane(ring_theory::homogeneous_polynomial_domain *Poly_3_3, int nb_pts, long int *Pts, int *coeff10, int verbose_level)
void create_lines_on_point(long int point_rk, long int *line_pencil, int verbose_level)
int conic_test(long int *S, int len, int pt, int verbose_level)
void cheat_sheet_subspaces(std::ostream &f, int k, int verbose_level)
void cheat_sheet_points(std::ostream &f, int verbose_level)
void Baer_subline(long int *pts3, long int *&pts, int &nb_pts, int verbose_level)
void cheat_sheet_line_through_pairs_of_points(std::ostream &f, int verbose_level)
void create_lines_on_point_but_inside_a_plane(long int point_rk, long int plane_rk, long int *line_pencil, int verbose_level)
void determine_quadric_in_solid(long int *nine_pts_or_more, int nb_pts, int *ten_coeffs, int verbose_level)
void find_lines_which_are_contained(std::vector< long int > &Points, std::vector< long int > &Lines, int verbose_level)
void conic_points_brute_force(int *six_coeffs, long int *points, int &nb_points, int verbose_level)
void line_intersection_type(long int *set, int set_size, int *type, int verbose_level)
void line_intersection_type_basic_given_a_set_of_lines(long int *lines_by_rank, int nb_lines, 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 create_latex_report(graphics::layered_graph_draw_options *O, int verbose_level)
void make_incidence_structure_and_partition(incidence_structure *&Inc, data_structures::partitionstack *&Stack, 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)
int create_point_on_line(long int line_rk, int pt_rk, int verbose_level)
void make_incidence_matrix(int &m, int &n, int *&Inc, int verbose_level)
void incidence_and_stack_for_type_ij(int row_type, int col_type, incidence_structure *&Inc, data_structures::partitionstack *&Stack, int verbose_level)
options for drawing an object of type layered_graph
Definition: graphics.h:457
utility functions for plotting (graphing)
Definition: graphics.h:972
void draw_point_set_in_plane(std::string &fname, layered_graph_draw_options *O, geometry::projective_space *P, long int *Pts, int nb_pts, int f_point_labels, int verbose_level)
Definition: plot_tools.cpp:848
void mult_vector_from_the_left(int *v, int *A, int *vA, int m, int n)
void reduce_mod_subspace_and_get_coefficient_vector(int k, int len, int *basis, int *base_cols, int *v, int *coefficients, int verbose_level)
int rank_of_rectangular_matrix_memory_given(int *A, int m, int n, int *B, int *base_cols, int verbose_level)
void mult_matrix_matrix(int *A, int *B, int *C, int m, int n, int o, int verbose_level)
int perp(int n, int k, int *A, int *Gram, int verbose_level)
int evaluate_bilinear_form(int n, int *v1, int *v2, int *Gram)
int rank_of_rectangular_matrix(int *A, int m, int n, int verbose_level)
int perp_standard(int n, int k, int *A, int verbose_level)
int Gauss_simple(int *A, int m, int n, int *base_cols, int verbose_level)
void matrix_get_kernel(int *M, int m, int n, int *base_cols, int nb_base_cols, int &kernel_m, int &kernel_n, int *kernel, int verbose_level)
void int_matrix_write_csv(std::string &fname, int *M, int m, int n)
Definition: file_io.cpp:1300
void head(std::ostream &ost, int f_book, int f_title, const char *title, const char *author, int f_toc, int f_landscape, int f_12pt, int f_enlarged_page, int f_pagenumbers, const char *extras_for_preamble)
homogeneous polynomials of a given degree in a given number of variables over a finite field GF(q)
Definition: ring_theory.h:88
void init(field_theory::finite_field *F, int nb_vars, int degree, int f_init_incidence_structure, monomial_ordering_type Monomial_ordering_type, int verbose_level)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define ONE_MILLION
Definition: foundations.h:226
#define NEW_pvoid(n)
Definition: foundations.h:637
#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 FREE_pvoid(p)
Definition: foundations.h:650
#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 ODD(x)
Definition: foundations.h:222
#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
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects