Orbiter 2022
Combinatorial Objects
points_and_lines.cpp
Go to the documentation of this file.
1/*
2 * points_and_lines.cpp
3 *
4 * Created on: Feb 25, 2021
5 * Author: betten
6 */
7
8
9
10
11#include "foundations.h"
12
13
14using namespace std;
15
16
17namespace orbiter {
18namespace layer1_foundations {
19namespace geometry {
20
21
22
23
25{
26 P = NULL;
27
28 Pts = NULL;
29 nb_pts = 0;
30
31 Lines = NULL;
32 nb_lines = 0;
33
34}
35
37{
38 if (Pts) {
40 }
41 if (Lines) {
43 }
44}
45
47 std::vector<long int> &Points, int verbose_level)
48{
49 int f_v = (verbose_level >= 1);
50
51 if (f_v) {
52 cout << "points_and_lines::init" << endl;
53 }
54
56
57 vector<long int> The_Lines;
58
59 if (f_v) {
60 cout << "points_and_lines::init The surface "
61 "has " << Points.size() << " points" << endl;
62 }
63 int i;
64
65 nb_pts = Points.size();
67 for (i = 0; i < nb_pts; i++) {
68 Pts[i] = Points[i];
69 }
70
71
72 if (f_v) {
73 cout << "points_and_lines::init before "
74 "P->find_lines_which_are_contained" << endl;
75 }
76 P->find_lines_which_are_contained(Points, The_Lines, 0 /*verbose_level - 1*/);
77 if (f_v) {
78 cout << "points_and_lines::init after "
79 "P->find_lines_which_are_contained" << endl;
80 }
81
82 if (f_v) {
83 cout << "points_and_lines::init The surface "
84 "has " << The_Lines.size() << " lines" << endl;
85 }
86
87
88 nb_lines = The_Lines.size();
90 for (i = 0; i < nb_lines; i++) {
91 Lines[i] = The_Lines[i];
92 }
93
94 if (f_v) {
95 cout << "points_and_lines::init nb_pts=" << nb_pts << " nb_lines=" << nb_lines << endl;
96 cout << "Lines:";
98 cout << endl;
99 }
100
101
102 if (f_v) {
103 cout << "points_and_lines::init done" << endl;
104 }
105
106}
107
108void points_and_lines::unrank_point(int *v, long int rk)
109{
110 P->unrank_point(v, rk);
111}
112
114{
115 long int rk;
116
117 rk = P->rank_point(v);
118 return rk;
119}
120
121
122
124{
125 //latex_interface L;
126 //int i;
127 //int v[4];
128
129 //ost << "\\clearpage" << endl;
130 ost << "The surface has " << nb_pts << " points:\\\\" << endl;
131
132 if (nb_pts < 1000) {
133 //ost << "$$" << endl;
134 //L.lint_vec_print_as_matrix(ost, SO->Pts, SO->nb_pts, 10, TRUE /* f_tex */);
135 //ost << "$$" << endl;
136 //ost << "\\clearpage" << endl;
137 ost << "The points on the surface are:\\\\" << endl;
138 ost << "\\begin{multicols}{3}" << endl;
139 ost << "\\noindent" << endl;
140 int i;
141 int v[4];
142
143 for (i = 0; i < nb_pts; i++) {
144 unrank_point(v, Pts[i]);
145 ost << i << " : $P_{" << Pts[i] << "}=";
146 Int_vec_print_fully(ost, v, 4);
147 ost << "$\\\\" << endl;
148 }
149 ost << "\\end{multicols}" << endl;
151 ost << "\\\\" << endl;
152 }
153 else {
154 ost << "Too many to print.\\\\" << endl;
155 }
156}
157
159{
160 ost << "\\subsection*{The " << nb_lines << " Lines}" << endl;
161 print_lines_tex(ost);
162}
163
165{
166 int i;
168 long int *Rk;
169
170 Rk = NEW_lint(nb_lines);
171
172 ost << "The lines and their Pluecker coordinates are:\\\\" << endl;
173
174 for (i = 0; i < nb_lines; i++) {
175 //fp << "Line " << i << " is " << v[i] << ":\\\\" << endl;
176 P->Grass_lines->unrank_lint(Lines[i], 0 /*verbose_level*/);
177 ost << "$$" << endl;
178 ost << "\\ell_{" << i << "}";
179
180#if 0
181 if (nb_lines == 27) {
182 ost << " = " << Schlaefli->Line_label_tex[i];
183 }
184#endif
185 ost << " = " << endl;
186 //print_integer_matrix_width(cout,
187 // Gr->M, k, n, n, F->log10_of_q + 1);
189 //print_integer_matrix_tex(ost, Gr->M, 2, 4);
190 //ost << "\\right]_{" << Lines[i] << "}" << endl;
191 ost << "_{" << Lines[i] << "}" << endl;
192 ost << "=" << endl;
193 ost << "\\left[" << endl;
194 L.print_integer_matrix_tex(ost, P->Grass_lines->M, 2, 4);
195 ost << "\\right]_{" << Lines[i] << "}" << endl;
196
197 int v6[6];
198
199 P->Pluecker_coordinates(Lines[i], v6, 0 /* verbose_level */);
200
201 Rk[i] = P->F->Orthogonal_indexing->Qplus_rank(v6, 1, 5, 0 /* verbose_level*/);
202
203 ost << "={\\rm\\bf Pl}(" << v6[0] << "," << v6[1] << ","
204 << v6[2] << "," << v6[3] << "," << v6[4]
205 << "," << v6[5] << " ";
206 ost << ")_{" << Rk[i] << "}";
207 ost << "$$" << endl;
208 }
209 ost << "Rank of lines: ";
211 ost << "\\\\" << endl;
212 ost << "Rank of points on Klein quadric: ";
213 Lint_vec_print(ost, Rk, nb_lines);
214 ost << "\\\\" << endl;
215
216 FREE_lint(Rk);
217
218}
219
220void points_and_lines::write_points_to_txt_file(std::string &label, int verbose_level)
221{
222 int f_v = (verbose_level >= 1);
223
224 if (f_v) {
225 cout << "points_and_lines::write_points_to_txt_file" << endl;
226 }
227 string fname;
228 fname.assign(label);
229 fname.append("_points.txt");
230
232
233 {
234 ofstream ost(fname);
235 int i;
236 ost << nb_pts;
237 for (i = 0; i < nb_pts; i++) {
238 ost << " " << Pts[i];
239 }
240 ost << endl;
241 ost << -1 << endl;
242 }
243 cout << "Written file " << fname << " of size " << Fio.file_size(fname) << endl;
244
245 if (f_v) {
246 cout << "points_and_lines::write_points_to_txt_file done" << endl;
247 }
248}
249
250
251}}}
252
253
orthogonal_geometry::orthogonal_indexing * Orthogonal_indexing
void unrank_lint(long int rk, int verbose_level)
Definition: grassmann.cpp:343
void latex_matrix(std::ostream &ost, int *p)
Definition: grassmann.cpp:1200
void init(projective_space *P, std::vector< long int > &Points, int verbose_level)
void write_points_to_txt_file(std::string &label, int verbose_level)
projective space PG(n,q) of dimension n over Fq
Definition: geometry.h:1916
void Pluecker_coordinates(int line_rk, int *v6, int verbose_level)
void find_lines_which_are_contained(std::vector< long int > &Points, std::vector< long int > &Lines, int verbose_level)
void print_integer_matrix_tex(std::ostream &ost, int *p, int m, int n)
long int Qplus_rank(int *v, int stride, int k, int verbose_level)
#define Int_vec_print_fully(A, B, C)
Definition: foundations.h:687
#define Lint_vec_print(A, B, C)
Definition: foundations.h:686
#define FREE_lint(p)
Definition: foundations.h:642
#define NEW_lint(n)
Definition: foundations.h:628
#define Lint_vec_print_fully(A, B, C)
Definition: foundations.h:688
the orbiter library for the classification of combinatorial objects