15namespace layer1_foundations {
21 int f_v = (verbose_level >= 1);
22 int f_vv = (verbose_level >= 2);
25 int u, v, o, e = 0, loe, p0,
a, i, y1, y2;
26 int slope, b, x, f_slope, f_b, f_x;
27 int f_found_quadrangle =
FALSE;
32 cout <<
"is_desarguesian_plane plane_order ="
38 cout <<
"line " << line <<
" ";
44 cout <<
"choosing points u=" << u <<
" and v=" << v
45 <<
" on line " << line << endl;
47 for (o = 0; o <
nb_pts; o++) {
52 for (e = 0; e <
nb_pts; e++) {
72 f_found_quadrangle =
TRUE;
75 if (f_found_quadrangle)
78 if (!f_found_quadrangle) {
79 cout <<
"did not find a quadrangle, something is wrong" << endl;
83 cout <<
"found quadrangle (" << o <<
"," << e
84 <<
"," << u <<
"," << v <<
")";
88 cout <<
"plane coordinatized" << endl;
98 cout <<
"plane order not a power of a prime." << endl;
103 cout <<
"plane order is not prime:" << endl;
111 cout <<
"plane order is prime" << endl;
122 cout <<
"field element " << i <<
" = " <<
a << endl;
141 cout <<
"the plane is not desarguesian:" << endl;
142 cout <<
"slope = " << slope << endl;
143 cout <<
"f_slope = " << f_slope << endl;
144 cout <<
"b = " << b << endl;
145 cout <<
"f_b = " << f_b << endl;
146 cout <<
"x = " << x << endl;
147 cout <<
"f_x = " << f_x << endl;
148 cout <<
"y1 = " << y1 << endl;
149 cout <<
"y2 = " << y2 << endl;
150 cout <<
"a = " <<
a << endl;
159 cout <<
"the plane is desarguesian" << endl;
166 cout <<
"point_line::identify_field_not_of_prime_order "
167 "not yet implemented" << endl;
172 int i, j, k, ii, jj, kk,
a;
176 int *canonical_form1;
177 int *canonical_form_inv1;
178 permutation_group_generators Aut_gens1;
181 longinteger_object ago1;
183 int *canonical_form2;
184 int *canonical_form_inv2;
185 permutation_group_generators Aut_gens2;
188 longinteger_object ago2;
191 int nb_row_parts = 3;
192 int nb_col_parts = 3;
208 canonical_form1 =
NEW_int(mpn);
209 canonical_form_inv1 =
NEW_int(mpn);
212 canonical_form2 =
NEW_int(mpn);
213 canonical_form_inv2 =
NEW_int(mpn);
216 for (i = 0; i <
m; i++) {
217 for (j = 0; j <
n; j++) {
221 for (i = 0; i < 3; i++) {
222 for (j = 0; j < d; j++) {
223 M1[(i * d + j) *
n + j] = 1;
228 for (i = 0; i < d; i++) {
229 for (j = 0; j < d; j++) {
231 M1[i *
n + d + i * d + j] = 1;
233 M1[(d + j) *
n + d + i * d + j] = 1;
235 M1[(2 * d +
a) *
n + d + i * d + j] = 1;
239 for (i = 0; i < d; i++) {
240 for (j = 0; j < d; j++) {
242 M1[i *
n + d + d2 + i * d + j] = 1;
244 M1[(d + j) *
n + d + d2 + i * d + j] = 1;
246 M1[(2 * d +
a) *
n + d + d2 + i * d + j] = 1;
251 cout <<
"computing canonical labelling of the planar ternary ring of order " <<
plane_order << endl;
255 compute_canonical_labeling_of_01matrix(M1,
m,
n,
256 TRUE, row_parts, nb_row_parts, col_parts, nb_col_parts,
257 canonical_form1, canonical_form_inv1,
262 Aut_gens1.compute_group_order(ago1);
264 cout <<
"the planar ternanry ring does not have the right number of automorphisms, not desarguesian" << endl;
270 cout <<
"setting up the field of order " <<
plane_order << endl;
274 for (i = 0; i <
m; i++) {
275 for (j = 0; j <
n; j++) {
279 for (i = 0; i < 3; i++) {
280 for (j = 0; j < d; j++) {
281 M2[(i * d + j) *
n + j] = 1;
286 for (i = 0; i < d; i++) {
287 for (j = 0; j < d; j++) {
289 M2[i *
n + d + i * d + j] = 1;
291 M2[(d + j) *
n + d + i * d + j] = 1;
293 M2[(2 * d +
a) *
n + d + i * d + j] = 1;
297 for (i = 0; i < d; i++) {
298 for (j = 0; j < d; j++) {
300 M2[i *
n + d + d2 + i * d + j] = 1;
302 M2[(d + j) *
n + d + d2 + i * d + j] = 1;
304 M2[(2 * d +
a) *
n + d + d2 + i * d + j] = 1;
309 cout <<
"computing canonical labelling of the field of order " <<
plane_order << endl;
312 compute_canonical_labeling_of_01matrix(M2,
m,
n,
313 TRUE, row_parts, nb_row_parts, col_parts, nb_col_parts,
314 canonical_form2, canonical_form_inv2,
318 Aut_gens2.compute_group_order(ago2);
320 cout <<
"the field does not have the right number of automorphisms, something is wrong" << endl;
323 for (i = 0; i < d; i++) {
324 a = canonical_form1[canonical_form_inv2[i]];
330 cout <<
"field element " << i <<
" = " <<
field_element[i] << endl;
334 cout <<
"field_element[0] != 0, something is wrong" << endl;
338 cout <<
"field_element[1] != 1, something is wrong" << endl;
350 cout <<
"i=" << i <<
" j=" << j <<
" i+j=" << k << endl;
351 cout <<
"ii=" << ii <<
" jj=" << jj <<
" ii+jj=" << kk << endl;
358 cout <<
"i=" << i <<
" j=" << j <<
" i*j=" << k << endl;
359 cout <<
"ii=" << ii <<
" jj=" << jj <<
" ii*jj=" << kk << endl;
384 int f_v = (verbose_level >= 1);
389 cout <<
"computing data for a projective plane of order "
390 << order <<
" with " <<
m <<
" points" << endl;
396 for (i = 0; i <
nb_pts; i++) {
400 for (i = 0; i <
nb_pts; i++) {
402 for (j = i + 1; j <
nb_pts; j++) {
411 for (i = 0; i <
nb_pts; i++) {
415 for (i = 0; i <
nb_pts; i++) {
417 for (j = i + 1; j <
nb_pts; j++) {
425 cout <<
"allocating data for the coordinatization" << endl;
441 cout <<
"finished" << endl;
472 ost <<
"lines on points:" << endl;
473 ost <<
"pt : lines through pt" << endl;
474 for (i = 0; i <
m; i++) {
483 ost <<
"points on lines:" << endl;
484 ost <<
"line : pts on line" << endl;
485 for (i = 0; i <
m; i++) {
494 ost <<
"lines through two points:" << endl;
495 ost <<
"pt_1, pt_2 : line through pt_1 and pt_2" << endl;
496 for (i = 0; i <
m; i++) {
497 for (j = i + 1; j <
m; j++) {
499 ost << i <<
", " << j <<
" & " << h << endl;
502 ost <<
"intersections of lines:" << endl;
503 ost <<
"line_1, line_2 : point of intersection" << endl;
504 for (i = 0; i <
m; i++) {
505 for (j = i + 1; j <
m; j++) {
507 ost << i <<
", " << j <<
" & " << h << endl;
516 cout <<
"point_line::plane_line_through_two_points "
517 "pts are equal" << endl;
526 for (j = 0; j <
n; j++) {
527 if (
a[pt1 *
n + j] &&
a[pt2 *
n + j])
530 cout <<
"point_line::plane_line_through_two_points "
531 "there is no line through pt1=" << pt1
532 <<
" and pt2=" << pt2 << endl;
539 if (line1 == line2) {
540 cout <<
"point_line::plane_line_intersection "
541 "lines are equal" << endl;
550 for (i = 0; i <
m; i++) {
551 if (
a[i *
n + line1] &&
a[i *
n + line2])
554 cout <<
"point_line::plane_line_intersection "
555 "there is no common point to line1=" << line1
556 <<
" and line2=" << line2 << endl;
574 for (i = 0; i <
m; i++) {
575 if (
a[i *
n + line]) {
580 cout <<
"point_line::plane_get_points_on_line "
581 "l != plane_order + 1" << endl;
600 for (j = 0; j <
m; j++) {
606 cout <<
"point_line::plane_get_lines_through_point "
607 "l != plane_order + 1" << endl;
617 if (
a[pt3 *
n + line])
627 if (
a[pt *
n + line3])
643 cout <<
"point_line::plane_first_quadrangle "
644 "no quadrangle" << endl;
685 for (pt[i] = pt0; pt[i] < v; pt[i]++) {
746 int *MOLS,
int verbose_level)
750 int f_v = (verbose_level >= 1);
751 int i, j, ii, jj, x, y, l, pt, line, pt2, pt3, b, pt_label;
765 cout <<
"coordinatizing plane with O=" << O
766 <<
" I=" << I <<
" X=" << X <<
" Y=" << Y << endl;
768 cout <<
"m=" <<
m << endl;
806 cout <<
"points on line y=x:" << endl;
840 cout <<
"the affine points (x,y):" << endl;
843 cout <<
"(" << x <<
", " << y <<
")="
851 cout <<
"the points at infinity:" << endl;
860 cout <<
"y=" << y <<
" pt " << pt2 << endl;
866 cout <<
"all point labels:" << endl;
867 for (i = 0; i <
m; i++) {
868 cout << i <<
" : " <<
pt_labels[i] << endl;
930 if (slope == 0 || x == 0)
945 cout <<
"finished" << endl;
966 int f_v = (verbose_level >= 1);
967 int x,
m, b, y1, mx, y2;
968 int *addition =
MOLS;
979 cout <<
"not linear:" << endl;
980 cout <<
"m=" <<
m << endl;
981 cout <<
"x=" << x << endl;
982 cout <<
"b=" << b << endl;
983 cout <<
"y1=" << y1 << endl;
984 cout <<
"mx=" << mx << endl;
985 cout <<
"y2=" << y2 << endl;
999 ost <<
"all mutually orthogonal latin squares:" << endl;
1000 ost <<
"addition:" << endl;
1009 ost <<
"multiplication:" << endl;
1019 ost <<
"for slope=" << slope << endl;
1032 int &order,
int verbose_level)
1036 int f_v = (verbose_level >= 1);
1037 int f_vv = (verbose_level >= 2);
1038 int v,
n, r, k, lambda, mu;
1041 cout <<
"point_line::is_projective_plane checking for projective plane:" << endl;
1045 cout <<
"not a projective plane: "
1046 "partition has more than two parts" << endl;
1052 cout <<
"not a projective plane: "
1053 "partition classes have different sizes" << endl;
1061 cout <<
"not a projective plane: "
1062 "r not constant" << endl;
1069 cout <<
"not a projective plane: "
1070 "k not constant" << endl;
1075 cout <<
"r = " << r << endl;
1076 cout <<
"k = " << k << endl;
1080 cout <<
"not a projective plane: r != k" << endl;
1086 cout <<
"not a projective plane: r < 3" << endl;
1091 if (v !=
n *
n +
n + 1) {
1093 cout <<
"not a projective plane: "
1094 "v != n^2 + n + 1" << endl;
1101 cout <<
"not a projective plane: "
1102 "rows are not joined correctly" << endl;
1109 cout <<
"not a projective plane: "
1110 "cols are not joined correctly" << endl;
1115 cout <<
"lambda = " << lambda << endl;
1116 cout <<
"mu = " << mu << endl;
1119 cout <<
"detected a projective plane of order " <<
n << endl;
1126 int row_cell,
int col_cell)
1128 int l1, i, nb = -1, nb1;
1131 for (i = 0; i < l1; i++) {
1133 row_cell, i, col_cell);
1148 int col_cell,
int row_cell)
1150 int l1, i, nb = -1, nb1;
1153 for (i = 0; i < l1; i++) {
1169 int row_cell,
int row_cell_pt,
int col_cell)
1171 int f1, f2, l2, e1, e2, j, s = 0;
1179 for (j = 0; j < l2; j++) {
1180 e2 =
P.
pointList[f2 + j] - first_column_element;
1189 int col_cell,
int col_cell_pt,
int row_cell)
1191 int f1, f2, l1, e1, e2, i, s = 0;
1198 e2 =
P.
pointList[f2 + col_cell_pt] - first_column_element;
1199 for (i = 0; i < l1; i++) {
1209 int row_cell1,
int row_cell2,
int col_cell)
1211 int l1, i, nb = -1, nb1;
1214 for (i = 0; i < l1; i++) {
1216 row_cell1, i, row_cell2, col_cell);
1231 int col_cell1,
int col_cell2,
int row_cell)
1233 int l1, i, nb = -1, nb1;
1236 for (i = 0; i < l1; i++) {
1238 col_cell1, i, col_cell2, row_cell);
1253 int row_cell1,
int row_cell_pt,
int row_cell2,
int col_cell)
1258 int f1, f2, f3, l2, l3, e1, e2, e3, u, j, nb = -1, nb1;
1268 for (u = 0; u < l2; u++) {
1273 for (j = 0; j < l3; j++) {
1274 e3 =
P.
pointList[f3 + j] - first_column_element;
1275 if (
a[e1 *
n + e3] &&
a[e2 *
n + e3]) {
1294 int col_cell1,
int col_cell_pt,
int col_cell2,
int row_cell)
1299 int f1, f2, f3, l2, l3, e1, e2, e3, u, i, nb = -1, nb1;
1308 e1 =
P.
pointList[f1 + col_cell_pt] - first_column_element;
1309 for (u = 0; u < l2; u++) {
1310 e2 =
P.
pointList[f2 + u] - first_column_element;
1314 for (i = 0; i < l3; i++) {
1316 if (
a[e3 *
n + e1] &&
a[e3 *
n + e2]) {
1336 int x, b, y, *mol =
MOLS +
m * order * order;
1339 for (x = 0; x < order; x++) {
1340 for (b = 0; b < order; b++) {
1341 y = mol[x * order + b];
1342 M[x * order + b] = y;
void set_print(std::ostream &ost, int *v, int len)
data structure for set partitions following Jeffrey Leon
int count_pairs_CCR(data_structures::partitionstack &P, int col_cell1, int col_cell2, int row_cell)
struct plane_data dual_plane
void init_projective_plane(int order, int verbose_level)
void plane_get_lines_through_point(int pt, int *lines)
int & MOLSmultiplication(int a, int b)
int plane_quadrangle_next_i(int *pt, int i)
int * pts_on_line_x_eq_y_labels
int count_pairs_CCR_representative(data_structures::partitionstack &P, int col_cell1, int col_cell_pt, int col_cell2, int row_cell)
int ternary_field_is_linear(int *MOLS, int verbose_level)
data_structures::partitionstack * P
void free_projective_plane()
int count_CR_representative(data_structures::partitionstack &P, int col_cell, int col_cell_pt, int row_cell)
int count_CR(data_structures::partitionstack &P, int col_cell, int row_cell)
int & MOLSaddition(int a, int b)
void plane_report(std::ostream &ost)
int plane_next_quadrangle(int &pt1, int &pt2, int &pt3, int &pt4)
int is_desarguesian_plane(int verbose_level)
int f_plane_data_computed
void print_MOLS(std::ostream &ost)
int plane_quadrangle_first_i(int *pt, int i)
int & MOLSsxb(int s, int x, int b)
int count_RC_representative(data_structures::partitionstack &P, int row_cell, int row_cell_pt, int col_cell)
int plane_first_quadrangle(int &pt1, int &pt2, int &pt3, int &pt4)
int plane_line_intersection(int line1, int line2)
int count_pairs_RRC(data_structures::partitionstack &P, int row_cell1, int row_cell2, int col_cell)
void coordinatize_plane(int O, int I, int X, int Y, int *MOLS, int verbose_level)
int plane_lines_concurrent(int line1, int line2, int line3)
int is_projective_plane(data_structures::partitionstack &P, int &order, int verbose_level)
void plane_get_points_on_line(int line, int *pts)
void get_MOLm(int *MOLS, int order, int m, int *&M)
int plane_line_through_two_points(int pt1, int pt2)
int count_RC(data_structures::partitionstack &P, int row_cell, int col_cell)
int count_pairs_RRC_representative(data_structures::partitionstack &P, int row_cell1, int row_cell_pt, int row_cell2, int col_cell)
int identify_field_not_of_prime_order(int verbose_level)
int plane_points_collinear(int pt1, int pt2, int pt3)
basic number theoretic functions
int smallest_primedivisor(int n)
int i_power_j(int i, int j)
data_structures::int_vec * Int_vec
orbiter_kernel_system::orbiter_session * Orbiter
global Orbiter session
the orbiter library for the classification of combinatorial objects
int * line_through_two_points