Orbiter 2022
Combinatorial Objects
geometry_global.cpp
Go to the documentation of this file.
1/*
2 * geometry_global.cpp
3 *
4 * Created on: Apr 19, 2019
5 * Author: betten
6 */
7
8
9
10#include "foundations.h"
11
12using namespace std;
13
14
15namespace orbiter {
16namespace layer1_foundations {
17namespace geometry {
18
19
20
22{
23
24}
25
27{
28
29}
30
31
32long int geometry_global::nb_PG_elements(int n, int q)
33// $\frac{q^{n+1} - 1}{q-1} = \sum_{i=0}^{n} q^i $
34{
35 long int qhl, l, deg;
36
37 l = 0;
38 qhl = 1;
39 deg = 0;
40 while (l <= n) {
41 deg += qhl;
42 qhl *= q;
43 l++;
44 }
45 return deg;
46}
47
49// |PG_n(q)| - |PG_m(q)|
50{
51 long int a, b;
52
53 a = nb_PG_elements(n, q);
54 b = nb_PG_elements(m, q);
55 return a - b;
56}
57
58long int geometry_global::nb_AG_elements(int n, int q)
59// $q^n$
60{
62
63 return NT.i_power_j_lint(q, n);
64}
65
67{
69 long int qnp1, qn, q2, a, b, denom, res;
70
71 qnp1 = NT.i_power_j_lint(q, n + 1);
72 qn = NT.i_power_j_lint(q, n);
73 q2 = q * q;
74 denom = (q2 - 1) * (q2 - q);
75 a = (qnp1 - 1) * (qnp1 - q) / denom;
76 b = (qn - 1) * (qn - q) / denom;
77 res = a - b;
78 return res;
79}
80
81
82long int geometry_global::AG_element_rank(int q, int *v, int stride, int len)
83{
84 int i;
85 long int a;
86
87 if (len <= 0) {
88 cout << "geometry_global::AG_element_rank len <= 0" << endl;
89 exit(1);
90 }
91 a = 0;
92 for (i = len - 1; i >= 0; i--) {
93 a += v[i * stride];
94 if (i > 0) {
95 a *= q;
96 }
97 }
98 return a;
99}
100
101void geometry_global::AG_element_unrank(int q, int *v, int stride, int len, long int a)
102{
103 int i;
104 long int b;
105
106#if 1
107 if (len <= 0) {
108 cout << "geometry_global::AG_element_unrank len <= 0" << endl;
109 exit(1);
110 }
111#endif
112 for (i = 0; i < len; i++) {
113 b = a % q;
114 v[i * stride] = b;
115 a /= q;
116 }
117}
118
119
120int geometry_global::AG_element_next(int q, int *v, int stride, int len)
121{
122 int i;
123
124#if 1
125 if (len <= 0) {
126 cout << "geometry_global::AG_element_next len <= 0" << endl;
127 exit(1);
128 }
129#endif
130 for (i = len - 1; i >= 0; i--) {
131 if (v[i * stride] < q - 1) {
132 v[i * stride]++;
133 return TRUE;
134 }
135 else {
136 v[i * stride] = 0;
137 }
138 }
139 return FALSE;
140}
141
142
143
145 int *v, int stride, int len, ring_theory::longinteger_object &a)
146{
149 int i;
150
151 if (len <= 0) {
152 cout << "geometry_global::AG_element_rank_longinteger len <= 0" << endl;
153 exit(1);
154 }
155 a.create(0, __FILE__, __LINE__);
156 Q.create(q, __FILE__, __LINE__);
157 for (i = len - 1; i >= 0; i--) {
158 a.add_int(v[i * stride]);
159 //cout << "AG_element_rank_longinteger
160 //after add_int " << a << endl;
161 if (i > 0) {
162 D.mult(a, Q, a1);
163 a.swap_with(a1);
164 //cout << "AG_element_rank_longinteger
165 //after mult " << a << endl;
166 }
167 }
168}
169
171 int *v, int stride, int len, ring_theory::longinteger_object &a)
172{
173 int i, r;
176
177 a.assign_to(a0);
178 if (len <= 0) {
179 cout << "geometry_global::AG_element_unrank_longinteger len <= 0" << endl;
180 exit(1);
181 }
182 for (i = 0; i < len; i++) {
183 D.integral_division_by_int(a0, q, a1, r);
184 //r = a % q;
185 v[i * stride] = r;
186 //a /= q;
187 a0.swap_with(a1);
188 }
189}
190
191
193{
194 int j;
195
196 for (j = m + 1; j < n + 1; j++) {
197 if (v[j]) {
198 return FALSE;
199 }
200 }
201 return TRUE;
202}
203
204
205void geometry_global::test_PG(int n, int q)
206{
208 int m;
209 int verbose_level = 1;
210
211 F.finite_field_init(q, FALSE /* f_without_tables */, verbose_level);
212
213 cout << "all elements of PG_" << n << "(" << q << ")" << endl;
215
216 for (m = 0; m < n; m++) {
217 cout << "all elements of PG_" << n << "(" << q << "), "
218 "not in a subspace of dimension " << m << endl;
220 }
221
222}
223
224void geometry_global::create_Fisher_BLT_set(long int *Fisher_BLT, int *ABC,
226 field_theory::finite_field *Fq, int verbose_level)
227{
228 int f_v = (verbose_level >= 1);
229
230 if (f_v) {
231 cout << "geometry_global::create_Fisher_BLT_set" << endl;
232 }
234
235 U.setup(FQ, Fq, verbose_level);
236 U.create_Fisher_BLT_set(Fisher_BLT, ABC, verbose_level);
237 if (f_v) {
238 cout << "geometry_global::create_Fisher_BLT_set done" << endl;
239 }
240
241}
242
243void geometry_global::create_Linear_BLT_set(long int *BLT, int *ABC,
245 field_theory::finite_field *Fq, int verbose_level)
246{
247 int f_v = (verbose_level >= 1);
248
249 if (f_v) {
250 cout << "geometry_global::create_Linear_BLT_set" << endl;
251 }
253
254 U.setup(FQ, Fq, verbose_level);
255 U.create_Linear_BLT_set(BLT, ABC, verbose_level);
256 if (f_v) {
257 cout << "geometry_global::create_Linear_BLT_set done" << endl;
258 }
259
260}
261
262void geometry_global::create_Mondello_BLT_set(long int *BLT, int *ABC,
264 field_theory::finite_field *Fq, int verbose_level)
265{
266 int f_v = (verbose_level >= 1);
267
268 if (f_v) {
269 cout << "geometry_global::create_Mondello_BLT_set" << endl;
270 }
272
273 U.setup(FQ, Fq, verbose_level);
274 U.create_Mondello_BLT_set(BLT, ABC, verbose_level);
275 if (f_v) {
276 cout << "geometry_global::create_Mondello_BLT_set done" << endl;
277 }
278
279}
280
282 int *form_i, int *form_j, int *form_coeff)
283{
284 int k;
285
286 for (k = 0; k < form_nb_terms; k++) {
287 cout << "i=" << form_i[k] << " j=" << form_j[k]
288 << " coeff=" << form_coeff[k] << endl;
289 }
290}
291
294 int nb_terms, int *form_i, int *form_j, int *form_coeff, int *Gram)
295{
296 int k, i, j, c;
297
298 Int_vec_zero(Gram, n * n);
299 for (k = 0; k < nb_terms; k++) {
300 i = form_i[k];
301 j = form_j[k];
302 c = form_coeff[k];
303 if (c == 0) {
304 continue;
305 }
306 Gram[i * n + j] = F.add(Gram[i * n + j], c);
307 Gram[j * n + i] = F.add(Gram[j * n + i], c);
308 }
309}
310
313 int &nb_terms, int *form_i, int *form_j, int *form_coeff,
314 int *Gram,
315 int i, int j, int coeff)
316{
317 form_i[nb_terms] = i;
318 form_j[nb_terms] = j;
319 form_coeff[nb_terms] = coeff;
320 if (i == j) {
321 Gram[i * n + j] = F.mult(2, coeff);
322 }
323 else {
324 Gram[i * n + j] = coeff;
325 Gram[j * n + i] = coeff;
326 }
327 nb_terms++;
328}
329
330
331#if 0
332void geometry_global::determine_conic(int q, std::string &override_poly,
333 long int *input_pts, int nb_pts, int verbose_level)
334{
335 int f_v = (verbose_level >= 1);
336 int f_vv = (verbose_level >= 2);
339 int v[3];
340 int len = 3;
341 int six_coeffs[6];
342 int i;
343
344 if (f_v) {
345 cout << "determine_conic q=" << q << endl;
346 cout << "input_pts: ";
347 Lint_vec_print(cout, input_pts, nb_pts);
348 cout << endl;
349 }
350 F.init_override_polynomial(q, override_poly, FALSE /* f_without_tables */, verbose_level);
351
352 P = NEW_OBJECT(projective_space);
353 if (f_vv) {
354 cout << "determine_conic before P->init" << endl;
355 }
356 P->init(len - 1, &F,
357 FALSE,
358 verbose_level - 2/*MINIMUM(2, verbose_level)*/);
359
360 if (f_vv) {
361 cout << "determine_conic after P->init" << endl;
362 }
363 P->determine_conic_in_plane(input_pts, nb_pts,
364 six_coeffs, verbose_level - 2);
365
366 if (f_v) {
367 cout << "determine_conic the six coefficients are ";
368 Int_vec_print(cout, six_coeffs, 6);
369 cout << endl;
370 }
371
372 long int points[1000];
373 int nb_points;
374 //int v[3];
375
376 P->conic_points(input_pts, six_coeffs,
377 points, nb_points, verbose_level - 2);
378 if (f_v) {
379 cout << "the " << nb_points << " conic points are: ";
380 Lint_vec_print(cout, points, nb_points);
381 cout << endl;
382 for (i = 0; i < nb_points; i++) {
383 P->unrank_point(v, points[i]);
384 cout << i << " : " << points[i] << " : ";
385 Int_vec_print(cout, v, 3);
386 cout << endl;
387 }
388 }
389 FREE_OBJECT(P);
390}
391#endif
392
394 int *pt_coords,
395 int *set, int set_sz, int k, int verbose_level)
396// Used by Hill_cap56()
397{
398 int f_v = FALSE; //(verbose_level >= 1);
399 int f_vv = FALSE; //(verbose_level >= 2);
400 int subset[3];
401 int subset1[3];
402 int *Mtx;
403 int ret = FALSE;
404 int i, j, a, rk;
407
408
409 if (f_v) {
410 cout << "test_if_arc testing set" << endl;
411 Int_vec_print(cout, set, set_sz);
412 cout << endl;
413 }
414 Mtx = NEW_int(3 * k);
415
416 Combi.first_k_subset(subset, set_sz, 3);
417 while (TRUE) {
418 for (i = 0; i < 3; i++) {
419 subset1[i] = set[subset[i]];
420 }
421 Sorting.int_vec_heapsort(subset1, 3);
422 if (f_vv) {
423 cout << "testing subset ";
424 Int_vec_print(cout, subset1, 3);
425 cout << endl;
426 }
427
428 for (i = 0; i < 3; i++) {
429 a = subset1[i];
430 for (j = 0; j < k; j++) {
431 Mtx[i * k + j] = pt_coords[a * k + j];
432 }
433 }
434 if (f_vv) {
435 cout << "matrix:" << endl;
436 Int_vec_print_integer_matrix_width(cout, Mtx, 3, k, k, 1);
437 }
438 rk = Fq->Linear_algebra->Gauss_easy(Mtx, 3, k);
439 if (rk < 3) {
440 if (f_v) {
441 cout << "not an arc" << endl;
442 }
443 goto done;
444 }
445 if (!Combi.next_k_subset(subset, set_sz, 3)) {
446 break;
447 }
448 }
449 if (f_v) {
450 cout << "passes the arc test" << endl;
451 }
452 ret = TRUE;
453done:
454
455 FREE_int(Mtx);
456 return ret;
457}
458
462 int f_classical, int f_Uab, int parameter_a, int parameter_b,
463 std::string &fname, int &nb_pts, long int *&Pts,
464 int verbose_level)
465{
466 int f_v = (verbose_level >= 1);
467 int i, rk, d = 3;
468 int v[3];
469 buekenhout_metz *BM;
470
471 if (f_v) {
472 cout << "create_Buekenhout_Metz" << endl;
473 }
474
475
477
478 BM->init(Fq, FQ,
479 f_Uab, parameter_a, parameter_b, f_classical, verbose_level);
480
481
482 if (BM->f_Uab) {
484 BM->parameter_a, BM->parameter_b,
485 verbose_level);
486 }
487 else {
488 BM->init_ovoid(verbose_level);
489 }
490
491 BM->create_unital(verbose_level);
492
493 //BM->write_unital_to_file();
494
495 nb_pts = BM->sz;
496 Pts = NEW_lint(nb_pts);
497 for (i = 0; i < nb_pts; i++) {
498 Pts[i] = BM->U[i];
499 }
500
501
502 if (f_v) {
503 cout << "i : point : projective rank" << endl;
504 }
505 for (i = 0; i < nb_pts; i++) {
506 rk = Pts[i];
507 BM->P2->unrank_point(v, rk);
508 if (f_v) {
509 cout << setw(4) << i << " : ";
510 Int_vec_print(cout, v, d);
511 cout << " : " << setw(5) << rk << endl;
512 }
513 }
514
515
516
517 string name;
518
519 fname.assign("unital_");
520 BM->get_name(name);
521 fname.append(name);
522
523 FREE_OBJECT(BM);
524
525}
526
527
528long int geometry_global::count_Sbar(int n, int q)
529{
530 return count_T1(1, n, q);
531}
532
533long int geometry_global::count_S(int n, int q)
534{
535 return (q - 1) * count_Sbar(n, q) + 1;
536}
537
538long int geometry_global::count_N1(int n, int q)
539{
540 if (n <= 0) {
541 return 0;
542 }
543 return nb_pts_N1(n, q);
544}
545
546long int geometry_global::count_T1(int epsilon, int n, int q)
547// n = Witt index
548{
550
551 if (n < 0) {
552 //cout << "count_T1 n is negative. n=" << n << endl;
553 return 0;
554 }
555 if (epsilon == 1) {
556 return ((NT.i_power_j_lint(q, n) - 1) *
557 (NT.i_power_j_lint(q, n - 1) + 1)) / (q - 1);
558 }
559 else if (epsilon == 0) {
560 return count_T1(1, n, q) + count_N1(n, q);
561 }
562 else {
563 cout << "count_T1 epsilon = " << epsilon
564 << " not yet implemented, returning 0" << endl;
565 return 0;
566 }
567 //exit(1);
568}
569
570long int geometry_global::count_T2(int n, int q)
571{
573
574 if (n <= 0) {
575 return 0;
576 }
577 return (NT.i_power_j_lint(q, 2 * n - 2) - 1) *
578 (NT.i_power_j_lint(q, n) - 1) *
579 (NT.i_power_j_lint(q, n - 2) + 1) / ((q - 1) * (NT.i_power_j_lint(q, 2) - 1));
580}
581
582long int geometry_global::nb_pts_Qepsilon(int epsilon, int k, int q)
583// number of singular points on Q^epsilon(k,q)
584{
585 if (epsilon == 0) {
586 return nb_pts_Q(k, q);
587 }
588 else if (epsilon == 1) {
589 return nb_pts_Qplus(k, q);
590 }
591 else if (epsilon == -1) {
592 return nb_pts_Qminus(k, q);
593 }
594 else {
595 cout << "nb_pts_Qepsilon epsilon must be one of 0,1,-1" << endl;
596 exit(1);
597 }
598}
599
601{
602 if (epsilon == 0) {
603 return 2 * n + 1;
604 }
605 else if (epsilon == 1) {
606 return 2 * n;
607 }
608 else if (epsilon == -1) {
609 return 2 * n + 2;
610 }
611 else {
612 cout << "dimension_given_Witt_index "
613 "epsilon must be 0,1,-1" << endl;
614 exit(1);
615 }
616}
617
618int geometry_global::Witt_index(int epsilon, int k)
619// k = projective dimension
620{
621 int n;
622
623 if (epsilon == 0) {
624 if (!EVEN(k)) {
625 cout << "Witt_index dimension k must be even" << endl;
626 cout << "k = " << k << endl;
627 cout << "epsilon = " << epsilon << endl;
628 exit(1);
629 }
630 n = k >> 1; // Witt index
631 }
632 else if (epsilon == 1) {
633 if (!ODD(k)) {
634 cout << "Witt_index dimension k must be odd" << endl;
635 cout << "k = " << k << endl;
636 cout << "epsilon = " << epsilon << endl;
637 exit(1);
638 }
639 n = (k >> 1) + 1; // Witt index
640 }
641 else if (epsilon == -1) {
642 if (!ODD(k)) {
643 cout << "Witt_index dimension k must be odd" << endl;
644 cout << "k = " << k << endl;
645 cout << "epsilon = " << epsilon << endl;
646 exit(1);
647 }
648 n = k >> 1; // Witt index
649 }
650 else {
651 cout << "Witt_index epsilon must be one of 0,1,-1" << endl;
652 exit(1);
653 }
654 return n;
655}
656
657long int geometry_global::nb_pts_Q(int k, int q)
658// number of singular points on Q(k,q), parabolic quadric, so k is even
659{
660 int n;
661
662 n = Witt_index(0, k);
663 return nb_pts_Sbar(n, q) + nb_pts_N1(n, q);
664}
665
666long int geometry_global::nb_pts_Qplus(int k, int q)
667// number of singular points on Q^+(k,q)
668{
669 int n;
670
671 n = Witt_index(1, k);
672 return nb_pts_Sbar(n, q);
673}
674
675long int geometry_global::nb_pts_Qminus(int k, int q)
676// number of singular points on Q^-(k,q)
677{
678 int n;
679
680 n = Witt_index(-1, k);
681 return nb_pts_Sbar(n, q) + (q + 1) * nb_pts_N1(n, q);
682}
683
684
685// #############################################################################
686// the following functions are for the hyperbolic quadric with Witt index n:
687// #############################################################################
688
689long int geometry_global::nb_pts_S(int n, int q)
690// Number of singular vectors (including the zero vector)
691{
692 long int a;
693
694 if (n <= 0) {
695 cout << "nb_pts_S n <= 0" << endl;
696 exit(1);
697 }
698 if (n == 1) {
699 // q-1 vectors of the form (x,0) for x \neq 0,
700 // q-1 vectors of the form (0,x) for x \neq 0
701 // 1 vector of the form (0,0)
702 // for a total of 2 * q - 1 vectors
703 return 2 * q - 1;
704 }
705 a = nb_pts_S(1, q) * nb_pts_S(n - 1, q);
706 a += nb_pts_N(1, q) * nb_pts_N1(n - 1, q);
707 return a;
708}
709
710long int geometry_global::nb_pts_N(int n, int q)
711// Number of non-singular vectors.
712// Of course, |N(n,q)| + |S(n,q)| = q^{2n}
713// |N(n,q)| = (q - 1) * |N1(n,q)|
714{
715 long int a;
716
717 if (n <= 0) {
718 cout << "nb_pts_N n <= 0" << endl;
719 exit(1);
720 }
721 if (n == 1) {
722 return (long int) (q - 1) * (long int) (q - 1);
723 }
724 a = nb_pts_S(1, q) * nb_pts_N(n - 1, q);
725 a += nb_pts_N(1, q) * nb_pts_S(n - 1, q);
726 a += nb_pts_N(1, q) * (q - 2) * nb_pts_N1(n - 1, q);
727 return a;
728}
729
730long int geometry_global::nb_pts_N1(int n, int q)
731// Number of non-singular vectors
732// for one fixed value of the quadratic form
733// i.e. number of solutions of
734// \sum_{i=0}^{n-1} x_{2i}x_{2i+1} = s
735// for some fixed s \neq 0.
736{
737 long int a;
738
739 //cout << "nb_pts_N1 n=" << n << " q=" << q << endl;
740 if (n <= 0) {
741 cout << "nb_pts_N1 n <= 0" << endl;
742 exit(1);
743 }
744 if (n == 1) {
745 //cout << "gives " << q - 1 << endl;
746 return q - 1;
747 }
748 a = nb_pts_S(1, q) * nb_pts_N1(n - 1, q);
749 a += nb_pts_N1(1, q) * nb_pts_S(n - 1, q);
750 a += nb_pts_N1(1, q) * (q - 2) * nb_pts_N1(n - 1, q);
751 //cout << "gives " << a << endl;
752 return a;
753}
754
755long int geometry_global::nb_pts_Sbar(int n, int q)
756// number of singular projective points
757// |S(n,q)| = (q-1) * |Sbar(n,q)| + 1
758{
759 long int a;
760
761 if (n <= 0) {
762 cout << "nb_pts_Sbar n <= 0" << endl;
763 exit(1);
764 }
765 if (n == 1) {
766 return 2;
767 // namely (0,1) and (1,0)
768 }
769 a = nb_pts_Sbar(n - 1, q);
770 a += nb_pts_Sbar(1, q) * nb_pts_S(n - 1, q);
771 a += nb_pts_Nbar(1, q) * nb_pts_N1(n - 1, q);
772 if (a < 0) {
773 cout << "geometry_global::nb_pts_Sbar a < 0, overflow" << endl;
774 exit(1);
775 }
776 return a;
777}
778
779long int geometry_global::nb_pts_Nbar(int n, int q)
780// |Nbar(1,q)| = q - 1
781{
782 //int a;
783
784 if (n <= 0) {
785 cout << "nb_pts_Nbar n <= 0" << endl;
786 exit(1);
787 }
788 if (n == 1) {
789 return (q - 1);
790 }
791 cout << "nb_pts_Nbar should only be called for n = 1" << endl;
792 exit(1);
793#if 0
794 a = nb_pts_Nbar(n - 1, q);
795 a += nb_pts_Sbar(1, q) * nb_pts_N(n - 1, q);
796 a += nb_pts_Nbar(1, q) * nb_pts_S(n - 1, q);
797 a += nb_pts_Nbar(1, q) * (q - 2) * nb_pts_N1(n - 1, q);
798 return a;
799#endif
800}
801
802
803
804void geometry_global::test_Orthogonal(int epsilon, int k, int q)
805// only works for epsilon = 0
806{
808 int *v;
809 int stride = 1, /*n,*/ len; //, h, wt;
810 long int i, j, a, nb;
811 int c1 = 0, c2 = 0, c3 = 0;
812 int verbose_level = 0;
813
814 cout << "test_Orthogonal" << endl;
815 GFq.finite_field_init(q, FALSE /* f_without_tables */, verbose_level);
816 v = NEW_int(k + 1);
817 //n = Witt_index(epsilon, k);
818 len = k + 1;
819 nb = nb_pts_Qepsilon(epsilon, k, q);
820 cout << "Q^" << epsilon << "(" << k << "," << q << ") has "
821 << nb << " singular points" << endl;
822 if (epsilon == 0) {
823 c1 = 1;
824 }
825 else if (epsilon == 1) {
826 }
827 else if (epsilon == -1) {
828 GFq.Linear_algebra->choose_anisotropic_form(c1, c2, c3, TRUE);
829 }
830 for (i = 0; i < nb; i++) {
831 GFq.Orthogonal_indexing->Q_epsilon_unrank(v, stride, epsilon, k, c1, c2, c3, i, 0 /* verbose_level */);
832
833#if 0
834 wt = 0;
835 for (h = 0; h < len; h++) {
836 if (v[h])
837 wt++;
838 }
839#endif
840 cout << i << " : ";
841 Int_vec_print(cout, v, len);
842 cout << " : ";
843 a = GFq.Linear_algebra->evaluate_quadratic_form(v, stride, epsilon, k,
844 c1, c2, c3);
845 cout << a;
846 j = GFq.Orthogonal_indexing->Q_epsilon_rank(v, stride, epsilon, k, c1, c2, c3, 0 /* verbose_level */);
847 cout << " : " << j;
848#if 0
849 if (wt == 1) {
850 cout << " -- unit vector";
851 }
852 cout << " weight " << wt << " vector";
853#endif
854 cout << endl;
855 if (j != i) {
856 cout << "error" << endl;
857 exit(1);
858 }
859 }
860
861
862 FREE_int(v);
863 cout << "test_Orthogonal done" << endl;
864}
865
867{
868 int *v;
870 long int i, j, a;
871 int stride = 1;
872 long int nb;
873 int verbose_level = 0;
874
875 cout << "test_orthogonal" << endl;
876 GFq.finite_field_init(q, FALSE /* f_without_tables */, verbose_level);
877 v = NEW_int(2 * n);
878 nb = nb_pts_Sbar(n, q);
879 cout << "\\Omega^+(" << 2 * n << "," << q << ") has " << nb
880 << " singular points" << endl;
881 for (i = 0; i < nb; i++) {
882 GFq.Orthogonal_indexing->Sbar_unrank(v, stride, n, i, 0 /* verbose_level */);
883 cout << i << " : ";
885 cout << " : ";
886 a = GFq.Linear_algebra->evaluate_hyperbolic_quadratic_form(v, stride, n);
887 cout << a;
888 GFq.Orthogonal_indexing->Sbar_rank(v, stride, n, j, 0 /* verbose_level */);
889 cout << " : " << j << endl;
890 if (j != i) {
891 cout << "error" << endl;
892 exit(1);
893 }
894 }
895 cout << "\\Omega^+(" << 2 * n << "," << q << ") has " << nb
896 << " singular points" << endl;
897 FREE_int(v);
898 cout << "test_orthogonal done" << endl;
899}
900
901
902
903#if 0
904void geometry_global::create_BLT(int f_embedded,
905 finite_field *FQ, finite_field *Fq,
906 int f_Linear,
907 int f_Fisher,
908 int f_Mondello,
909 int f_FTWKB,
910 char *fname, int &nb_pts, int *&Pts,
911 int verbose_level)
912{
913 int f_v = (verbose_level >= 1);
914 //int i, j;
915 int epsilon = 0;
916 int n = 4;
917 //int c1 = 0, c2 = 0, c3 = 0;
918 //int d = 5;
919 //int *Pts1;
920 orthogonal *O;
921 int q = Fq->q;
922 //int *v;
923 //char BLT_label[1000];
924
925 if (f_v) {
926 cout << "create_BLT" << endl;
927 }
928 O = NEW_OBJECT(orthogonal);
929 if (f_v) {
930 cout << "create_BLT before O->init" << endl;
931 }
932 O->finite_field_init(epsilon, n + 1, Fq, verbose_level - 1);
933 nb_pts = q + 1;
934
935 //BLT = BLT_representative(q, BLT_k);
936
937 //v = NEW_int(d);
938 //Pts1 = NEW_int(nb_pts);
939 Pts = NEW_int(nb_pts);
940
941 cout << "create_BLT currently disabled" << endl;
942 exit(1);
943#if 0
944#if 0
945 if (f_Linear) {
946 strcpy(BLT_label, "Linear");
947 create_Linear_BLT_set(Pts1, FQ, Fq, verbose_level - 1);
948 }
949 else if (f_Fisher) {
950 strcpy(BLT_label, "Fi");
951 create_Fisher_BLT_set(Pts1, FQ, Fq, verbose_level - 1);
952 }
953 else if (f_Mondello) {
954 strcpy(BLT_label, "Mondello");
955 create_Mondello_BLT_set(Pts1, FQ, Fq, verbose_level - 1);
956 }
957 else if (f_FTWKB) {
958 strcpy(BLT_label, "FTWKB");
959 create_FTWKB_BLT_set(O, Pts1, verbose_level - 1);
960 }
961 else {
962 cout << "create_BLT no type" << endl;
963 exit(1);
964 }
965#endif
966 if (f_v) {
967 cout << "i : orthogonal rank : point : projective rank" << endl;
968 }
969 for (i = 0; i < nb_pts; i++) {
970 Q_epsilon_unrank(*Fq, v, 1, epsilon, n, c1, c2, c3, Pts1[i]);
971 if (f_embedded) {
972 PG_element_rank_modified(*Fq, v, 1, d, j);
973 }
974 else {
975 j = Pts1[i];
976 }
977 // recreate v:
978 Q_epsilon_unrank(*Fq, v, 1, epsilon, n, c1, c2, c3, Pts1[i]);
979 Pts[i] = j;
980 if (f_v) {
981 cout << setw(4) << i << " : " << setw(4) << Pts1[i] << " : ";
982 int_vec_print(cout, v, d);
983 cout << " : " << setw(5) << j << endl;
984 }
985 }
986
987#if 0
988 cout << "list of points:" << endl;
989 cout << nb_pts << endl;
990 for (i = 0; i < nb_pts; i++) {
991 cout << Pts[i] << " ";
992 }
993 cout << endl;
994#endif
995
996 //char fname[1000];
997 if (f_embedded) {
998 sprintf(fname, "BLT_%s_%d_embedded.txt", BLT_label, q);
999 }
1000 else {
1001 sprintf(fname, "BLT_%s_%d.txt", BLT_label, q);
1002 }
1003 //write_set_to_file(fname, L, N, verbose_level);
1004
1005
1006 FREE_int(Pts1);
1007 FREE_int(v);
1008 //FREE_int(L);
1009 FREE_OBJECT(O);
1010#endif
1011}
1012#endif
1013
1014
1015//static int TDO_upper_bounds_v_max_init = 12;
1016static int TDO_upper_bounds_v_max = -1;
1017static int *TDO_upper_bounds_table = NULL;
1018static int *TDO_upper_bounds_table_source = NULL;
1019 // 0 = nothing
1020 // 1 = packing number
1021 // 2 = braun test
1022 // 3 = maxfit
1023static int TDO_upper_bounds_initial_data[] = {
10243,3,1,
10254,3,1,
10265,3,2,
10276,3,4,
10287,3,7,
10298,3,8,
10309,3,12,
103110,3,13,
103211,3,17,
103312,3,20,
10344,4,1,
10355,4,1,
10366,4,1,
10377,4,2,
10388,4,2,
10399,4,3,
104010,4,5,
104111,4,6,
104212,4,9,
10435,5,1,
10446,5,1,
10457,5,1,
10468,5,1,
10479,5,2,
104810,5,2,
104911,5,2,
105012,5,3,
10516,6,1,
10527,6,1,
10538,6,1,
10549,6,1,
105510,6,1,
105611,6,2,
105712,6,2,
10587,7,1,
10598,7,1,
10609,7,1,
106110,7,1,
106211,7,1,
106312,7,1,
10648,8,1,
10659,8,1,
106610,8,1,
106711,8,1,
106812,8,1,
10699,9,1,
107010,9,1,
107111,9,1,
107212,9,1,
107310,10,1,
107411,10,1,
107512,10,1,
107611,11,1,
107712,11,1,
107812,12,1,
1079-1
1080};
1081
1083{
1084 int m, bound;
1085
1086 if (i <= 0) {
1087 cout << "TDO_upper_bound i <= 0, i = " << i << endl;
1088 exit(1);
1089 }
1090 if (j <= 0) {
1091 cout << "TDO_upper_bound j <= 0, j = " << j << endl;
1092 exit(1);
1093 }
1094 m = MAXIMUM(i, j);
1095 if (TDO_upper_bounds_v_max == -1) {
1097 }
1098 if (m > TDO_upper_bounds_v_max) {
1099 //cout << "I need TDO_upper_bound " << i << "," << j << endl;
1101 }
1102 if (TDO_upper_bound_source(i, j) != 1) {
1103 //cout << "I need TDO_upper_bound " << i << "," << j << endl;
1104 }
1105 bound = TDO_upper_bound_internal(i, j);
1106 if (bound == -1) {
1107 cout << "TDO_upper_bound = -1 i=" << i << " j=" << j << endl;
1108 exit(1);
1109 }
1110 //cout << "PACKING " << i << " " << j << " = " << bound << endl;
1111 return TDO_upper_bound_internal(i, j);
1112}
1113
1115{
1116 if (i > TDO_upper_bounds_v_max) {
1117 cout << "TDO_upper_bound i > v_max" << endl;
1118 cout << "i=" << i << endl;
1119 cout << "TDO_upper_bounds_v_max=" << TDO_upper_bounds_v_max << endl;
1120 exit(1);
1121 }
1122 if (i <= 0) {
1123 cout << "TDO_upper_bound_internal i <= 0, i = " << i << endl;
1124 exit(1);
1125 }
1126 if (j <= 0) {
1127 cout << "TDO_upper_bound_internal j <= 0, j = " << j << endl;
1128 exit(1);
1129 }
1130 return TDO_upper_bounds_table[(i - 1) * TDO_upper_bounds_v_max + j - 1];
1131}
1132
1134{
1135 if (i > TDO_upper_bounds_v_max) {
1136 cout << "TDO_upper_bound_source i > v_max" << endl;
1137 cout << "i=" << i << endl;
1138 cout << "TDO_upper_bounds_v_max=" << TDO_upper_bounds_v_max << endl;
1139 exit(1);
1140 }
1141 if (i <= 0) {
1142 cout << "TDO_upper_bound_source i <= 0, i = " << i << endl;
1143 exit(1);
1144 }
1145 if (j <= 0) {
1146 cout << "TDO_upper_bound_source j <= 0, j = " << j << endl;
1147 exit(1);
1148 }
1149 return TDO_upper_bounds_table_source[(i - 1) * TDO_upper_bounds_v_max + j - 1];
1150}
1151
1153{
1154 int i, l, s, m;
1155
1156 i = 0;
1157 s = 0;
1158 for (l = 1; l <= ak; l++) {
1159 m = MAXIMUM(k - i, 0);
1160 s += m;
1161 if (s > v)
1162 return FALSE;
1163 i++;
1164 }
1165 return TRUE;
1166}
1167
1169{
1170 int n, bound, v2, k2;
1171
1172 //cout << "braun_test_upper_bound v=" << v << " k=" << k << endl;
1173 if (k == 1) {
1174 bound = INT_MAX;
1175 }
1176 else if (k == 2) {
1177 bound = ((v * (v - 1)) >> 1);
1178 }
1179 else {
1180 v2 = (v * (v - 1)) >> 1;
1181 k2 = (k * (k - 1)) >> 1;
1182 for (n = 1; ; n++) {
1183 if (braun_test_single_type(v, k, n) == FALSE) {
1184 bound = n - 1;
1185 break;
1186 }
1187 if (n * k2 > v2) {
1188 bound = n - 1;
1189 break;
1190 }
1191 }
1192 }
1193 //cout << "braun_test_upper_bound v=" << v << " k=" << k
1194 //<< " bound=" << bound << endl;
1195 return bound;
1196}
1197
1199{
1200 int i, j, bound, bound_braun, bound_maxfit, u;
1201 //cout << "TDO_refine_init_upper_bounds v_max=" << v_max << endl;
1202
1203 TDO_upper_bounds_table = NEW_int(v_max * v_max);
1204 TDO_upper_bounds_table_source = NEW_int(v_max * v_max);
1205 TDO_upper_bounds_v_max = v_max;
1206 for (i = 0; i < v_max * v_max; i++) {
1207 TDO_upper_bounds_table[i] = -1;
1208 TDO_upper_bounds_table_source[i] = 0;
1209 }
1210 for (u = 0;; u++) {
1211 if (TDO_upper_bounds_initial_data[u * 3 + 0] == -1)
1212 break;
1213 i = TDO_upper_bounds_initial_data[u * 3 + 0];
1214 j = TDO_upper_bounds_initial_data[u * 3 + 1];
1215 bound = TDO_upper_bounds_initial_data[u * 3 + 2];
1216 bound_braun = braun_test_upper_bound(i, j);
1217 if (bound < bound_braun) {
1218 //cout << "i=" << i << " j=" << j << " bound=" << bound
1219 //<< " bound_braun=" << bound_braun << endl;
1220 }
1221 TDO_upper_bound_internal(i, j) = bound;
1222 TDO_upper_bound_source(i, j) = 1;
1223 }
1224 for (i = 1; i <= v_max; i++) {
1225 for (j = 1; j <= i; j++) {
1226 if (TDO_upper_bound_internal(i, j) != -1)
1227 continue;
1228 bound_braun = braun_test_upper_bound(i, j);
1229 TDO_upper_bound_internal(i, j) = bound_braun;
1230 TDO_upper_bound_source(i, j) = 2;
1231 bound_maxfit = packing_number_via_maxfit(i, j);
1232 if (bound_maxfit < bound_braun) {
1233 //cout << "i=" << i << " j=" << j
1234 //<< " bound_braun=" << bound_braun
1235 // << " bound_maxfit=" << bound_maxfit << endl;
1236 TDO_upper_bound_internal(i, j) = bound_maxfit;
1237 TDO_upper_bound_source(i, j) = 3;
1238 }
1239 }
1240 }
1241 //print_integer_matrix_width(cout,
1242 //TDO_upper_bounds_table, v_max, v_max, v_max, 3);
1243 //print_integer_matrix_width(cout,
1244 //TDO_upper_bounds_table_source, v_max, v_max, v_max, 3);
1245}
1246
1248{
1249 int *new_upper_bounds;
1250 int *new_upper_bounds_source;
1251 int i, j, bound, bound_braun, bound_maxfit, src;
1252 int v_max;
1253
1254 //cout << "TDO_refine_extend_upper_bounds
1255 //new_v_max=" << new_v_max << endl;
1256 v_max = TDO_upper_bounds_v_max;
1257 new_upper_bounds = NEW_int(new_v_max * new_v_max);
1258 new_upper_bounds_source = NEW_int(new_v_max * new_v_max);
1259 for (i = 0; i < new_v_max * new_v_max; i++) {
1260 new_upper_bounds[i] = -1;
1261 new_upper_bounds_source[i] = 0;
1262 }
1263 for (i = 1; i <= v_max; i++) {
1264 for (j = 1; j <= v_max; j++) {
1265 bound = TDO_upper_bound_internal(i, j);
1266 src = TDO_upper_bound_source(i, j);
1267 new_upper_bounds[(i - 1) * new_v_max + (j - 1)] = bound;
1268 new_upper_bounds_source[(i - 1) * new_v_max + (j - 1)] = src;
1269 }
1270 }
1271 FREE_int(TDO_upper_bounds_table);
1272 FREE_int(TDO_upper_bounds_table_source);
1273 TDO_upper_bounds_table = new_upper_bounds;
1274 TDO_upper_bounds_table_source = new_upper_bounds_source;
1275 TDO_upper_bounds_v_max = new_v_max;
1276 for (i = v_max + 1; i <= new_v_max; i++) {
1277 for (j = 1; j <= i; j++) {
1278 bound_braun = braun_test_upper_bound(i, j);
1279 TDO_upper_bound_internal(i, j) = bound_braun;
1280 TDO_upper_bound_source(i, j) = 2;
1281 bound_maxfit = packing_number_via_maxfit(i, j);
1282 if (bound_maxfit < bound_braun) {
1283 //cout << "i=" << i << " j=" << j
1284 //<< " bound_braun=" << bound_braun
1285 // << " bound_maxfit=" << bound_maxfit << endl;
1286 TDO_upper_bound_internal(i, j) = bound_maxfit;
1287 TDO_upper_bound_source(i, j) = 3;
1288 }
1289 }
1290 }
1291 //print_integer_matrix_width(cout,
1292 //TDO_upper_bounds_table, new_v_max, new_v_max, new_v_max, 3);
1293 //print_integer_matrix_width(cout,
1294 //TDO_upper_bounds_table_source, new_v_max, new_v_max, new_v_max, 3);
1295
1296}
1297
1299{
1300 int i, k, ak, l, s, m;
1301
1302 i = 0;
1303 s = 0;
1304 for (k = v; k >= 2; k--) {
1305 ak = type[k];
1306 for (l = 0; l < ak; l++) {
1307 m = MAXIMUM(k - i, 0);
1308 s += m;
1309 if (s > v) {
1310 return FALSE;
1311 }
1312 i++;
1313 }
1314 }
1315 return TRUE;
1316}
1317
1318static int maxfit_table_v_max = -1;
1319static int *maxfit_table = NULL;
1320
1321int &geometry_global::maxfit(int i, int j)
1322{
1323 int m;
1324
1325 m = MAXIMUM(i, j);
1326 if (maxfit_table_v_max == -1) {
1327 maxfit_table_init(2 * m);
1328 }
1329 if (m > maxfit_table_v_max) {
1331 }
1332 return maxfit_internal(i, j);
1333}
1334
1336{
1337 if (i > maxfit_table_v_max) {
1338 cout << "maxfit_table_v_max i > v_max" << endl;
1339 cout << "i=" << i << endl;
1340 cout << "maxfit_table_v_max=" << maxfit_table_v_max << endl;
1341 exit(1);
1342 }
1343 if (j > maxfit_table_v_max) {
1344 cout << "maxfit_table_v_max j > v_max" << endl;
1345 cout << "j=" << j << endl;
1346 cout << "maxfit_table_v_max=" << maxfit_table_v_max << endl;
1347 exit(1);
1348 }
1349 if (i <= 0) {
1350 cout << "maxfit_table_v_max i <= 0, i = " << i << endl;
1351 exit(1);
1352 }
1353 if (j <= 0) {
1354 cout << "maxfit_table_v_max j <= 0, j = " << j << endl;
1355 exit(1);
1356 }
1357 return maxfit_table[(i - 1) * maxfit_table_v_max + j - 1];
1358}
1359
1361{
1362 //cout << "maxfit_table_init v_max=" << v_max << endl;
1363
1364 maxfit_table = NEW_int(v_max * v_max);
1365 maxfit_table_v_max = v_max;
1367 //print_integer_matrix_width(cout, maxfit_table, v_max, v_max, v_max, 3);
1368}
1369
1371{
1372 cout << "maxfit_table_reallocate v_max=" << v_max << endl;
1373
1374 FREE_int(maxfit_table);
1375 maxfit_table = NEW_int(v_max * v_max);
1376 maxfit_table_v_max = v_max;
1378 //print_integer_matrix_width(cout, maxfit_table, v_max, v_max, v_max, 3);
1379}
1380
1381#define Choose2(x) ((x*(x-1))/2)
1382
1384{
1385 int M = maxfit_table_v_max;
1386 int *matrix = maxfit_table;
1387 int m, i, j, inz, gki;
1388
1389 //cout << "computing maxfit table v_max=" << maxfit_table_v_max << endl;
1390 for (i=0; i<M*M; i++) {
1391 matrix[i] = 0;
1392 }
1393 m = 0;
1394 for (i=1; i<=M; i++) {
1395 //cout << "i=" << i << endl;
1396 inz = i;
1397 j = 1;
1398 while (i>=j) {
1399 gki = inz/i;
1400 if (j*(j-1)/2 < i*Choose2(gki)+(inz % i)*gki) {
1401 j++;
1402 }
1403 if (j<=M) {
1404 //cout << "j=" << j << " inz=" << inz << endl;
1405 m = MAXIMUM(m, inz);
1406 matrix[(j-1) * M + i-1]=inz;
1407 matrix[(i-1) * M + j-1]=inz;
1408 }
1409 inz++;
1410 }
1411 //print_integer_matrix_width(cout, matrix, M, M, M, 3);
1412 } // next i
1413}
1414
1416{
1417 int m;
1418
1419 if (k == 1) {
1420 return INT_MAX;
1421 }
1422 //cout << "packing_number_via_maxfit n=" << n << " k=" << k << endl;
1423 m=1;
1424 while (maxfit(n, m) >= m*k) {
1425 m++;
1426 }
1427 //cout << "P(" << n << "," << k << ")=" << m - 1 << endl;
1428 return m - 1;
1429}
1430
1431
1432
1435 std::string &inverse_isomorphism_klein_quadric_matrix_A6,
1436 int verbose_level)
1437{
1438 int f_v = (verbose_level >= 1);
1439
1440 if (f_v) {
1441 cout << "geometry_global::do_inverse_isomorphism_klein_quadric" << endl;
1442 }
1443
1444
1445 int *A6;
1446 int sz;
1447
1448 Int_vec_scan(inverse_isomorphism_klein_quadric_matrix_A6.c_str(), A6, sz);
1449 if (sz != 36) {
1450 cout << "geometry_global::do_inverse_isomorphism_klein_quadric "
1451 "The input matrix must be of size 6x6" << endl;
1452 exit(1);
1453 }
1454
1455
1456 cout << "A6:" << endl;
1457 Int_matrix_print(A6, 6, 6);
1458
1459 klein_correspondence *Klein;
1461
1462
1465
1466 O->init(1 /* epsilon */, 6, F, 0 /* verbose_level*/);
1467 Klein->init(F, O, 0 /* verbose_level */);
1468
1469 int A4[16];
1470 Klein->reverse_isomorphism(A6, A4, verbose_level);
1471
1472 cout << "A4:" << endl;
1473 Int_matrix_print(A4, 4, 4);
1474
1475 FREE_OBJECT(Klein);
1476 FREE_OBJECT(O);
1477
1478 if (f_v) {
1479 cout << "geometry_global::do_inverse_isomorphism_klein_quadric done" << endl;
1480 }
1481}
1482
1485 std::string &label,
1486 int verbose_level)
1487{
1488 int f_v = (verbose_level >= 1);
1489
1490 if (f_v) {
1491 cout << "geometry_global::do_rank_points_in_PG" << endl;
1492 }
1493
1494 int *v;
1495 int m, n;
1496
1498
1499 if (f_v) {
1500 cout << "geometry_global::do_rank_points_in_PG coeff: ";
1501 Int_matrix_print(v, m, n);
1502 cout << endl;
1503 }
1504
1505 long int a;
1506 int i;
1507
1508 for (i = 0; i < m; i++) {
1509 F->PG_element_rank_modified_lint(v + i * n, 1, n, a);
1510
1511 Int_vec_print(cout, v + i * n, n);
1512 cout << " : " << a << endl;
1513
1514 }
1515
1516
1517 FREE_int(v);
1518
1519}
1520
1521
1522
1523
1524
1527 std::string &line_1_basis,
1528 std::string &line_2_basis,
1529 int f_normalize_from_the_left, int f_normalize_from_the_right,
1530 int verbose_level)
1531{
1532 int f_v = (verbose_level >= 1);
1533 int *Line1;
1534 int *Line2;
1535 int *A;
1536 int *B;
1537 int *C;
1538 int len, rk, i;
1539
1540 if (f_v) {
1541 cout << "geometry_global::do_intersection_of_two_lines" << endl;
1542 }
1543
1544 Int_vec_scan(line_1_basis, Line1, len);
1545 if (len != 8) {
1546 cout << "geometry_global::do_intersection_of_two_lines len != 8" << endl;
1547 cout << "received " << len << endl;
1548 exit(1);
1549 }
1550 Int_vec_scan(line_2_basis, Line2, len);
1551 if (len != 8) {
1552 cout << "geometry_global::do_intersection_of_two_lines len != 8" << endl;
1553 cout << "received " << len << endl;
1554 exit(1);
1555 }
1556 A = NEW_int(16);
1557 B = NEW_int(16);
1558 C = NEW_int(16);
1559
1560 // Line 1
1561 Int_vec_copy(Line1, A, 8);
1562 rk = F->Linear_algebra->perp_standard(4, 2, A, verbose_level);
1563 if (rk != 2) {
1564 cout << "geometry_global::do_intersection_of_two_lines rk != 2" << endl;
1565 cout << "rk= " << rk << endl;
1566 exit(1);
1567 }
1568
1569 // Line 2
1570 Int_vec_copy(Line2, B, 8);
1571 rk = F->Linear_algebra->perp_standard(4, 2, B, verbose_level);
1572 if (rk != 2) {
1573 cout << "geometry_global::do_intersection_of_two_lines rk != 2" << endl;
1574 cout << "rk= " << rk << endl;
1575 exit(1);
1576 }
1577
1578
1579 Int_vec_copy(A + 8, C, 8);
1580 Int_vec_copy(B + 8, C + 8, 8);
1581 rk = F->Linear_algebra->perp_standard(4, 4, C, verbose_level);
1582 if (rk != 3) {
1583 cout << "geometry_global::do_intersection_of_two_lines rk != 3" << endl;
1584 cout << "rk= " << rk << endl;
1585 exit(1);
1586 }
1587
1588 if (f_normalize_from_the_left) {
1589 cout << "geometry_global::do_intersection_of_two_lines normalizing from the left" << endl;
1590 for (i = 3; i < 4; i++) {
1592 C + i * 4, 1, 4);
1593 }
1594
1595 cout << "geometry_global::do_intersection_of_two_lines after normalize from the left:" << endl;
1596 Int_matrix_print(C + 12, 1, 4);
1597 cout << "rk=" << rk << endl;
1598
1599 }
1600
1601 if (f_normalize_from_the_right) {
1602 cout << "geometry_global::do_intersection_of_two_lines normalizing from the right" << endl;
1603 for (i = 3; i < 4; i++) {
1605 C + i * 4, 1, 4);
1606 }
1607
1608 cout << "geometry_global::do_intersection_of_two_lines after normalize from the right:" << endl;
1609 Int_matrix_print(C + 12, 1, 4);
1610 cout << "rk=" << rk << endl;
1611
1612 }
1613
1614
1615 FREE_int(Line1);
1616 FREE_int(Line2);
1617 FREE_int(A);
1618 FREE_int(B);
1619 FREE_int(C);
1620
1621 if (f_v) {
1622 cout << "geometry_global::do_intersection_of_two_lines done" << endl;
1623 }
1624
1625}
1626
1629 std::string &line_1_basis,
1630 std::string &line_2_basis,
1631 std::string &point,
1632 int f_normalize_from_the_left, int f_normalize_from_the_right,
1633 int verbose_level)
1634{
1635 int f_v = (verbose_level >= 1);
1636 int *Line1;
1637 int *Line2;
1638 int *Pt;
1639 int *A;
1640 int *B;
1641 int len, rk, i;
1642
1643 if (f_v) {
1644 cout << "geometry_global::do_transversal" << endl;
1645 }
1646
1647 Int_vec_scan(line_1_basis, Line1, len);
1648 if (len != 8) {
1649 cout << "geometry_global::do_transversal len != 8" << endl;
1650 cout << "received " << len << endl;
1651 exit(1);
1652 }
1653 Int_vec_scan(line_2_basis, Line2, len);
1654 if (len != 8) {
1655 cout << "geometry_global::do_transversal len != 8" << endl;
1656 cout << "received " << len << endl;
1657 exit(1);
1658 }
1659 Int_vec_scan(point, Pt, len);
1660 if (len != 4) {
1661 cout << "geometry_global::do_transversal len != 4" << endl;
1662 cout << "received " << len << endl;
1663 exit(1);
1664 }
1665 A = NEW_int(16);
1666 B = NEW_int(16);
1667
1668 // Line 1
1669 Int_vec_copy(Line1, A, 8);
1670 Int_vec_copy(Pt, A + 8, 4);
1671 rk = F->Linear_algebra->perp_standard(4, 3, A, verbose_level);
1672 if (rk != 3) {
1673 cout << "geometry_global::do_transversal rk != 3" << endl;
1674 cout << "rk= " << rk << endl;
1675 exit(1);
1676 }
1677 Int_vec_copy(A + 12, B, 4);
1678
1679 // Line 2
1680 Int_vec_copy(Line2, A, 8);
1681 Int_vec_copy(Pt, A + 8, 4);
1682 rk = F->Linear_algebra->perp_standard(4, 3, A, verbose_level);
1683 if (rk != 3) {
1684 cout << "geometry_global::do_transversal rk != 3" << endl;
1685 cout << "rk= " << rk << endl;
1686 exit(1);
1687 }
1688 Int_vec_copy(A + 12, B + 4, 4);
1689
1690 // B
1691 rk = F->Linear_algebra->perp_standard(4, 2, B, verbose_level);
1692 if (rk != 2) {
1693 cout << "geometry_global::do_transversal rk != 2" << endl;
1694 cout << "rk= " << rk << endl;
1695 exit(1);
1696 }
1697 if (f_normalize_from_the_left) {
1698 cout << "geometry_global::do_transversal normalizing from the left" << endl;
1699 for (i = 2; i < 4; i++) {
1701 B + i * 4, 1, 4);
1702 }
1703
1704 cout << "geometry_global::do_transversal after normalize from the left:" << endl;
1705 Int_matrix_print(B + 8, 2, 4);
1706 cout << "rk=" << rk << endl;
1707
1708 }
1709
1710 if (f_normalize_from_the_right) {
1711 cout << "geometry_global::do_transversal normalizing from the right" << endl;
1712 for (i = 2; i < 4; i++) {
1714 B + i * 4, 1, 4);
1715 }
1716
1717 cout << "geometry_global::do_transversal after normalize from the right:" << endl;
1718 Int_matrix_print(B + 8, 2, 4);
1719 cout << "rk=" << rk << endl;
1720
1721 }
1722
1723
1724 FREE_int(Line1);
1725 FREE_int(Line2);
1726 FREE_int(Pt);
1727 FREE_int(A);
1728 FREE_int(B);
1729
1730 if (f_v) {
1731 cout << "geometry_global::do_transversal done" << endl;
1732 }
1733}
1734
1735
1736
1739 int n,
1740 int verbose_level)
1741{
1742 int f_v = (verbose_level >= 1);
1743
1744
1745 if (f_v) {
1746 cout << "geometry_global::do_cheat_sheet_PG verbose_level="
1747 << verbose_level << endl;
1748 }
1749
1750
1752
1754
1755 if (f_v) {
1756 cout << "geometry_global::do_cheat_sheet_PG before P->init" << endl;
1757 }
1758 P->projective_space_init(n, F,
1759 TRUE /*f_init_incidence_structure*/,
1760 0 /* verbose_level */);
1761 if (f_v) {
1762 cout << "geometry_global::do_cheat_sheet_PG after P->init" << endl;
1763 }
1764
1765 if (f_v) {
1766 cout << "geometry_global::do_cheat_sheet_PG before P->create_latex_report" << endl;
1767 }
1768 P->create_latex_report(O, verbose_level);
1769 if (f_v) {
1770 cout << "geometry_global::do_cheat_sheet_PG after P->create_latex_report" << endl;
1771 }
1772
1773
1774
1775 FREE_OBJECT(P);
1776
1777 if (f_v) {
1778 cout << "geometry_global::do_cheat_sheet_PG done" << endl;
1779 }
1780
1781}
1782
1784 int n, int k,
1785 int verbose_level)
1786{
1787 int f_v = (verbose_level >= 1);
1788
1789
1790 if (f_v) {
1791 cout << "geometry_global::do_cheat_sheet_Gr verbose_level="
1792 << verbose_level << endl;
1793 }
1794
1795
1797
1799
1800 if (f_v) {
1801 cout << "geometry_global::do_cheat_sheet_Gr before P->init" << endl;
1802 }
1803 P->projective_space_init(n - 1, F,
1804 TRUE /*f_init_incidence_structure*/,
1805 0 /* verbose_level */);
1806 if (f_v) {
1807 cout << "geometry_global::do_cheat_sheet_Gr after P->init" << endl;
1808 }
1809
1810 if (f_v) {
1811 cout << "geometry_global::do_cheat_sheet_Gr before P->create_latex_report_for_Grassmannian" << endl;
1812 }
1813 P->create_latex_report_for_Grassmannian(k, verbose_level);
1814 if (f_v) {
1815 cout << "geometry_global::do_cheat_sheet_Gr after P->create_latex_report_for_Grassmannian" << endl;
1816 }
1817
1818
1819
1820 FREE_OBJECT(P);
1821
1822 if (f_v) {
1823 cout << "geometry_global::do_cheat_sheet_PG done" << endl;
1824 }
1825
1826}
1827
1828
1830 int projective_dimension,
1831 int verbose_level)
1832{
1833 int f_v = (verbose_level >= 1);
1834
1835
1836 if (f_v) {
1837 cout << "geometry_global::do_cheat_sheet_hermitian verbose_level="
1838 << verbose_level << endl;
1839 }
1840
1841 hermitian *H;
1842
1843 H = NEW_OBJECT(hermitian);
1844
1845 if (f_v) {
1846 cout << "geometry_global::do_cheat_sheet_hermitian before H->init" << endl;
1847 }
1848 H->init(F, projective_dimension + 1, verbose_level - 2);
1849 if (f_v) {
1850 cout << "geometry_global::do_cheat_sheet_hermitian after H->init" << endl;
1851 }
1852
1853 if (f_v) {
1854 cout << "geometry_global::do_cheat_sheet_hermitian before H->create_latex_report" << endl;
1855 }
1856 H->create_latex_report(verbose_level);
1857 if (f_v) {
1858 cout << "geometry_global::do_cheat_sheet_hermitian after H->create_latex_report" << endl;
1859 }
1860
1861
1862
1863 FREE_OBJECT(H);
1864
1865 if (f_v) {
1866 cout << "geometry_global::do_cheat_sheet_hermitian done" << endl;
1867 }
1868
1869}
1870
1873 int m,
1874 int verbose_level)
1875{
1876 int f_v = (verbose_level >= 1);
1877
1878
1879 if (f_v) {
1880 cout << "geometry_global::do_create_desarguesian_spread" << endl;
1881 cout << "geometry_global::do_create_desarguesian_spread Q=" << FQ->q << " q=" << Fq->q << " m=" << m << endl;
1882 }
1883
1884 int s, n;
1885
1886 if (FQ->p != Fq->p) {
1887 cout << "geometry_global::do_create_desarguesian_spread the fields must have the same characteristic" << endl;
1888 exit(1);
1889 }
1890 s = FQ->e / Fq->e;
1891
1892 if (s * Fq->e != FQ->e) {
1893 cout << "geometry_global::do_create_desarguesian_spread Fq is not a subfield of FQ" << endl;
1894 exit(1);
1895 }
1896
1897 n = m * s;
1900
1902 if (f_v) {
1903 cout << "geometry_global::do_create_desarguesian_spread before SubS->init" << endl;
1904 }
1905 SubS->init(FQ, Fq, verbose_level - 2);
1906
1907 if (f_v) {
1908 cout << "Field-basis: ";
1909 Int_vec_print(cout, SubS->Basis, s);
1910 cout << endl;
1911 }
1912
1914 if (f_v) {
1915 cout << "geometry_global::do_create_desarguesian_spread before D->init" << endl;
1916 }
1917 D->init(n, m, s,
1918 SubS,
1919 verbose_level - 2);
1920 if (f_v) {
1921 cout << "geometry_global::do_create_desarguesian_spread after D->init" << endl;
1922 }
1923
1924
1925 D->create_latex_report(verbose_level);
1926
1927 FREE_OBJECT(D);
1928 FREE_OBJECT(SubS);
1929
1930 if (f_v) {
1931 cout << "geometry_global::do_create_desarguesian_spread done" << endl;
1932 }
1933}
1934
1937 long int *points, int nb_points,
1938 long int *lines, int nb_lines,
1939 int verbose_level)
1940{
1941 int f_v = (verbose_level >= 1);
1942
1943 if (f_v) {
1944 cout << "geometry_global::create_decomposition_of_projective_plane" << endl;
1945 }
1946 {
1949 int depth = INT_MAX;
1950
1952 I->init_projective_space(P, verbose_level);
1953
1955 Stack->allocate(I->nb_rows + I->nb_cols, 0 /* verbose_level */);
1956 Stack->subset_continguous(I->nb_rows, I->nb_cols);
1957 Stack->split_cell(0 /* verbose_level */);
1958 Stack->sort_cells();
1959
1960 int *the_points;
1961 int *the_lines;
1962 int i;
1963 the_points = NEW_int(nb_points);
1964 the_lines = NEW_int(nb_lines);
1965
1966 for (i = 0; i < nb_points; i++) {
1967 the_points[i] = points[i];
1968 }
1969 for (i = 0; i < nb_lines; i++) {
1970 the_lines[i] = lines[i];
1971 }
1972
1974 the_points, nb_points, TRUE /* f_front*/, verbose_level);
1975
1977 the_lines, nb_lines, TRUE /* f_front*/, verbose_level);
1978
1979
1980 FREE_int(the_points);
1981 FREE_int(the_lines);
1982
1983 if (f_v) {
1984 cout << "geometry_global::create_decomposition_of_projective_plane before I->compute_TDO_safe" << endl;
1985 }
1986 I->compute_TDO_safe(*Stack, depth, verbose_level);
1987 if (f_v) {
1988 cout << "geometry_global::create_decomposition_of_projective_plane after I->compute_TDO_safe" << endl;
1989 }
1990
1991
1993 cout, FALSE /* f_enter_math */,
1994 TRUE /* f_print_subscripts */, *Stack);
1996 cout, FALSE /* f_enter_math */,
1997 TRUE /* f_print_subscripts */, *Stack);
1998
1999
2000
2001 string fname_row_scheme;
2002 string fname_col_scheme;
2003
2004
2005 fname_row_scheme.assign(fname_base);
2006 fname_row_scheme.append("_row_scheme.tex");
2007 fname_col_scheme.assign(fname_base);
2008 fname_col_scheme.append("_col_scheme.tex");
2009 {
2010 ofstream fp_row_scheme(fname_row_scheme);
2011 ofstream fp_col_scheme(fname_col_scheme);
2013 fp_row_scheme, FALSE /* f_enter_math */,
2014 TRUE /* f_print_subscripts */, *Stack);
2016 fp_col_scheme, FALSE /* f_enter_math */,
2017 TRUE /* f_print_subscripts */, *Stack);
2018 }
2019
2020
2021 FREE_OBJECT(Stack);
2022 FREE_OBJECT(I);
2023 }
2024 if (f_v) {
2025 cout << "geometry_global::create_decomposition_of_projective_plane done" << endl;
2026 }
2027
2028}
2029
2030
2031
2033 field_theory::finite_field *F, int degree, int nb_vars,
2034 std::string &equation_text,
2035 std::string &symbol_txt,
2036 std::string &symbol_tex,
2037 int verbose_level)
2038{
2039 int f_v = (verbose_level >= 1);
2040
2041 if (f_v) {
2042 cout << "geometry_global::latex_homogeneous_equation" << endl;
2043 }
2044 int *eqn;
2045 int sz;
2047
2048 Int_vec_scan(equation_text, eqn, sz);
2050
2051 if (f_v) {
2052 cout << "geometry_global::latex_homogeneous_equation before Poly->init" << endl;
2053 }
2054 Poly->init(F,
2055 degree /* nb_vars */, degree /* degree */,
2056 FALSE /* f_init_incidence_structure */,
2057 t_PART,
2058 verbose_level);
2059
2060 Poly->remake_symbols(0 /* symbol_offset */,
2061 symbol_txt.c_str(),
2062 symbol_tex.c_str(),
2063 verbose_level);
2064
2065
2066 if (Poly->get_nb_monomials() != sz) {
2067 cout << "Poly->get_nb_monomials() = " << Poly->get_nb_monomials() << endl;
2068 cout << "number of coefficients given = " << sz << endl;
2069 exit(1);
2070 }
2071 Poly->print_equation_tex(cout, eqn);
2072 cout << endl;
2073 if (f_v) {
2074 cout << "geometry_global::latex_homogeneous_equation done" << endl;
2075 }
2076
2077}
2078
2080 int *v5, int a, int b, int c, int verbose_level)
2081// creates the point (-b/2,-c,a,-(b^2/4-ac),1)
2082// check if it satisfies x_0^2 + x_1x_2 + x_3x_4:
2083// b^2/4 + (-c)*a + -(b^2/4-ac)
2084// = b^2/4 -ac -b^2/4 + ac = 0
2085{
2086 int f_v = (verbose_level >= 1);
2087 int v0, v1, v2, v3, v4;
2088 int half, four, quarter, minus_one;
2089
2090 if (f_v) {
2091 cout << "geometry_global::create_BLT_point" << endl;
2092 }
2093 four = 4 % F->p;
2094 half = F->inverse(2);
2095 quarter = F->inverse(four);
2096 minus_one = F->negate(1);
2097 if (f_v) {
2098 cout << "geometry_global::create_BLT_point "
2099 "four=" << four << endl;
2100 cout << "geometry_global::create_BLT_point "
2101 "half=" << half << endl;
2102 cout << "geometry_global::create_BLT_point "
2103 "quarter=" << quarter << endl;
2104 cout << "geometry_global::create_BLT_point "
2105 "minus_one=" << minus_one << endl;
2106 }
2107
2108 v0 = F->mult(minus_one, F->mult(b, half));
2109 v1 = F->mult(minus_one, c);
2110 v2 = a;
2111 v3 = F->mult(minus_one, F->add(
2112 F->mult(F->mult(b, b), quarter), F->negate(F->mult(a, c))));
2113 v4 = 1;
2114 orbiter_kernel_system::Orbiter->Int_vec->init5(v5, v0, v1, v2, v3, v4);
2115 if (f_v) {
2116 cout << "geometry_global::create_BLT_point done" << endl;
2117 }
2118}
2119
2120
2122 projective_space *P2,
2123 long int *arc6,
2124 int verbose_level)
2125{
2126 int f_v = (verbose_level >= 1);
2127
2129
2130 if (f_v) {
2131 cout << "geometry_global::compute_eckardt_point_info" << endl;
2132 }
2133 if (P2->n != 2) {
2134 cout << "geometry_global::compute_eckardt_point_info "
2135 "P2->n != 2" << endl;
2136 exit(1);
2137 }
2138
2139 if (f_v) {
2140 cout << "arc: ";
2141 Lint_vec_print(cout, arc6, 6);
2142 cout << endl;
2143 }
2144
2146 E->init(P2, arc6, verbose_level);
2147
2148 if (f_v) {
2149 cout << "geometry_global::compute_eckardt_point_info done" << endl;
2150 }
2151 return E;
2152}
2153
2155 projective_space *P2,
2156 long int *S, int len, int pt, int nb_E, int verbose_level)
2157{
2158 int f_v = (verbose_level >= 1);
2159 int ret = TRUE;
2160 long int Arc6[6];
2161
2162 if (f_v) {
2163 cout << "geometry_global::test_nb_Eckardt_points" << endl;
2164 }
2165 if (len != 5) {
2166 return TRUE;
2167 }
2168
2169 Lint_vec_copy(S, Arc6, 5);
2170 Arc6[5] = pt;
2171
2173
2174 E = compute_eckardt_point_info(P2, Arc6, 0/*verbose_level*/);
2175
2176
2177 if (E->nb_E != nb_E) {
2178 ret = FALSE;
2179 }
2180
2181 FREE_OBJECT(E);
2182
2183 if (f_v) {
2184 cout << "geometry_global::test_nb_Eckardt_points done" << endl;
2185 }
2186 return ret;
2187}
2188
2190 long int *Arc6,
2191 long int P1, long int P2, int partition_rk, long int *arc,
2192 int verbose_level)
2193// P1 and P2 are points on the arc.
2194// Find them and remove them
2195// so we can find the remaining four point of the arc:
2196{
2197 int f_v = (verbose_level >= 1);
2198 long int i, a, h;
2199 int part[4];
2200 long int pts[4];
2202
2203 if (f_v) {
2204 cout << "geometry_global::rearrange_arc_for_lifting" << endl;
2205 }
2206 arc[0] = P1;
2207 arc[1] = P2;
2208 h = 2;
2209 for (i = 0; i < 6; i++) {
2210 a = Arc6[i];
2211 if (a == P1 || a == P2) {
2212 continue;
2213 }
2214 arc[h++] = a;
2215 }
2216 if (h != 6) {
2217 cout << "geometry_global::rearrange_arc_for_lifting "
2218 "h != 6" << endl;
2219 exit(1);
2220 }
2221 // now arc[2], arc[3], arc[4], arc[5] are the remaining four points
2222 // of the arc.
2223
2224 Combi.set_partition_4_into_2_unrank(partition_rk, part);
2225
2226 Lint_vec_copy(arc + 2, pts, 4);
2227
2228 for (i = 0; i < 4; i++) {
2229 a = part[i];
2230 arc[2 + i] = pts[a];
2231 }
2232
2233 if (f_v) {
2234 cout << "geometry_global::rearrange_arc_for_lifting done" << endl;
2235 }
2236}
2237
2240 long int P1, long int P2, long int &line1, long int &line2,
2241 int verbose_level)
2242// P1 and P2 are points on the arc and in the plane W=0.
2243// Note the points are points in PG(3,q), not in local coordinates in W=0.
2244// We find two skew lines in space through P1 and P2, respectively.
2245{
2246 int f_v = (verbose_level >= 1);
2247 int Basis[16];
2248 int Basis2[16];
2249 int Basis_search[16];
2250 int Basis_search_copy[16];
2251 int base_cols[4];
2252 int i, N, rk;
2253 geometry_global Gg;
2254
2255 if (f_v) {
2256 cout << "geometry_global::find_two_lines_for_arc_lifting" << endl;
2257 }
2258 if (P->n != 3) {
2259 cout << "geometry_global::find_two_lines_for_arc_lifting "
2260 "P->n != 3" << endl;
2261 exit(1);
2262 }
2263 // unrank points P1 and P2 in the plane W=3:
2264 // Note the points are points in PG(3,q), not in local coordinates.
2265 P->unrank_point(Basis, P1);
2266 P->unrank_point(Basis + 4, P2);
2267 if (Basis[3]) {
2268 cout << "geometry_global::find_two_lines_for_arc_lifting "
2269 "Basis[3] != 0, the point P1 does not lie "
2270 "in the hyperplane W = 0" << endl;
2271 exit(1);
2272 }
2273 if (Basis[7]) {
2274 cout << "geometry_global::find_two_lines_for_arc_lifting "
2275 "Basis[7] != 0, the point P2 does not lie "
2276 "in the hyperplane W = 0" << endl;
2277 exit(1);
2278 }
2279 Int_vec_zero(Basis + 8, 8);
2280
2281 N = Gg.nb_PG_elements(3, P->q);
2282 // N = the number of points in PG(3,q)
2283
2284 // Find the first line.
2285 // Loop over all points P.
2286 // Make sure the point does not belong to the hyperplane,
2287 // i.e. the last coordinate is nonzero.
2288 // Make sure the rank of the subspace spanned by P1, P2 and P is three.
2289
2290 for (i = 0; i < N; i++) {
2291 Int_vec_copy(Basis, Basis_search, 4);
2292 Int_vec_copy(Basis + 4, Basis_search + 4, 4);
2293 P->F->PG_element_unrank_modified(Basis_search + 8, 1, 4, i);
2294 if (Basis_search[11] == 0) {
2295 continue;
2296 }
2297 Int_vec_copy(Basis_search, Basis_search_copy, 12);
2298 rk = P->F->Linear_algebra->Gauss_easy_memory_given(Basis_search_copy, 3, 4, base_cols);
2299 if (rk == 3) {
2300 break;
2301 }
2302 }
2303 if (i == N) {
2304 cout << "geometry_global::find_two_lines_for_arc_lifting "
2305 "i == N, could not find line1" << endl;
2306 exit(1);
2307 }
2308 int p0, p1;
2309
2310 p0 = i;
2311
2312 // Find the second line.
2313 // Loop over all points Q after the first P.
2314 // Make sure the point does not belong to the hyperplane,
2315 // i.e. the last coordinate is nonzero.
2316 // Make sure the rank of the subspace spanned by P1, P2 and P and Q is four.
2317
2318 for (i = p0 + 1; i < N; i++) {
2319 Int_vec_copy(Basis, Basis_search, 4);
2320 Int_vec_copy(Basis + 4, Basis_search + 4, 4);
2321 P->F->PG_element_unrank_modified(Basis_search + 8, 1, 4, p0);
2322 P->F->PG_element_unrank_modified(Basis_search + 12, 1, 4, i);
2323 if (Basis_search[15] == 0) {
2324 continue;
2325 }
2326 Int_vec_copy(Basis_search, Basis_search_copy, 16);
2328 Basis_search_copy, 4, 4, base_cols);
2329 if (rk == 4) {
2330 break;
2331 }
2332 }
2333 if (i == N) {
2334 cout << "geometry_global::find_two_lines_for_arc_lifting "
2335 "i == N, could not find line2" << endl;
2336 exit(1);
2337 }
2338 p1 = i;
2339
2340 if (f_v) {
2341 cout << "geometry_global::find_two_lines_for_arc_lifting "
2342 "p0=" << p0 << " p1=" << p1 << endl;
2343 }
2344 P->F->PG_element_unrank_modified(Basis + 8, 1, 4, p0);
2345 P->F->PG_element_unrank_modified(Basis + 12, 1, 4, p1);
2346 if (f_v) {
2347 cout << "geometry_global::find_two_lines_for_arc_lifting " << endl;
2348 cout << "Basis:" << endl;
2349 Int_matrix_print(Basis, 4, 4);
2350 }
2351 Int_vec_copy(Basis, Basis2, 4);
2352 Int_vec_copy(Basis + 8, Basis2 + 4, 4);
2353 Int_vec_copy(Basis + 4, Basis2 + 8, 4);
2354 Int_vec_copy(Basis + 12, Basis2 + 12, 4);
2355 if (f_v) {
2356 cout << "geometry_global::find_two_lines_for_arc_lifting "
2357 "Basis2:" << endl;
2358 Int_matrix_print(Basis2, 4, 4);
2359 }
2360 line1 = P->rank_line(Basis2);
2361 line2 = P->rank_line(Basis2 + 8);
2362 if (f_v) {
2363 cout << "geometry_global::find_two_lines_for_arc_lifting "
2364 "line1=" << line1 << " line2=" << line2 << endl;
2365 }
2366 if (f_v) {
2367 cout << "geometry_global::find_two_lines_for_arc_lifting "
2368 "done" << endl;
2369 }
2370}
2371
2374 int *A3, int f_semilinear, int frobenius,
2375 long int line1, long int line2,
2376 int *A4,
2377 int verbose_level)
2378{
2379 int f_v = (verbose_level >= 1);
2380 int Line1[8];
2381 int Line2[8];
2382 int P1A[3];
2383 int P2A[3];
2384 int A3t[9];
2385 int x[3];
2386 int y[3];
2387 int xmy[4];
2388 int Mt[16];
2389 int M[16];
2390 int Mv[16];
2391 int v[4];
2392 int w[4];
2393 int lmei[4];
2394 int m1;
2395 int M_tmp[16];
2396 int tmp_basecols[4];
2397 int lambda, mu; //, epsilon, iota;
2398 int abgd[4];
2399 int i, j;
2400 int f_swap; // does A3 swap P1 and P2?
2402
2403 if (f_v) {
2404 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed" << endl;
2405 }
2406 if (f_v) {
2407 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2408 "A3:" << endl;
2409 Int_matrix_print(A3, 3, 3);
2410 cout << "f_semilinear = " << f_semilinear
2411 << " frobenius=" << frobenius << endl;
2412 }
2413 m1 = P->F->negate(1);
2414 P->unrank_line(Line1, line1);
2415 P->unrank_line(Line2, line2);
2416 if (f_v) {
2417 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2418 "input Line1:" << endl;
2419 Int_matrix_print(Line1, 2, 4);
2420 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2421 "input Line2:" << endl;
2422 Int_matrix_print(Line2, 2, 4);
2423 }
2424 P->F->Linear_algebra->Gauss_step_make_pivot_one(Line1 + 4, Line1,
2425 4 /* len */, 3 /* idx */, 0 /* verbose_level*/);
2426 // afterwards: v1,v2 span the same space as before
2427 // v2[idx] = 0, v1[idx] = 1,
2428 // So, now Line1[3] = 0 and Line1[7] = 1
2429 P->F->Linear_algebra->Gauss_step_make_pivot_one(Line2 + 4, Line2,
2430 4 /* len */, 3 /* idx */, 0 /* verbose_level*/);
2431 // afterwards: v1,v2 span the same space as before
2432 // v2[idx] = 0, v1[idx] = 1,
2433 // So, now Line2[3] = 0 and Line2[7] = 1
2434 if (f_v) {
2435 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2436 "modified Line1:" << endl;
2437 Int_matrix_print(Line1, 2, 4);
2438 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2439 "modified Line2:" << endl;
2440 Int_matrix_print(Line2, 2, 4);
2441 }
2442
2443 P->F->PG_element_normalize(Line1, 1, 4);
2444 P->F->PG_element_normalize(Line2, 1, 4);
2445 P->F->PG_element_normalize(Line1 + 4, 1, 4);
2446 P->F->PG_element_normalize(Line2 + 4, 1, 4);
2447 if (f_v) {
2448 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2449 "P1 = first point on Line1:" << endl;
2450 Int_matrix_print(Line1, 1, 4);
2451 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2452 "P2 = first point on Line2:" << endl;
2453 Int_matrix_print(Line2, 1, 4);
2454 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2455 "x = second point on Line1:" << endl;
2456 Int_matrix_print(Line1 + 4, 1, 4);
2457 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2458 "y = second point on Line2:" << endl;
2459 Int_matrix_print(Line2 + 4, 1, 4);
2460 }
2461 // compute P1 * A3 to figure out if A switches P1 and P2 or not:
2462 P->F->Linear_algebra->mult_vector_from_the_left(Line1, A3, P1A, 3, 3);
2463 P->F->Linear_algebra->mult_vector_from_the_left(Line2, A3, P2A, 3, 3);
2464 if (f_v) {
2465 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2466 "P1 * A = " << endl;
2467 Int_matrix_print(P1A, 1, 3);
2468 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2469 "P2 * A = " << endl;
2470 Int_matrix_print(P2A, 1, 3);
2471 }
2472 if (f_semilinear) {
2473 if (f_v) {
2474 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2475 "applying frobenius" << endl;
2476 }
2477 P->F->Linear_algebra->vector_frobenius_power_in_place(P1A, 3, frobenius);
2478 P->F->Linear_algebra->vector_frobenius_power_in_place(P2A, 3, frobenius);
2479 }
2480 if (f_v) {
2481 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2482 "P1 * A ^Phi^frobenius = " << endl;
2483 Int_matrix_print(P1A, 1, 3);
2484 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2485 "P2 * A ^Phi^frobenius = " << endl;
2486 Int_matrix_print(P2A, 1, 3);
2487 }
2488 P->F->PG_element_normalize(P1A, 1, 3);
2489 P->F->PG_element_normalize(P2A, 1, 3);
2490 if (f_v) {
2491 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2492 "normalized P1 * A = " << endl;
2493 Int_matrix_print(P1A, 1, 3);
2494 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2495 "normalized P2 * A = " << endl;
2496 Int_matrix_print(P2A, 1, 3);
2497 }
2498 if (Sorting.int_vec_compare(P1A, Line1, 3) == 0) {
2499 f_swap = FALSE;
2500 if (Sorting.int_vec_compare(P2A, Line2, 3)) {
2501 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2502 "We don't have a swap but A3 does not stabilize P2" << endl;
2503 exit(1);
2504 }
2505 }
2506 else if (Sorting.int_vec_compare(P1A, Line2, 3) == 0) {
2507 f_swap = TRUE;
2508 if (Sorting.int_vec_compare(P2A, Line1, 3)) {
2509 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2510 "We have a swap but A3 does not map P2 to P1" << endl;
2511 exit(1);
2512 }
2513 }
2514 else {
2515 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2516 "unable to determine if we have a swap or not." << endl;
2517 exit(1);
2518 }
2519
2520 if (f_v) {
2521 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2522 "f_swap=" << f_swap << endl;
2523 }
2524
2525 Int_vec_copy(Line1 + 4, x, 3);
2526 Int_vec_copy(Line2 + 4, y, 3);
2527 if (f_v) {
2528 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2529 "x:" << endl;
2530 Int_matrix_print(x, 1, 3);
2531 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2532 "y:" << endl;
2533 Int_matrix_print(y, 1, 3);
2534 }
2535
2536 P->F->Linear_algebra->linear_combination_of_vectors(1, x, m1, y, xmy, 3);
2537 if (f_v) {
2538 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2539 "xmy:" << endl;
2540 Int_matrix_print(xmy, 1, 3);
2541 }
2542
2543 P->F->Linear_algebra->transpose_matrix(A3, A3t, 3, 3);
2544 if (f_v) {
2545 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2546 "A3t:" << endl;
2547 Int_matrix_print(A3t, 3, 3);
2548 }
2549
2550
2551 P->F->Linear_algebra->mult_vector_from_the_right(A3t, xmy, v, 3, 3);
2552 if (f_semilinear) {
2553 P->F->Linear_algebra->vector_frobenius_power_in_place(v, 3, frobenius);
2554 }
2555 if (f_v) {
2556 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2557 "v:" << endl;
2558 Int_matrix_print(v, 1, 3);
2559 }
2560 P->F->Linear_algebra->mult_vector_from_the_right(A3t, x, w, 3, 3);
2561 if (f_semilinear) {
2562 P->F->Linear_algebra->vector_frobenius_power_in_place(w, 3, frobenius);
2563 }
2564 if (f_v) {
2565 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2566 "w:" << endl;
2567 Int_matrix_print(w, 1, 3);
2568 }
2569
2570 if (f_swap) {
2571 Int_vec_copy(Line2 + 4, Mt + 0, 4);
2572 Int_vec_copy(Line2 + 0, Mt + 4, 4);
2573 Int_vec_copy(Line1 + 4, Mt + 8, 4);
2574 Int_vec_copy(Line1 + 0, Mt + 12, 4);
2575 }
2576 else {
2577 Int_vec_copy(Line1 + 4, Mt + 0, 4);
2578 Int_vec_copy(Line1 + 0, Mt + 4, 4);
2579 Int_vec_copy(Line2 + 4, Mt + 8, 4);
2580 Int_vec_copy(Line2 + 0, Mt + 12, 4);
2581 }
2582
2583 P->F->Linear_algebra->negate_vector_in_place(Mt + 8, 8);
2584 P->F->Linear_algebra->transpose_matrix(Mt, M, 4, 4);
2585 //int_vec_copy(Mt, M, 16);
2586 if (f_v) {
2587 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2588 "M:" << endl;
2589 Int_matrix_print(M, 4, 4);
2590 }
2591
2592 P->F->Linear_algebra->invert_matrix_memory_given(M, Mv, 4, M_tmp, tmp_basecols, 0 /* verbose_level */);
2593 if (f_v) {
2594 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2595 "Mv:" << endl;
2596 Int_matrix_print(Mv, 4, 4);
2597 }
2598
2599 v[3] = 0;
2600 w[3] = 0;
2601 P->F->Linear_algebra->mult_vector_from_the_right(Mv, v, lmei, 4, 4);
2602 if (f_v) {
2603 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2604 "lmei:" << endl;
2605 Int_matrix_print(lmei, 1, 4);
2606 }
2607 lambda = lmei[0];
2608 mu = lmei[1];
2609 //epsilon = lmei[2];
2610 //iota = lmei[3];
2611
2612 if (f_swap) {
2614 lambda, y, mu, Line2, m1, w, abgd, 3);
2615 }
2616 else {
2618 lambda, x, mu, Line1, m1, w, abgd, 3);
2619 }
2620 abgd[3] = lambda;
2621 if (f_semilinear) {
2622 P->F->Linear_algebra->vector_frobenius_power_in_place(abgd, 4, P->F->e - frobenius);
2623 }
2624 if (f_v) {
2625 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2626 "abgd:" << endl;
2627 Int_matrix_print(abgd, 1, 4);
2628 }
2629 // make an identity matrix:
2630 for (i = 0; i < 3; i++) {
2631 for (j = 0; j < 3; j++) {
2632 A4[i * 4 + j] = A3[i * 3 + j];
2633 }
2634 A4[i * 4 + 3] = 0;
2635 }
2636 // fill in the last row:
2637 Int_vec_copy(abgd, A4 + 4 * 3, 4);
2638 if (f_v) {
2639 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed "
2640 "A4:" << endl;
2641 Int_matrix_print(A4, 4, 4);
2642 }
2643
2644 if (f_semilinear) {
2645 A4[16] = frobenius;
2646 }
2647
2648 if (f_v) {
2649 cout << "geometry_global::hyperplane_lifting_with_two_lines_fixed done" << endl;
2650 }
2651}
2652
2655 long int line1_from, long int line1_to,
2656 long int line2_from, long int line2_to,
2657 int *A4,
2658 int verbose_level)
2659{
2660 int f_v = (verbose_level >= 1);
2661 int Line1_from[8];
2662 int Line2_from[8];
2663 int Line1_to[8];
2664 int Line2_to[8];
2665 int P1[4];
2666 int P2[4];
2667 int x[4];
2668 int y[4];
2669 int u[4];
2670 int v[4];
2671 int umv[4];
2672 int M[16];
2673 int Mv[16];
2674 int lmei[4];
2675 int m1;
2676 int M_tmp[16];
2677 int tmp_basecols[4];
2678 int lambda, mu; //, epsilon, iota;
2679 int abgd[4];
2680 int i, j;
2682
2683 if (f_v) {
2684 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved" << endl;
2685 }
2686 m1 = P->F->negate(1);
2687
2688 P->unrank_line(Line1_from, line1_from);
2689 P->unrank_line(Line2_from, line2_from);
2690 if (f_v) {
2691 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2692 "input Line1_from:" << endl;
2693 Int_matrix_print(Line1_from, 2, 4);
2694 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2695 "input Line2_from:" << endl;
2696 Int_matrix_print(Line2_from, 2, 4);
2697 }
2698 P->F->Linear_algebra->Gauss_step_make_pivot_one(Line1_from + 4, Line1_from,
2699 4 /* len */, 3 /* idx */, 0 /* verbose_level*/);
2700 // afterwards: v1,v2 span the same space as before
2701 // v2[idx] = 0, v1[idx] = 1,
2702 // So, now Line1[3] = 0 and Line1[7] = 1
2703 P->F->Linear_algebra->Gauss_step_make_pivot_one(Line2_from + 4, Line2_from,
2704 4 /* len */, 3 /* idx */, 0 /* verbose_level*/);
2705 // afterwards: v1,v2 span the same space as before
2706 // v2[idx] = 0, v1[idx] = 1,
2707 // So, now Line2[3] = 0 and Line2[7] = 1
2708 if (f_v) {
2709 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2710 "modified Line1_from:" << endl;
2711 Int_matrix_print(Line1_from, 2, 4);
2712 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2713 "modified Line2_from:" << endl;
2714 Int_matrix_print(Line2_from, 2, 4);
2715 }
2716
2717 P->F->PG_element_normalize(Line1_from, 1, 4);
2718 P->F->PG_element_normalize(Line2_from, 1, 4);
2719 P->F->PG_element_normalize(Line1_from + 4, 1, 4);
2720 P->F->PG_element_normalize(Line2_from + 4, 1, 4);
2721 if (f_v) {
2722 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2723 "P1 = first point on Line1_from:" << endl;
2724 Int_matrix_print(Line1_from, 1, 4);
2725 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2726 "P2 = first point on Line2_from:" << endl;
2727 Int_matrix_print(Line2_from, 1, 4);
2728 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2729 "u = second point on Line1_from:" << endl;
2730 Int_matrix_print(Line1_from + 4, 1, 4);
2731 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2732 "v = second point on Line2_from:" << endl;
2733 Int_matrix_print(Line2_from + 4, 1, 4);
2734 }
2735 Int_vec_copy(Line1_from + 4, u, 4);
2736 Int_vec_copy(Line1_from, P1, 4);
2737 Int_vec_copy(Line2_from + 4, v, 4);
2738 Int_vec_copy(Line2_from, P2, 4);
2739
2740
2741 P->unrank_line(Line1_to, line1_to);
2742 P->unrank_line(Line2_to, line2_to);
2743 if (f_v) {
2744 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2745 "input Line1_to:" << endl;
2746 Int_matrix_print(Line1_to, 2, 4);
2747 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2748 "input Line2_to:" << endl;
2749 Int_matrix_print(Line2_to, 2, 4);
2750 }
2751 P->F->Linear_algebra->Gauss_step_make_pivot_one(Line1_to + 4, Line1_to,
2752 4 /* len */, 3 /* idx */, 0 /* verbose_level*/);
2753 // afterwards: v1,v2 span the same space as before
2754 // v2[idx] = 0, v1[idx] = 1,
2755 // So, now Line1[3] = 0 and Line1[7] = 1
2756 P->F->Linear_algebra->Gauss_step_make_pivot_one(Line2_to + 4, Line2_to,
2757 4 /* len */, 3 /* idx */, 0 /* verbose_level*/);
2758 // afterwards: v1,v2 span the same space as before
2759 // v2[idx] = 0, v1[idx] = 1,
2760 // So, now Line2[3] = 0 and Line2[7] = 1
2761 if (f_v) {
2762 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2763 "modified Line1_to:" << endl;
2764 Int_matrix_print(Line1_to, 2, 4);
2765 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2766 "modified Line2_to:" << endl;
2767 Int_matrix_print(Line2_to, 2, 4);
2768 }
2769
2770 P->F->PG_element_normalize(Line1_to, 1, 4);
2771 P->F->PG_element_normalize(Line2_to, 1, 4);
2772 P->F->PG_element_normalize(Line1_to + 4, 1, 4);
2773 P->F->PG_element_normalize(Line2_to + 4, 1, 4);
2774 if (f_v) {
2775 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2776 "P1 = first point on Line1_to:" << endl;
2777 Int_matrix_print(Line1_to, 1, 4);
2778 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2779 "P2 = first point on Line2_to:" << endl;
2780 Int_matrix_print(Line2_to, 1, 4);
2781 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2782 "x = second point on Line1_to:" << endl;
2783 Int_matrix_print(Line1_to + 4, 1, 4);
2784 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2785 "y = second point on Line2_to:" << endl;
2786 Int_matrix_print(Line2_to + 4, 1, 4);
2787 }
2788
2789
2790 Int_vec_copy(Line1_to + 4, x, 4);
2791 //int_vec_copy(Line1_to, P1, 4);
2792 if (Sorting.int_vec_compare(P1, Line1_to, 4)) {
2793 cout << "Line1_from and Line1_to must intersect in W=0" << endl;
2794 exit(1);
2795 }
2796 Int_vec_copy(Line2_to + 4, y, 4);
2797 //int_vec_copy(Line2_to, P2, 4);
2798 if (Sorting.int_vec_compare(P2, Line2_to, 4)) {
2799 cout << "Line2_from and Line2_to must intersect in W=0" << endl;
2800 exit(1);
2801 }
2802
2803
2804 P->F->Linear_algebra->linear_combination_of_vectors(1, u, m1, v, umv, 3);
2805 umv[3] = 0;
2806 if (f_v) {
2807 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2808 "umv:" << endl;
2809 Int_matrix_print(umv, 1, 4);
2810 }
2811
2812 Int_vec_copy(x, M + 0, 4);
2813 Int_vec_copy(P1, M + 4, 4);
2814 Int_vec_copy(y, M + 8, 4);
2815 Int_vec_copy(P2, M + 12, 4);
2816
2818 if (f_v) {
2819 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2820 "M:" << endl;
2821 Int_matrix_print(M, 4, 4);
2822 }
2823
2824 P->F->Linear_algebra->invert_matrix_memory_given(M, Mv, 4, M_tmp, tmp_basecols, 0 /* verbose_level */);
2825 if (f_v) {
2826 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2827 "Mv:" << endl;
2828 Int_matrix_print(Mv, 4, 4);
2829 }
2830
2831 P->F->Linear_algebra->mult_vector_from_the_left(umv, Mv, lmei, 4, 4);
2832 if (f_v) {
2833 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2834 "lmei=" << endl;
2835 Int_matrix_print(lmei, 1, 4);
2836 }
2837 lambda = lmei[0];
2838 mu = lmei[1];
2839 if (f_v) {
2840 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2841 "lambda=" << lambda << " mu=" << mu << endl;
2842 }
2843
2844 P->F->Linear_algebra->linear_combination_of_three_vectors(lambda, x, mu, P1, m1, u, abgd, 3);
2845 // abgd = lambda * x + mu * P1 - u, with a lambda in the 4th coordinate.
2846
2847 abgd[3] = lambda;
2848
2849 if (f_v) {
2850 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2851 "abgd:" << endl;
2852 Int_matrix_print(abgd, 1, 4);
2853 }
2854
2855 // make an identity matrix:
2856 for (i = 0; i < 4; i++) {
2857 for (j = 0; j < 4; j++) {
2858 if (i == j) {
2859 A4[i * 4 + j] = 1;
2860 }
2861 else {
2862 A4[i * 4 + j] = 0;
2863 }
2864 }
2865 }
2866 // fill in the last row:
2867 Int_vec_copy(abgd, A4 + 3 * 4, 4);
2868 if (f_v) {
2869 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved "
2870 "A4:" << endl;
2871 Int_matrix_print(A4, 4, 4);
2872
2873 P->F->print_matrix_latex(cout, A4, 4, 4);
2874
2875 }
2876
2877 if (f_v) {
2878 cout << "geometry_global::hyperplane_lifting_with_two_lines_moved done" << endl;
2879 }
2880
2881}
2882
2885 long int *set2, int sz2, long int *set4, int &sz4, int verbose_level)
2886// we must be a projective plane
2887{
2888 int f_v = (verbose_level >= 1);
2889 int f_vv = (verbose_level >= 2);
2892 int /*Q,*/ q;
2893 int *v, *w1, *w2, *w3, *v2;
2894 int *components;
2895 int *embedding;
2896 int *pair_embedding;
2897 int i, h, k, a, a0, a1, b, b0, b1, e, alpha;
2898
2899 if (f_v) {
2900 cout << "geometry_global::andre_preimage" << endl;
2901 }
2902 FQ = P2->F;
2903 //Q = FQ->q;
2904 alpha = FQ->p;
2905 if (f_vv) {
2906 cout << "alpha=" << alpha << endl;
2907 //FQ->print(TRUE /* f_add_mult_table */);
2908 }
2909
2910
2911 Fq = P4->F;
2912 q = Fq->q;
2913
2914 v = NEW_int(3);
2915 w1 = NEW_int(5);
2916 w2 = NEW_int(5);
2917 w3 = NEW_int(5);
2918 v2 = NEW_int(2);
2919 e = P2->F->e >> 1;
2920 if (f_vv) {
2921 cout << "geometry_global::andre_preimage e=" << e << endl;
2922 }
2923
2925 components, embedding, pair_embedding, verbose_level - 3);
2926
2927 // we think of FQ as two dimensional vector space
2928 // over Fq with basis (1,alpha)
2929 // for i,j \in Fq, with x = i + j * alpha \in FQ, we have
2930 // pair_embedding[i * q + j] = x;
2931 // also,
2932 // components[x * 2 + 0] = i;
2933 // components[x * 2 + 1] = j;
2934 // also, for i \in Fq, embedding[i] is the element
2935 // in FQ that corresponds to i
2936
2937 // components[Q * 2]
2938 // embedding[q]
2939 // pair_embedding[q * q]
2940
2941 if (f_vv) {
2942 FQ->print_embedding(*Fq,
2943 components, embedding, pair_embedding);
2944 }
2945
2946
2947 sz4 = 0;
2948 for (i = 0; i < sz2; i++) {
2949 if (f_vv) {
2950 cout << "geometry_global::andre_preimage "
2951 "input point " << i << " : ";
2952 }
2953 P2->unrank_point(v, set2[i]);
2954 FQ->PG_element_normalize(v, 1, 3);
2955 if (f_vv) {
2956 Int_vec_print(cout, v, 3);
2957 cout << " becomes ";
2958 }
2959
2960 if (v[2] == 0) {
2961
2962 // we are dealing with a point on the
2963 // line at infinity.
2964 // Such a point corresponds to a line of the spread.
2965 // We create the line and then create all
2966 // q + 1 points on that line.
2967
2968 if (f_vv) {
2969 cout << endl;
2970 }
2971 // w1[4] is the GF(q)-vector corresponding
2972 // to the GF(q^2)-vector v[2]
2973 // w2[4] is the GF(q)-vector corresponding
2974 // to the GF(q^2)-vector v[2] * alpha
2975 // where v[2] runs through the points of PG(1,q^2).
2976 // That way, w1[4] and w2[4] are a GF(q)-basis for the
2977 // 2-dimensional subspace v[2] (when viewed over GF(q)),
2978 // which is an element of the regular spread.
2979
2980 for (h = 0; h < 2; h++) {
2981 a = v[h];
2982 a0 = components[a * 2 + 0];
2983 a1 = components[a * 2 + 1];
2984 b = FQ->mult(a, alpha);
2985 b0 = components[b * 2 + 0];
2986 b1 = components[b * 2 + 1];
2987 w1[2 * h + 0] = a0;
2988 w1[2 * h + 1] = a1;
2989 w2[2 * h + 0] = b0;
2990 w2[2 * h + 1] = b1;
2991 }
2992 if (FALSE) {
2993 cout << "w1=";
2994 Int_vec_print(cout, w1, 4);
2995 cout << "w2=";
2996 Int_vec_print(cout, w2, 4);
2997 cout << endl;
2998 }
2999
3000 // now we create all points on the line
3001 // spanned by w1[4] and w2[4]:
3002 // There are q + 1 of these points.
3003 // We make sure that the coordinate vectors
3004 // have a zero in the last spot.
3005
3006 for (h = 0; h < q + 1; h++) {
3007 Fq->PG_element_unrank_modified(v2, 1, 2, h);
3008 if (FALSE) {
3009 cout << "v2=";
3010 Int_vec_print(cout, v2, 2);
3011 cout << " : ";
3012 }
3013 for (k = 0; k < 4; k++) {
3014 w3[k] = Fq->add(Fq->mult(v2[0], w1[k]),
3015 Fq->mult(v2[1], w2[k]));
3016 }
3017 w3[4] = 0;
3018 if (f_vv) {
3019 cout << " ";
3020 Int_vec_print(cout, w3, 5);
3021 }
3022 a = P4->rank_point(w3);
3023 if (f_vv) {
3024 cout << " rank " << a << endl;
3025 }
3026 set4[sz4++] = a;
3027 }
3028 }
3029 else {
3030
3031 // we are dealing with an affine point:
3032 // We make sure that the coordinate vector
3033 // has a zero in the last spot.
3034
3035
3036 for (h = 0; h < 2; h++) {
3037 a = v[h];
3038 a0 = components[a * 2 + 0];
3039 a1 = components[a * 2 + 1];
3040 w1[2 * h + 0] = a0;
3041 w1[2 * h + 1] = a1;
3042 }
3043 w1[4] = 1;
3044 if (f_vv) {
3045 //cout << "w1=";
3046 Int_vec_print(cout, w1, 5);
3047 }
3048 a = P4->rank_point(w1);
3049 if (f_vv) {
3050 cout << " rank " << a << endl;
3051 }
3052 set4[sz4++] = a;
3053 }
3054 }
3055 if (f_v) {
3056 cout << "geometry_global::andre_preimage "
3057 "we found " << sz4 << " points:" << endl;
3058 Lint_vec_print(cout, set4, sz4);
3059 cout << endl;
3060 P4->print_set(set4, sz4);
3061 for (i = 0; i < sz4; i++) {
3062 cout << set4[i] << " ";
3063 }
3064 cout << endl;
3065 }
3066
3067
3068 FREE_int(components);
3069 FREE_int(embedding);
3070 FREE_int(pair_embedding);
3071 if (f_v) {
3072 cout << "geometry_global::andre_preimage done" << endl;
3073 }
3074}
3075
3076
3077
3078}}}
3079
information about the Eckardt points of a surface derived from a six-arc
void init(geometry::projective_space *P2, long int *arc6, int verbose_level)
void init5(int *v, int a0, int a1, int a2, int a3, int a4)
Definition: int_vec.cpp:264
void set_print(std::ostream &ost, int *v, int len)
Definition: int_vec.cpp:1043
data structure for set partitions following Jeffrey Leon
void split_cell_front_or_back(int *set, int set_size, int f_front, int verbose_level)
void split_line_cell_front_or_back(int *set, int set_size, int f_front, int verbose_level)
a collection of functions related to sorted vectors
void print_matrix_latex(std::ostream &ost, int *A, int m, int n)
void PG_element_unrank_modified(int *v, int stride, int len, int a)
void finite_field_init(int q, int f_without_tables, int verbose_level)
void init_override_polynomial(int q, std::string &poly, int f_without_tables, int verbose_level)
void subfield_embedding_2dimensional(finite_field &subfield, int *&components, int *&embedding, int *&pair_embedding, int verbose_level)
void print_embedding(finite_field &subfield, int *components, int *embedding, int *pair_embedding)
void PG_element_rank_modified_lint(int *v, int stride, int len, long int &a)
a finite field as a vector space over a subfield
void init(finite_field *FQ, finite_field *Fq, int verbose_level)
void init_ovoid_Uab_even(int a, int b, int verbose_level)
void init(field_theory::finite_field *Fq, field_theory::finite_field *FQ, int f_Uab, int a, int b, int f_classical, int verbose_level)
void init(int n, int m, int s, field_theory::subfield_structure *SubS, int verbose_level)
various functions related to geometries
Definition: geometry.h:721
void do_create_desarguesian_spread(field_theory::finite_field *FQ, field_theory::finite_field *Fq, int m, int verbose_level)
void create_BLT_point(field_theory::finite_field *F, int *v5, int a, int b, int c, int verbose_level)
void hyperplane_lifting_with_two_lines_moved(projective_space *P, long int line1_from, long int line1_to, long int line2_from, long int line2_to, int *A4, int verbose_level)
int test_nb_Eckardt_points(projective_space *P2, long int *S, int len, int pt, int nb_E, int verbose_level)
void do_cheat_sheet_hermitian(field_theory::finite_field *F, int projective_dimension, int verbose_level)
void AG_element_unrank(int q, int *v, int stride, int len, long int a)
void create_Fisher_BLT_set(long int *Fisher_BLT, int *ABC, field_theory::finite_field *FQ, field_theory::finite_field *Fq, int verbose_level)
void do_transversal(field_theory::finite_field *F, std::string &line_1_basis, std::string &line_2_basis, std::string &point, int f_normalize_from_the_left, int f_normalize_from_the_right, int verbose_level)
void latex_homogeneous_equation(field_theory::finite_field *F, int degree, int nb_vars, std::string &equation_text, std::string &symbol_txt, std::string &symbol_tex, int verbose_level)
int test_if_arc(field_theory::finite_field *Fq, int *pt_coords, int *set, int set_sz, int k, int verbose_level)
algebraic_geometry::eckardt_point_info * compute_eckardt_point_info(projective_space *P2, long int *arc6, int verbose_level)
void do_intersection_of_two_lines(field_theory::finite_field *F, std::string &line_1_basis, std::string &line_2_basis, int f_normalize_from_the_left, int f_normalize_from_the_right, int verbose_level)
void AG_element_rank_longinteger(int q, int *v, int stride, int len, ring_theory::longinteger_object &a)
void do_inverse_isomorphism_klein_quadric(field_theory::finite_field *F, std::string &inverse_isomorphism_klein_quadric_matrix_A6, int verbose_level)
void andre_preimage(projective_space *P2, projective_space *P4, long int *set2, int sz2, long int *set4, int &sz4, int verbose_level)
void find_two_lines_for_arc_lifting(projective_space *P, long int P1, long int P2, long int &line1, long int &line2, int verbose_level)
void AG_element_unrank_longinteger(int q, int *v, int stride, int len, ring_theory::longinteger_object &a)
void add_term(int n, field_theory::finite_field &F, int &nb_terms, int *form_i, int *form_j, int *form_coeff, int *Gram, int i, int j, int coeff)
void print_quadratic_form_list_coded(int form_nb_terms, int *form_i, int *form_j, int *form_coeff)
void create_decomposition_of_projective_plane(std::string &fname_base, projective_space *P, long int *points, int nb_points, long int *lines, int nb_lines, int verbose_level)
void do_rank_points_in_PG(field_theory::finite_field *F, std::string &label, int verbose_level)
long int nb_PG_elements_not_in_subspace(int n, int m, int q)
void rearrange_arc_for_lifting(long int *Arc6, long int P1, long int P2, int partition_rk, long int *arc, int verbose_level)
int AG_element_next(int q, int *v, int stride, int len)
void do_cheat_sheet_Gr(field_theory::finite_field *F, int n, int k, int verbose_level)
void do_cheat_sheet_PG(field_theory::finite_field *F, graphics::layered_graph_draw_options *O, int n, int verbose_level)
long int nb_pts_Qepsilon(int epsilon, int k, int q)
void create_Mondello_BLT_set(long int *BLT, int *ABC, field_theory::finite_field *FQ, field_theory::finite_field *Fq, int verbose_level)
void make_Gram_matrix_from_list_coded_quadratic_form(int n, field_theory::finite_field &F, int nb_terms, int *form_i, int *form_j, int *form_coeff, int *Gram)
long int AG_element_rank(int q, int *v, int stride, int len)
void create_Linear_BLT_set(long int *BLT, int *ABC, field_theory::finite_field *FQ, field_theory::finite_field *Fq, int verbose_level)
void hyperplane_lifting_with_two_lines_fixed(projective_space *P, int *A3, int f_semilinear, int frobenius, long int line1, long int line2, int *A4, int verbose_level)
void create_Buekenhout_Metz(field_theory::finite_field *Fq, field_theory::finite_field *FQ, int f_classical, int f_Uab, int parameter_a, int parameter_b, std::string &fname, int &nb_pts, long int *&Pts, int verbose_level)
void init(field_theory::finite_field *F, int nb_vars, int verbose_level)
Definition: hermitian.cpp:73
interface for various incidence geometries
Definition: geometry.h:1099
void get_and_print_row_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, data_structures::partitionstack &PStack)
void init_projective_space(projective_space *P, int verbose_level)
void get_and_print_column_tactical_decomposition_scheme_tex(std::ostream &ost, int f_enter_math, int f_print_subscripts, data_structures::partitionstack &PStack)
void compute_TDO_safe(data_structures::partitionstack &PStack, int depth, int verbose_level)
the Klein correspondence between lines in PG(3,q) and points on the Klein quadric
Definition: geometry.h:1353
void init(field_theory::finite_field *F, orthogonal_geometry::orthogonal *O, int verbose_level)
void reverse_isomorphism(int *A6, int *A4, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
void conic_points(long int *five_pts, int *six_coeffs, long int *points, int &nb_points, int verbose_level)
int determine_conic_in_plane(long int *input_pts, int nb_pts, int *six_coeffs, int verbose_level)
void create_latex_report_for_Grassmannian(int k, 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)
options for drawing an object of type layered_graph
Definition: graphics.h:457
void mult_vector_from_the_left(int *v, int *A, int *vA, int m, int n)
void linear_combination_of_three_vectors(int a, int *A, int b, int *B, int c, int *C, int *D, int len)
void transpose_matrix(int *A, int *At, int ma, int na)
void mult_vector_from_the_right(int *A, int *v, int *Av, int m, int n)
void linear_combination_of_vectors(int a, int *A, int b, int *B, int *C, int len)
void invert_matrix_memory_given(int *A, int *A_inv, int n, int *tmp_A, int *tmp_basecols, int verbose_level)
int perp_standard(int n, int k, int *A, int verbose_level)
void Gauss_step_make_pivot_one(int *v1, int *v2, int len, int idx, int verbose_level)
int Gauss_easy_memory_given(int *A, int m, int n, int *base_cols)
void get_matrix_from_label(std::string &label, int *&v, int &m, int &n)
void init(int epsilon, int n, field_theory::finite_field *F, int verbose_level)
Definition: orthogonal.cpp:312
Penttila's unusual model to create BLT-sets.
Definition: orthogonal.h:676
void create_Mondello_BLT_set(long int *BLT, int *ABC, int verbose_level)
void create_Linear_BLT_set(long int *BLT, int *ABC, int verbose_level)
void setup(field_theory::finite_field *FQ, field_theory::finite_field *Fq, int verbose_level)
void create_Fisher_BLT_set(long int *Fisher_BLT, int *ABC, int verbose_level)
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)
void remake_symbols(int symbol_offset, const char *symbol_mask, const char *symbol_mask_latex, int verbose_level)
domain to compute with objects of type longinteger
Definition: ring_theory.h:240
void integral_division_by_int(longinteger_object &a, int b, longinteger_object &q, int &r)
void mult(longinteger_object &a, longinteger_object &b, longinteger_object &c)
a class to represent arbitrary precision integers
Definition: ring_theory.h:366
void create(long int i, const char *file, int line)
#define Lint_vec_copy(A, B, C)
Definition: foundations.h:694
#define Int_vec_scan(A, B, C)
Definition: foundations.h:716
#define FREE_int(p)
Definition: foundations.h:640
#define Int_vec_zero(A, B)
Definition: foundations.h:713
#define NEW_OBJECT(type)
Definition: foundations.h:638
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_OBJECT(p)
Definition: foundations.h:651
#define NEW_int(n)
Definition: foundations.h:625
#define Int_vec_print_integer_matrix_width(A, B, C, D, E, F)
Definition: foundations.h:691
#define Int_matrix_print(A, B, C)
Definition: foundations.h:707
#define TRUE
Definition: foundations.h:231
#define FALSE
Definition: foundations.h:234
#define EVEN(x)
Definition: foundations.h:221
#define ODD(x)
Definition: foundations.h:222
#define Int_vec_copy(A, B, C)
Definition: foundations.h:693
#define NEW_lint(n)
Definition: foundations.h:628
#define Int_vec_print(A, B, C)
Definition: foundations.h:685
#define MAXIMUM(x, y)
Definition: foundations.h:217
#define Choose2(x)
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects