void set_of_sets::compute_tdo_decomposition(decomposition &D, INT verbose_level) { INT f_v = (verbose_level >= 1); INT *Inc; INT m, n; //incidence_structure *I; //partitionstack *Stack; //INT depth = INT_MAX; if (f_v) { cout << "set_of_sets::compute_tdo_decomposition" << endl; } compute_incidence_matrix(Inc, m, n, verbose_level - 2); if (f_v) { cout << "set_of_sets::compute_tdo_decomposition after compute_incidence_matrix" << endl; cout << "underlying_set_size=" << underlying_set_size << endl; cout << "nb_sets=" << nb_sets << endl; } if (f_v) { INT_matrix_print(Inc, underlying_set_size, nb_sets); } if (f_v) { cout << "set_of_sets::compute_tdo_decomposition before D.init_incidence_matrix" << endl; } D.init_incidence_matrix(underlying_set_size, nb_sets, Inc, verbose_level - 1); FREE_INT(Inc); if (f_v) { cout << "set_of_sets::compute_tdo_decomposition before D.setup_default_partition" << endl; } D.setup_default_partition(verbose_level); if (f_v) { cout << "set_of_sets::compute_tdo_decomposition before D.compute_TDO" << endl; } D.compute_TDO(INT_MAX, verbose_level); #if 0 INT set_size = underlying_set_size; INT nb_blocks = nb_sets; I = new incidence_structure; I->init_by_matrix(set_size, nb_blocks, Inc, 0 /* verbose_level */); Stack = new partitionstack; Stack->allocate(set_size + nb_blocks, 0 /* verbose_level */); Stack->subset_continguous(set_size, nb_blocks); Stack->split_cell(0 /* verbose_level */); Stack->sort_cells(); I->compute_TDO_safe(*Stack, depth, verbose_level - 2); I->get_and_print_row_tactical_decomposition_scheme_tex( file, FALSE /* f_enter_math */, *Stack); FREE_INT(Inc); delete I; delete Stack; #endif if (f_v) { cout << "set_of_sets::compute_tdo_scheme done" << endl; } }
void klein_correspondence::init(finite_field *F, orthogonal *O, INT verbose_level) { INT f_v = (verbose_level >= 1); INT f_vv = (verbose_level >= 2); INT d = 6; INT i, u, v; if (f_v) { cout << "klein_correspondence::init" << endl; } klein_correspondence::F = F; klein_correspondence::O = O; q = F->q; nb_Pts = O->nb_points; P3 = new projective_space; P3->init(3, F, TRUE /* f_init_incidence_structure */, 0 /* verbose_level - 2 */); P5 = new projective_space; P5->init(5, F, TRUE /* f_init_incidence_structure */, 0 /* verbose_level - 2 */); Gr63 = new grassmann; Gr62 = new grassmann; Gr63->init(6, 3, F, 0 /* verbose_level */); Gr62->init(6, 2, F, 0 /* verbose_level */); Form = NEW_INT(d * d); INT_vec_zero(Form, d * d); // the matrix with blocks // [0 1] // [1 0] // along the diagonal: for (i = 0; i < 3; i++) { u = 2 * i + 0; v = 2 * i + 1; Form[u * d + v] = 1; Form[v * d + u] = 1; } if (f_v) { cout << "klein_correspondence::init Form matrix:" << endl; INT_matrix_print(Form, d, d); } Line_to_point_on_quadric = NEW_INT(P3->N_lines); Point_on_quadric_to_line = NEW_INT(P3->N_lines); Point_on_quadric_embedded_in_P5 = NEW_INT(P3->N_lines); INT basis_line[8]; // [2 * 4] INT v6[6]; INT *x4, *y4, a, b, c, val, j; //basis_line = NEW_INT(8); for (i = 0; i < P3->N_lines; i++) { Point_on_quadric_to_line[i] = -1; } for (i = 0; i < P3->N_lines; i++) { P3->unrank_line(basis_line, i); x4 = basis_line; y4 = basis_line + 4; v6[0] = F->Pluecker_12(x4, y4); v6[1] = F->Pluecker_34(x4, y4); v6[2] = F->Pluecker_13(x4, y4); v6[3] = F->Pluecker_42(x4, y4); v6[4] = F->Pluecker_14(x4, y4); v6[5] = F->Pluecker_23(x4, y4); a = F->mult(v6[0], v6[1]); b = F->mult(v6[2], v6[3]); c = F->mult(v6[4], v6[5]); val = F->add3(a, b, c); //cout << "a=" << a << " b=" << b << " c=" << c << endl; //cout << "val=" << val << endl; if (val) { cout << "klein_correspondence::init point does not lie on quadric" << endl; exit(1); } //j = P5->rank_point(v6); j = O->rank_point(v6, 1, 0 /* verbose_level */); if (FALSE) { cout << "klein_correspondence::init i=" << i << " / " << P3->N_lines << " v6 : "; INT_vec_print(cout, v6, 6); cout << " : j=" << j << endl; } Line_to_point_on_quadric[i] = j; Point_on_quadric_to_line[j] = i; } for (i = 0; i < P3->N_lines; i++) { if (Point_on_quadric_to_line[i] == -1) { cout << "Something is wrong with Point_on_quadric_to_line" << endl; exit(1); } } for (i = 0; i < P3->N_lines; i++) { O->unrank_point(v6, 1, i, 0); Point_on_quadric_embedded_in_P5[i] = P5->rank_point(v6); } coordinates_of_quadric_points = NEW_INT(P3->N_lines * d); Pt_rk = NEW_INT(P3->N_lines); for (i = 0; i < P3->N_lines; i++) { O->unrank_point(coordinates_of_quadric_points + i * d, 1, i, 0); INT_vec_copy(coordinates_of_quadric_points + i * d, v6, 6); PG_element_rank_modified(*F, v6, 1, d, a); Pt_rk[i] = a; } if (f_vv) { cout << "Points on the Klein quadric:" << endl; if (nb_Pts < 50) { for (i = 0; i < nb_Pts; i++) { cout << i << " : "; INT_vec_print(cout, coordinates_of_quadric_points + i * d, d); cout << " : " << Pt_rk[i] << endl; } } else { cout << "too many points to print" << endl; } } nb_pts_PG = nb_PG_elements(d - 1, q); if (f_v) { cout << "klein_correspondence::init nb_pts_PG = " << nb_pts_PG << endl; } Pt_idx = NEW_INT(nb_pts_PG); for (i = 0; i < nb_pts_PG; i++) { Pt_idx[i] = -1; } for (i = 0; i < nb_Pts; i++) { a = Pt_rk[i]; Pt_idx[a] = i; } if (f_v) { cout << "klein_correspondence::init done" << endl; } }
void solve_diophant(INT *Inc, INT nb_rows, INT nb_cols, INT nb_needed, INT f_has_Rhs, INT *Rhs, INT *&Solutions, INT &nb_sol, INT &nb_backtrack, INT &dt, INT f_DLX, INT f_draw_system, const BYTE *fname_system, INT f_write_tree, const BYTE *fname_tree, INT verbose_level) // allocates Solutions[nb_sol * nb_needed] { INT f_v = (verbose_level >= 1); //INT f_v4 = FALSE; //(verbose_level >= 2); //INT i, j; diophant *Dio; INT t0 = os_ticks(); if (f_v) { cout << "solve_diophant nb_rows=" << nb_rows << " nb_cols=" << nb_cols << " f_has_Rhs=" << f_has_Rhs << " verbose_level=" << verbose_level << endl; cout << "f_write_tree=" << f_write_tree << endl; cout << "f_DLX=" << f_DLX << endl; //INT_matrix_print(Inc, nb_rows, nb_cols); } Dio = new diophant; if (f_has_Rhs) { Dio->init_problem_of_Steiner_type_with_RHS(nb_rows, nb_cols, Inc, nb_needed, Rhs, 0 /* verbose_level */); } else { Dio->init_problem_of_Steiner_type(nb_rows, nb_cols, Inc, nb_needed, 0 /* verbose_level */); } if (f_draw_system) { INT xmax_in = 1000000; INT ymax_in = 1000000; INT xmax_out = 1000000; INT ymax_out = 1000000; if (f_v) { cout << "solve_diophant drawing the system" << endl; } Dio->draw_it(fname_system, xmax_in, ymax_in, xmax_out, ymax_out); if (f_v) { cout << "solve_diophant drawing the system done" << endl; } } if (FALSE /*f_v4*/) { Dio->print(); } if (f_DLX && !f_has_Rhs) { Dio->solve_all_DLX(f_write_tree, fname_tree, 0 /* verbose_level*/); nb_backtrack = Dio->nb_steps_betten; } else { diophant_solve_all_mckay(Dio, nb_backtrack, verbose_level - 2); } nb_sol = Dio->_resultanz; if (nb_sol) { Dio->get_solutions(Solutions, nb_sol, 1 /* verbose_level */); if (FALSE /*f_v4*/) { cout << "Solutions:" << endl; INT_matrix_print(Solutions, nb_sol, nb_needed); } } else { Solutions = NULL; } delete Dio; INT t1 = os_ticks(); dt = t1 - t0; if (f_v) { cout << "solve_diophant done nb_sol=" << nb_sol << " nb_backtrack=" << nb_backtrack << " dt=" << dt << endl; } }
void desarguesian_spread::calculate_spread_elements(INT verbose_level) { INT f_v = (verbose_level >= 1); INT f_vv = (verbose_level >= 2); INT *v; INT *w; INT *z; INT h, i, j, a, b, c, J, t; if (f_v) { cout << "desarguesian_spread::calculate_spread_elements" << endl; } spread_element_size = s * n; Spread_elements = NEW_INT(N * spread_element_size); v = NEW_INT(m); w = NEW_INT(m); z = NEW_INT(s * n); for (h = 0; h < N; h++) { if (f_vv) { cout << "h=" << h << " / " << N << endl; } PG_element_unrank_modified(*FQ, v, 1, m, h); if (f_vv) { INT_vec_print(cout, v, m); cout << endl; } for (i = 0; i < s; i++) { if (FALSE) { cout << "i=" << i << " / " << s << endl; } // multiply by the i-th basis element, put into the vector w[m] a = SubS->Basis[i]; for (j = 0; j < m; j++) { b = v[j]; if (FALSE) { cout << "j=" << j << " / " << m << " a=" << a << " b=" << b << endl; } c = FQ->mult(b, a); w[j] = c; } for (j = 0; j < m; j++) { J = j * s; b = w[j]; for (t = 0; t < s; t++) { c = SubS->components[b * s + t]; z[i * n + J + t] = c; } } } if (f_vv) { cout << "basis element " << h << " / " << N << ":" << endl; INT_vec_print(cout, v, m); cout << endl; INT_matrix_print(z, s, n); } INT_vec_copy(z, Spread_elements + h * spread_element_size, spread_element_size); } FREE_INT(v); FREE_INT(w); FREE_INT(z); INT *Spread_elt_basis; INT rk; if (f_v) { cout << "desarguesian_spread::calculate_spread_elements computing List_of_points" << endl; } v = NEW_INT(s); w = NEW_INT(n); List_of_points = NEW_INT(N * nb_points_per_spread_element); for (h = 0; h < N; h++) { if (f_vv) { cout << "h=" << h << " / " << N << endl; } Spread_elt_basis = Spread_elements + h * spread_element_size; for (i = 0; i < nb_points_per_spread_element; i++) { PG_element_unrank_modified(*Fq, v, 1, s, i); Fq->mult_vector_from_the_left(v, Spread_elt_basis, w, s, n); PG_element_rank_modified(*Fq, w, 1, n, rk); List_of_points[h * nb_points_per_spread_element + i] = rk; } if (f_vv) { cout << "basis element " << h << " / " << N << ":" << endl; INT_matrix_print(Spread_elt_basis, s, n); cout << "Consists of the following points:" << endl; INT_vec_print(cout, List_of_points + h * nb_points_per_spread_element, nb_points_per_spread_element); cout << endl; } } FREE_INT(v); FREE_INT(w); if (f_v) { cout << "desarguesian_spread::calculate_spread_elements done" << endl; } }
int main(int argc, char **argv) { INT i, j; t0 = os_ticks(); INT verbose_level = 0; INT f_file = FALSE; const BYTE *fname = NULL; INT f_coordinates = FALSE; INT xmax_in = ONE_MILLION; INT ymax_in = ONE_MILLION; INT xmax_out = ONE_MILLION; INT ymax_out = ONE_MILLION; INT f_export_magma = FALSE; const BYTE *magma_fname = NULL; INT f_export_matlab = FALSE; const BYTE *matlab_fname = NULL; INT f_on_circle = FALSE; INT f_bitmatrix = FALSE; INT f_labels = FALSE; INT f_embedded = FALSE; INT f_sideways = FALSE; INT f_scale = FALSE; double scale = .45; INT f_line_width = FALSE; double line_width = 1.5; INT f_aut = FALSE; INT f_is_association_scheme = FALSE; INT f_all_cliques = FALSE; INT f_all_cocliques = FALSE; INT f_characteristic_polynomial = FALSE; INT f_export = FALSE; const BYTE *export_fname = NULL; INT f_expand_power = FALSE; INT expand_power = 0; INT expand_power_nb_graphs; const BYTE *expand_power_graph_fname[1000]; for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-v") == 0) { verbose_level = atoi(argv[++i]); cout << "-v " << verbose_level << endl; } else if (strcmp(argv[i], "-file") == 0) { f_file = TRUE; fname = argv[++i]; cout << "-file " << fname << endl; } else if (strcmp(argv[i], "-coordinates") == 0) { f_coordinates = TRUE; xmax_in = atoi(argv[++i]); ymax_in = atoi(argv[++i]); xmax_out = atoi(argv[++i]); ymax_out = atoi(argv[++i]); cout << "-coordinates " << xmax_in << " " << ymax_in << " " << xmax_out << " " << ymax_out << endl; } else if (strcmp(argv[i], "-export_magma") == 0) { f_export_magma = TRUE; magma_fname = argv[++i]; cout << "-export_magma " << magma_fname << endl; } else if (strcmp(argv[i], "-export_matlab") == 0) { f_export_matlab = TRUE; matlab_fname = argv[++i]; cout << "-export_matlab " << matlab_fname << endl; } else if (strcmp(argv[i], "-on_circle") == 0) { f_on_circle = TRUE; cout << "-on_circle " << endl; } else if (strcmp(argv[i], "-bitmatrix") == 0) { f_bitmatrix = TRUE; cout << "-bitmatrix " << endl; } else if (strcmp(argv[i], "-labels") == 0) { f_labels = TRUE; cout << "-labels " << endl; } else if (strcmp(argv[i], "-embedded") == 0) { f_embedded = TRUE; cout << "-embedded " << endl; } else if (strcmp(argv[i], "-sideways") == 0) { f_sideways = TRUE; cout << "-sideways " << endl; } else if (strcmp(argv[i], "-scale") == 0) { f_scale = TRUE; sscanf(argv[++i], "%lf", &scale); cout << "-scale " << scale << endl; } else if (strcmp(argv[i], "-line_width") == 0) { f_line_width = TRUE; sscanf(argv[++i], "%lf", &line_width); cout << "-line_width " << line_width << endl; } else if (strcmp(argv[i], "-aut") == 0) { f_aut = TRUE; cout << "-aut " << endl; } else if (strcmp(argv[i], "-is_association_scheme") == 0) { f_is_association_scheme = TRUE; cout << "-is_association_scheme " << endl; } else if (strcmp(argv[i], "-all_cliques") == 0) { f_all_cliques = TRUE; cout << "-all_cliques " << endl; } else if (strcmp(argv[i], "-all_cocliques") == 0) { f_all_cocliques = TRUE; cout << "-all_cocliques " << endl; } else if (strcmp(argv[i], "-characteristic_polynomial") == 0) { f_characteristic_polynomial = TRUE; cout << "-characteristic_polynomial " << endl; } else if (strcmp(argv[i], "-export") == 0) { f_export = TRUE; export_fname = argv[++i]; cout << "-export " << export_fname << endl; } else if (strcmp(argv[i], "-expand_power") == 0) { f_expand_power = TRUE; sscanf(argv[++i], "%ld", &expand_power); for (j = 0; ; j++) { expand_power_graph_fname[j] = argv[++i]; cout << "j=" << j << " : " << expand_power_graph_fname[j] << endl; if (strcmp(expand_power_graph_fname[j], "-1") == 0) { cout << "break j=" << j << endl; break; } } expand_power_nb_graphs = j; cout << "-expand_power " << expand_power << " " << endl; for (j = 0; j < expand_power_nb_graphs; j++) { cout << expand_power_graph_fname[j] << " " << endl; } cout << endl; } } if (!f_file) { cout << "Please specify the file name using -file <fname>" << endl; exit(1); } colored_graph *CG; CG = new colored_graph; CG->load(fname, verbose_level); if (f_export_magma) { CG->export_to_magma(magma_fname, 0 /* verbose_level */); } if (f_export_matlab) { CG->export_to_file_matlab(matlab_fname, 0 /* verbose_level */); } if (f_export) { CG->export_to_file(export_fname, 0 /* verbose_level */); } if (f_on_circle) { BYTE fname2[1000]; strcpy(fname2, fname); replace_extension_with(fname2, "_on_circle"); CG->draw_on_circle(fname2, xmax_in, ymax_in, xmax_out, ymax_out, f_labels, f_embedded, f_sideways, scale, line_width); } else if (f_bitmatrix) { BYTE fname2[1000]; strcpy(fname2, fname); replace_extension_with(fname2, "_bitmatrix"); CG->draw(fname2, xmax_in, ymax_in, xmax_out, ymax_out, verbose_level); //CG->draw_partitioned(fname2, xmax_in, ymax_in, xmax_out, ymax_out, verbose_level); } if (f_aut) { INT *Adj; action *Aut; longinteger_object ago; cout << "computing automorphism group of the graph:" << endl; //Aut = create_automorphism_group_of_colored_graph_object(CG, verbose_level); Adj = NEW_INT(CG->nb_points * CG->nb_points); INT_vec_zero(Adj, CG->nb_points * CG->nb_points); for (i = 0; i < CG->nb_points; i++) { for (j = i + 1; j < CG->nb_points; j++) { if (CG->is_adjacent(i, j)) { Adj[i * CG->nb_points + j] = 1; } } } Aut = create_automorphism_group_of_graph(Adj, CG->nb_points, verbose_level); Aut->group_order(ago); cout << "ago=" << ago << endl; FREE_INT(Adj); } if (f_is_association_scheme) { INT n = CG->nb_points; INT *Adj; Adj = NEW_INT(n * n); INT_vec_zero(Adj, n * n); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (CG->is_adjacent(i, j)) { Adj[i * n + j] = 1; } } } for (i = 0; i < n * n; i++) { Adj[i] += 1; } for (i = 0; i < n; i++) { Adj[i * n + i] = 0; } INT *Pijk; //INT *colors; //INT nb_colors; if (is_association_scheme(Adj, n, Pijk, CG->point_color, CG->nb_colors, verbose_level)) { cout << "Is an association scheme" << endl; } else { cout << "Is NOT an association scheme" << endl; } FREE_INT(Adj); } if (f_expand_power) { INT n = CG->nb_points; INT *Adj; INT *A, *B; INT e, c, k, diag, p; if (expand_power <= 1) { cout << "expand_power <= 1" << endl; exit(1); } Adj = NEW_INT(n * n); A = NEW_INT(n * n); B = NEW_INT(n * n); INT_vec_zero(Adj, n * n); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (CG->is_adjacent(i, j)) { Adj[i * n + j] = 1; Adj[j * n + i] = 1; } } } INT_vec_copy(Adj, A, n * n); e = 1; while (e < expand_power) { for (i = 0; i < n; i++) { for (j = 0; j < n; j++) { c = 0; for (k = 0; k < n; k++) { c += Adj[i * n + k] * A[k * n + j]; } B[i * n + j] = c; } } INT_vec_copy(B, A, n * n); e++; } cout << "the " << expand_power << " power of the adjacency matrix is:" << endl; INT_matrix_print(B, n, n); diag = B[0 * n + 0]; for (i = 0; i < n; i++) { if (B[i * n + i] != diag) { cout << "diagonal is not constant" << endl; exit(1); } } for (i = 0; i < n; i++) { B[i * n + i] = 0; } cout << "after subtracting " << diag << " times the identity, the matrix is:" << endl; INT_matrix_print(B, n, n); for (p = 0; p < n * n; p++) { if (Adj[p]) { break; } } c = B[p]; if (c) { for (i = 0; i < n * n; i++) { if (Adj[i]) { if (B[i] != c) { cout << "B is not constant on the original graph" << endl; exit(1); } } } for (i = 0; i < n * n; i++) { if (Adj[i]) { B[i] = 0; } } } cout << "after subtracting " << c << " times the original graph, the matrix is:" << endl; INT_matrix_print(B, n, n); INT h; INT *coeffs; colored_graph *CG_basis; coeffs = NEW_INT(expand_power_nb_graphs + 2); CG_basis = new colored_graph[expand_power_nb_graphs]; INT_vec_zero(coeffs, expand_power_nb_graphs); coeffs[expand_power_nb_graphs] = c; coeffs[expand_power_nb_graphs + 1] = diag; for (h = 0; h < expand_power_nb_graphs; h++) { CG_basis[h].load(expand_power_graph_fname[h], verbose_level); if (CG_basis[h].nb_points != n) { cout << "the graph " << expand_power_graph_fname[h] << " has the wrong number of vertices" << endl; exit(1); } INT *H; H = NEW_INT(n * n); INT_vec_zero(H, n * n); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { if (CG_basis[h].is_adjacent(i, j)) { H[i * n + j] = 1; H[j * n + i] = 1; } } } for (p = 0; p < n * n; p++) { if (H[p]) { break; } } coeffs[h] = B[p]; if (coeffs[h]) { for (i = 0; i < n * n; i++) { if (H[i]) { if (B[i] != coeffs[h]) { cout << "B is not constant on the graph " << expand_power_graph_fname[h] << endl; exit(1); } } } for (i = 0; i < n * n; i++) { if (H[i]) { B[i] = 0; } } } cout << "after subtracting " << coeffs[h] << " times the graph " << expand_power_graph_fname[h] << ", the matrix is:" << endl; INT_matrix_print(B, n, n); FREE_INT(H); } cout << "coeffs="; INT_vec_print(cout, coeffs, expand_power_nb_graphs + 2); cout << endl; FREE_INT(Adj); FREE_INT(A); FREE_INT(B); } if (f_all_cliques || f_all_cocliques) { INT *Adj; action *Aut; longinteger_object ago; cout << "computing automorphism group of the graph:" << endl; //Aut = create_automorphism_group_of_colored_graph_object(CG, verbose_level); Adj = NEW_INT(CG->nb_points * CG->nb_points); INT_vec_zero(Adj, CG->nb_points * CG->nb_points); for (i = 0; i < CG->nb_points; i++) { for (j = i + 1; j < CG->nb_points; j++) { if (CG->is_adjacent(i, j)) { Adj[i * CG->nb_points + j] = 1; } } } Aut = create_automorphism_group_of_graph(Adj, CG->nb_points, verbose_level); Aut->group_order(ago); cout << "ago=" << ago << endl; action *Aut_on_points; INT *points; Aut_on_points = new action; points = NEW_INT(CG->nb_points); for (i = 0; i < CG->nb_points; i++) { points[i] = i; } Aut_on_points->induced_action_by_restriction(*Aut, TRUE /* f_induce_action */, Aut->Sims, CG->nb_points /* nb_points */, points, verbose_level); Aut_on_points->group_order(ago); cout << "ago on points = " << ago << endl; BYTE prefix[1000]; generator *gen; INT nb_orbits, depth; strcpy(prefix, fname); replace_extension_with(prefix, "_cliques"); if (f_all_cliques) { compute_orbits_on_subsets(gen, CG->nb_points /* target_depth */, prefix, TRUE /* f_W */, FALSE /* f_w */, Aut_on_points, Aut_on_points, Aut_on_points->Strong_gens, early_test_function_cliques, CG, NULL, NULL, verbose_level); } else { compute_orbits_on_subsets(gen, CG->nb_points /* target_depth */, prefix, TRUE /* f_W */, FALSE /* f_w */, Aut_on_points, Aut_on_points, Aut_on_points->Strong_gens, early_test_function_cocliques, CG, NULL, NULL, verbose_level); } for (depth = 0; depth < CG->nb_points; depth++) { nb_orbits = gen->nb_orbits_at_level(depth); if (nb_orbits == 0) { depth--; break; } } if (f_all_cliques) { cout << "the largest cliques have size " << depth << endl; for (i = 0; i <= depth; i++) { nb_orbits = gen->nb_orbits_at_level(i); cout << setw(3) << i << " : " << setw(3) << nb_orbits << endl; } } else if (f_all_cocliques) { cout << "the largest cocliques have size " << depth << endl; for (i = 0; i <= depth; i++) { nb_orbits = gen->nb_orbits_at_level(i); cout << setw(3) << i << " : " << setw(3) << nb_orbits << endl; } } INT *set; longinteger_object go, ol; longinteger_domain D; set = NEW_INT(depth); nb_orbits = gen->nb_orbits_at_level(depth); cout << "orbit : representative : stabilizer order : orbit length" << endl; for (i = 0; i < nb_orbits; i++) { gen->get_set_by_level(depth, i, set); strong_generators *gens; gen->get_stabilizer_generators(gens, depth, i, verbose_level); gens->group_order(go); D.integral_division_exact(ago, go, ol); cout << "Orbit " << i << " is the set "; INT_vec_print(cout, set, depth); cout << " : " << go << " : " << ol << endl; cout << endl; } FREE_INT(set); FREE_INT(Adj); FREE_INT(points); delete Aut; delete Aut_on_points; } else if (f_characteristic_polynomial) { characteristic_polynomial(CG, verbose_level); } delete CG; cout << "draw_colored_graph.out is done" << endl; the_end(t0); //the_end_quietly(t0); }
void do_Fano_subplanes(translation_plane &T, INT order, INT verbose_level) { INT f_v = (verbose_level >= 1); INT i, j; BYTE fname[1000]; if (f_v) { cout << "do_Fano_subplanes" << endl; } cout << "T.target_size = " << T.target_size << endl; T.compute(T.target_size, verbose_level); sprintf(fname, "%s_lvl_%ld", T.gen->fname_base, T.target_size); //T.gen->A->read_file_and_print_representatives(fname, FALSE); INT *Reps; BYTE **Aut_ascii; INT nb_reps, size; cout << "Reading spreads from file " << fname << endl; T.gen->A->read_representatives_and_strong_generators(fname, Reps, Aut_ascii, nb_reps, size, 0 /* verbose_level */); cout << "Read spreads from file " << fname << endl; translation_plane_via_andre_model *TP; INT *Nb_subplanes; //INT **Subplanes; TP = new translation_plane_via_andre_model[nb_reps]; Nb_subplanes = NEW_INT(nb_reps); //Subplanes = NEW_PINT(nb_reps); //INT depth = 4; INT depth = 7; for (i = 0; i < nb_reps; i++) { cout << endl; cout << endl; cout << endl; cout << endl; cout << endl; cout << endl; cout << "Making translation plane from representative " << i << ":" << endl; vector_ge *gens; INT *tl; T.gen->A->get_generators_from_ascii_coding(Aut_ascii[i], gens, tl, verbose_level - 2); TP[i].init(Reps + i * T.target_size, T.q, T.k, T.F, gens, tl, verbose_level); BYTE prefix[1000]; sprintf(prefix, "TP_%ld_", i); //TP[i].classify_arcs(prefix, depth, verbose_level); TP[i].classify_subplanes(prefix, verbose_level); Nb_subplanes[i] = TP[i].arcs->number_of_orbits_at_depth(depth); FREE_OBJECT(gens); FREE_INT(tl); } for (i = 0; i < nb_reps; i++) { cout << "Translation plane " << i << ":" << endl; TP[i].arcs->print_orbit_numbers(depth); } #if 0 for (i = 0; i < nb_reps; i++) { cout << "Translation plane " << i << ":" << endl; BYTE fname[1000]; INT *Quadrangles; INT nb_quadrangles; INT size; sprintf(fname, "%s_lvl_%ld", TP[i].arcs->fname_base, depth); TP[i].An1->read_representatives(fname, Quadrangles, nb_quadrangles, size, verbose_level); Nb_subplanes[i] = 0; Subplanes[i] = NEW_INT(nb_quadrangles * 7); cout << "Found " << nb_quadrangles << " quadrangles, testing for subplanes" << endl; for (j = 0; j < nb_quadrangles; j++) { if (TP[i].check_if_quadrangle_defines_a_subplane(Quadrangles + j * 4, Subplanes[i] + 7 * Nb_subplanes[i], verbose_level)) { Nb_subplanes[i]++; } } } for (i = 0; i < nb_reps; i++) { cout << "Translation plane " << i << " has " << Nb_subplanes[i] << " quadrangles that span subplanes" << endl; cout << "The subplanes are:" << endl; INT_matrix_print(Subplanes[i], Nb_subplanes[i], 7); } for (i = 0; i < nb_reps; i++) { cout << "Translation plane " << i << " has " << Nb_subplanes[i] << " quadrangles that span subplanes" << endl; } #endif for (i = 0; i < nb_reps; i++) { cout << "Translation plane " << i << " has " << Nb_subplanes[i] << " orbits of Fano subplanes" << endl; TP[i].arcs->compute_and_print_automorphism_group_orders(depth, cout); if (i == 4 || i == 5) { INT fst, node, size; INT *set; set = NEW_INT(depth); fst = TP[i].arcs->first_oracle_node_at_level[depth]; for (j = 0; j < Nb_subplanes[i]; j++) { longinteger_object stab_order; node = fst + j; TP[i].arcs->stabilizer_order(node, stab_order); if ((stab_order.as_INT() % 14) == 0) { cout << "orbit " << j << " has stabilizer of order " << stab_order << " which is divisible by 14" << endl; TP[i].arcs->get_set(node, set, size); if (size != depth) { cout << "size != depth" << endl; exit(1); } cout << "The subplane is : "; INT_vec_print(cout, set, depth); cout << endl; vector_ge *stab_gens; INT *stab_tl; stab_gens = new vector_ge; stab_tl = NEW_INT(TP[i].An1->base_len); TP[i].arcs->get_stabilizer(stab_gens, stab_tl, depth, j, 0 /*verbose_level */); sims *S; longinteger_object Sgo; S = create_sims_from_generators_with_target_group_order_factorized(TP[i].An1, stab_gens, stab_tl, TP[i].An1->base_len, 0 /* verbose_level */); S->group_order(Sgo); cout << "created group of order " << Sgo << endl; delete S; delete stab_gens; FREE_INT(stab_tl); } } FREE_INT(set); } cout << endl; } delete [] TP; FREE_INT(Nb_subplanes); #if 0 for (i = 0; i < nb_reps; i++) { FREE_INT(Subplanes[i]); } FREE_PINT(Subplanes); #endif FREE_INT(Reps); for (i = 0; i < nb_reps; i++) { FREE_BYTE(Aut_ascii[i]); } FREE_PBYTE(Aut_ascii); if (f_v) { cout << "do_Fano_subplanes done" << endl; } }
int main(int argc, const char **argv) { INT i, j; INT verbose_level = 0; INT f_poly = FALSE; const BYTE *poly = NULL; INT f_order = FALSE; INT order = 0; INT f_dim_over_kernel = FALSE; INT dim_over_kernel = 0; INT f_clique_level = FALSE; INT clique_level = -1; INT f_make_spread = FALSE; INT type_of_spread = 0; INT f_starter = FALSE; INT f_depth = FALSE; INT depth = 0; INT f_identify = FALSE; INT identify_data[1000]; INT identify_data_sz = 0; INT f_lift = FALSE; INT lift_level = FALSE; const BYTE *lift_prefix = ""; INT f_lex = FALSE; INT f_build_db = FALSE; INT level = FALSE; INT f_read_solution_files = FALSE; const BYTE *solution_fname[MAX_FILES]; INT nb_files = 0; INT f_compute_orbits = FALSE; INT f_isomorph_testing = FALSE; INT f_classification_graph = FALSE; INT f_CO = FALSE; INT f_report = FALSE; INT f_make_quotients = FALSE; INT f_extend_simple = FALSE; INT extend_starter[1000]; INT starter_size; INT f_plane_type_klein = FALSE; const BYTE *fname_plane_type_klein; INT f_print_spread = FALSE; const BYTE *fname_print_spread; INT f_HMO = FALSE; const BYTE *fname_HMO; INT f_down_orbits = FALSE; INT down_orbits_level = 0; INT f_split = FALSE; INT split_r = 0; INT split_m = 1; INT f_solve = FALSE; INT f_save = FALSE; INT f_event_file = FALSE; // -e <event file> option const BYTE *event_file_name; INT print_mod = 1000; INT f_Fano = FALSE; INT f_recoordinatize = FALSE; INT f_print_representatives = FALSE; INT representatives_size = 0; const BYTE *representatives_fname = NULL; INT f_test_identify = FALSE; INT identify_level = 0; INT identify_nb_times = 0; INT f_draw_poset = FALSE; INT f_embedded = FALSE; INT f_print_data_structure = FALSE; INT f_draw_system = FALSE; const BYTE *fname_system = NULL; INT f_write_tree = FALSE; const BYTE *fname_tree = NULL; t0 = os_ticks(); for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-v") == 0) { verbose_level = atoi(argv[++i]); cout << "-v " << verbose_level << endl; } else if (strcmp(argv[i], "-poly") == 0) { f_poly = TRUE; poly = argv[++i]; cout << "-poly " << poly << endl; } else if (strcmp(argv[i], "-order") == 0) { f_order = TRUE; order = atoi(argv[++i]); cout << "-order " << order << endl; } else if (strcmp(argv[i], "-dim_over_kernel") == 0) { f_dim_over_kernel = TRUE; dim_over_kernel = atoi(argv[++i]); cout << "-dim_over_kernel " << dim_over_kernel << endl; } else if (strcmp(argv[i], "-clique_level") == 0) { f_clique_level = TRUE; clique_level = atoi(argv[++i]); cout << "-clique_level " << clique_level << endl; } else if (strcmp(argv[i], "-FTWKB") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_FTWKB; cout << "-FTWKB" << endl; } else if (strcmp(argv[i], "-Kantor") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_KANTOR; cout << "-Kantor" << endl; } else if (strcmp(argv[i], "-DicksonKantor") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_DICKSON_KANTOR; cout << "-DicksonKantor" << endl; } else if (strcmp(argv[i], "-Hudson") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_HUDSON; cout << "-Hudson" << endl; } else if (strcmp(argv[i], "-Kantor2") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_KANTOR2; cout << "-Kantor2" << endl; } else if (strcmp(argv[i], "-Ganley") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_GANLEY; cout << "-Ganley" << endl; } else if (strcmp(argv[i], "-Law_Penttila") == 0) { f_make_spread = TRUE; type_of_spread = SPREAD_OF_TYPE_LAW_PENTTILA; cout << "-Law_Penttila" << endl; } else if (strcmp(argv[i], "-starter") == 0) { f_starter = TRUE; cout << "-starter " << endl; } else if (strcmp(argv[i], "-depth") == 0) { f_depth = TRUE; depth = atoi(argv[++i]); cout << "-depth " << depth << endl; } else if (strcmp(argv[i], "-identify") == 0) { INT a; f_identify = TRUE; j = 0; while (TRUE) { a = atoi(argv[++i]); if (a == -1) { break; } identify_data[j++] = a; } identify_data_sz = j; cout << "-identify "; INT_vec_print(cout, identify_data, identify_data_sz); cout << endl; } else if (strcmp(argv[i], "-test_identify") == 0) { f_test_identify = TRUE; identify_level = atoi(argv[++i]); identify_nb_times = atoi(argv[++i]); cout << "-test_identify " << identify_level << " " << identify_nb_times << endl; } else if (strcmp(argv[i], "-lift") == 0) { f_lift = TRUE; lift_level = atoi(argv[++i]); lift_prefix = argv[++i]; cout << "-lift " << lift_level << " " << lift_prefix << endl; } else if (strcmp(argv[i], "-lex") == 0) { f_lex = TRUE; cout << "-lex" << endl; } else if (strcmp(argv[i], "-build_db") == 0) { f_build_db = TRUE; level = atoi(argv[++i]); cout << "-build_db " << level << endl; } else if (strcmp(argv[i], "-read_solution_files") == 0) { f_read_solution_files = TRUE; level = atoi(argv[++i]); i++; nb_files = 0; while (i < argc) { solution_fname[nb_files] = argv[i]; cout << "solution_fname[nb_files]=" << solution_fname[nb_files] << endl; if (strcmp(solution_fname[nb_files], "-1") == 0) { break; } nb_files++; i++; } cout << "-read_solution_files "; for (j = 0; j < nb_files; j++) { cout << solution_fname[j] << " "; } cout << endl; } else if (strcmp(argv[i], "-compute_orbits") == 0) { f_compute_orbits = TRUE; level = atoi(argv[++i]); cout << "-compute_orbits " << level << endl; } else if (strcmp(argv[i], "-isomorph_testing") == 0) { f_isomorph_testing = TRUE; level = atoi(argv[++i]); cout << "-isomorph_testing " << level << endl; } else if (strcmp(argv[i], "-classification_graph") == 0) { f_classification_graph = TRUE; level = atoi(argv[++i]); cout << "-classification_graph " << level << endl; } else if (strcmp(argv[i], "-CO") == 0) { f_CO = TRUE; level = atoi(argv[++i]); cout << "-CO " << level << endl; } else if (strcmp(argv[i], "-report") == 0) { f_report = TRUE; cout << "-report " << endl; } else if (strcmp(argv[i], "-make_quotients") == 0) { f_make_quotients = TRUE; cout << "-make_quotients " << endl; } else if (strcmp(argv[i], "-extend_simple") == 0) { f_extend_simple = TRUE; i++; starter_size = 0; while (i < argc) { extend_starter[starter_size] = atoi(argv[i]); if (extend_starter[starter_size] == -1) { break; } starter_size++; i++; } cout << "-extend_simple "; for (j = 0; j < starter_size; j++) { cout << extend_starter[j] << " "; } cout << endl; } else if (strcmp(argv[i], "-plane_type_klein") == 0) { f_plane_type_klein = TRUE; fname_plane_type_klein = argv[++i]; cout << "-plane_type_klein " << fname_plane_type_klein << endl; } else if (strcmp(argv[i], "-print_spread") == 0) { f_print_spread = TRUE; fname_print_spread = argv[++i]; cout << "-print_spread " << fname_print_spread << endl; } else if (strcmp(argv[i], "-HMO") == 0) { f_HMO = TRUE; fname_HMO = argv[++i]; cout << "-HMO " << fname_HMO << endl; } else if (strcmp(argv[i], "-down_orbits") == 0) { f_down_orbits = TRUE; down_orbits_level = atoi(argv[++i]); cout << "-down_orbits " << down_orbits_level << endl; } else if (strcmp(argv[i], "-split") == 0) { f_split = TRUE; split_r = atoi(argv[++i]); split_m = atoi(argv[++i]); cout << "-split " << split_r << " " << split_m << endl; } else if (strcmp(argv[i], "-solve") == 0) { f_solve = TRUE; cout << "-solve " << endl; } else if (strcmp(argv[i], "-save") == 0) { f_save = TRUE; cout << "-save " << endl; } else if (strcmp(argv[i], "-e") == 0) { i++; f_event_file = TRUE; event_file_name = argv[i]; cout << "-e " << event_file_name << endl; } else if (strcmp(argv[i], "-print_interval") == 0) { print_mod = atoi(argv[++i]); cout << "-print_interval " << print_mod << endl; } else if (strcmp(argv[i], "-Fano") == 0) { f_Fano = TRUE; cout << "-Fano " << endl; } else if (strcmp(argv[i], "-recoordinatize") == 0) { f_recoordinatize = TRUE; cout << "-recoordinatize " << endl; } else if (strcmp(argv[i], "-print_representatives") == 0) { f_print_representatives = TRUE; representatives_size = atoi(argv[++i]); representatives_fname = argv[++i]; cout << "-print_representatives" << representatives_size << " " << representatives_fname << endl; } else if (strcmp(argv[i], "-draw_poset") == 0) { f_draw_poset = TRUE; cout << "-draw_poset " << endl; } else if (strcmp(argv[i], "-embedded") == 0) { f_embedded = TRUE; cout << "-embedded " << endl; } else if (strcmp(argv[i], "-print_data_structure") == 0) { f_print_data_structure = TRUE; cout << "-print_data_structure " << endl; } else if (strcmp(argv[i], "-draw_system") == 0) { f_draw_system = TRUE; fname_system = argv[++i]; cout << "-draw_system " << fname_system << endl; } else if (strcmp(argv[i], "-write_tree") == 0) { f_write_tree = TRUE; fname_tree = argv[++i]; cout << "-write_tree " << fname_tree << endl; } } if (!f_order) { cout << "please use option -order <order>" << endl; exit(1); } INT p, e, e1, n, k, q; factor_prime_power(order, p, e); cout << "order = " << order << " = " << p << "^" << e << endl; if (f_dim_over_kernel) { if (e % dim_over_kernel) { cout << "dim_over_kernel does not divide e" << endl; exit(1); } e1 = e / dim_over_kernel; n = 2 * dim_over_kernel; k = dim_over_kernel; q = i_power_j(p, e1); cout << "order=" << order << " n=" << n << " k=" << k << " q=" << q << endl; } else { n = 2 * e; k = e; q = p; cout << "order=" << order << " n=" << n << " k=" << k << " q=" << q << endl; } INT f_v = (verbose_level >= 1); finite_field *F; translation_plane T; F = new finite_field; F->init_override_polynomial(q, poly, 0 /* verbose_level */); T.read_arguments(argc, argv); T.init(order, n, k, F, f_recoordinatize, 0 /*MINIMUM(verbose_level - 1, 2)*/); T.init2(0 /*verbose_level*/); if (clique_level >= 0) { translation_plane_init_clique(&T, T.gen, clique_level, verbose_level); } if (f_make_spread) { T.write_spread_to_file(type_of_spread, verbose_level); } else if (f_starter) { if (!f_depth) { cout << "Please use option -depth <depth>" << endl; exit(1); } T.compute(depth, verbose_level); #if 0 BYTE fname[1000]; sprintf(fname, "%s_lvl_%ld", T.gen->fname_base, depth); //T.gen->A->read_file_and_print_representatives(fname, FALSE); #endif cout << "depth = " << depth << endl; cout << "spread_size = " << T.spread_size << endl; if (f_draw_poset) { if (f_v) { cout << "before gen->draw_poset" << endl; } T.gen->draw_poset(T.gen->fname_base, depth, 0 /* data1 */, f_embedded, verbose_level); } if (f_print_data_structure) { if (f_v) { cout << "before gen->print_data_structure_tex" << endl; } T.gen->print_data_structure_tex(depth, 0 /*gen->verbose_level*/); } #if 0 if (f_identify) { T.identify(identify_data, identify_data_sz, verbose_level); } #endif } else if (f_identify) { if (!f_depth) { cout << "Please use option -depth <depth>" << endl; exit(1); } cout << "classifying translation planes" << endl; T.compute(order + 1, 0 /* verbose_level */); cout << "classifying translation planes done" << endl; //T.gen->print_node(5); INT *transporter; INT orbit_at_level; transporter = NEW_INT(T.gen->A->elt_size_in_INT); T.gen->identify(identify_data, identify_data_sz, transporter, orbit_at_level, verbose_level); FREE_INT(transporter); } #if 0 else if (f_Fano) { do_Fano_subplanes(T, order, verbose_level); } #endif else if (f_test_identify) { if (!f_depth) { cout << "Please use option -depth <depth>" << endl; exit(1); } cout << "classifying translation planes" << endl; T.compute(order + 1, 0 /* verbose_level */); cout << "classifying translation planes done" << endl; T.gen->test_identify(identify_level, identify_nb_times, verbose_level); } else if (f_lift) { //T.compute(verbose_level); compute_lifts(T.A, T.A2, (void *) &T, T.gen->fname_base, lift_prefix, lift_prefix, lift_prefix, lift_level, T.spread_size, f_lex, f_split, split_r, split_m, f_solve, f_save, FALSE /*f_read_instead*/, f_draw_system, fname_system, f_write_tree, fname_tree, translation_plane_lifting_prepare_function, translation_plane_lifting_cleanup_function, translation_plane_lifting_early_test_function, (void *) &T, FALSE, NULL, NULL, FALSE, NULL, verbose_level); // TOP_LEVEL/extra.C } else if (f_build_db) { system("mkdir ISO"); isomorph_build_db(T.A, T.A2, T.gen, order + 1, T.gen->fname_base, (BYTE *)"ISO/", level, verbose_level); } else if (f_read_solution_files) { isomorph_read_solution_files(T.A, T.A2, T.gen, order + 1 /* target_size */, T.gen->fname_base, (BYTE *)"ISO/", level, solution_fname, nb_files, verbose_level); } else if (f_compute_orbits) { isomorph_compute_orbits(T.A, T.A2, T.gen, order + 1 /* target_size */, T.gen->fname_base, (BYTE *)"ISO/", level, verbose_level); } else if (f_isomorph_testing) { isomorph_testing(T.A, T.A2, T.gen, order + 1 /* target_size */, T.gen->fname_base, (BYTE *)"ISO/", level, f_event_file, event_file_name, print_mod, verbose_level); } else if (f_classification_graph) { isomorph_classification_graph(T.A, T.A2, T.gen, order + 1 /* target_size */, T.gen->fname_base, (BYTE *)"ISO/", level, verbose_level); } else if (f_CO) { T.czerwinski_oakden(level, verbose_level); } else if (f_report) { if (!f_depth) { cout << "Please use option -depth <depth>" << endl; exit(1); } isomorph_worker(T.A, T.A2, T.gen, order + 1 /* target_size */, T.gen->fname_base, (BYTE *)"ISO/", translation_plane_callback_report, &T, depth, verbose_level); //T.print_classification(order, level, f_select, select_first, select_len, verbose_level); } else if (f_make_quotients) { if (!f_depth) { cout << "Please use option -depth <depth>" << endl; exit(1); } isomorph_worker(T.A, T.A2, T.gen, order + 1 /* target_size */, T.gen->fname_base, (BYTE *)"ISO/", translation_plane_callback_make_quotients, &T, depth, verbose_level); } else if (f_extend_simple) { translation_plane_extend_simple(&T, starter_size, extend_starter, FALSE /*f_lex*/, FALSE /* f_write_graph_file */, FALSE /* f_draw_graph */, FALSE /* f_write_tree */, FALSE /* f_decision_nodes_only */, verbose_level); } else if (f_plane_type_klein) { T.test_plane_intersection_type_of_klein_image( fname_plane_type_klein, verbose_level); } else if (f_print_spread) { T.read_and_print_spread(fname_print_spread, verbose_level); } else if (f_HMO) { T.HMO(fname_HMO, verbose_level); } else if (f_down_orbits) { isomorph_compute_down_orbits(T.A, T.A2, T.gen, T.spread_size, T.gen->fname_base, (BYTE *)"ISO/", &T, down_orbits_level, verbose_level); } if (f_print_representatives) { orbit_rep *R; INT *M; INT no, nb; BYTE fname[1000]; R = new orbit_rep; M = NEW_INT(T.k * T.n); sprintf(fname, "%s_lvl_%ld", representatives_fname, representatives_size); nb = count_number_of_orbits_in_file(fname, verbose_level); cout << "there are " << nb << " orbit representatives in the file " << fname << endl; for (no = 0; no < nb; no++) { R->init_from_file(T.A /*A_base*/, (BYTE *) representatives_fname, representatives_size, no, representatives_size - 1/*level_of_candidates_file*/, translation_plane_lifting_early_test_function, &T, verbose_level - 1 ); // R has: INT *candidates; INT nb_candidates; for (i = 0; i < representatives_size; i++) { cout << R->rep[i] << " "; } cout << endl; for (i = 0; i < representatives_size; i++) { cout << R->rep[i] << " = " << endl; T.Grass->unrank_INT_here(M, R->rep[i], 0/*verbose_level - 4*/); INT_matrix_print(M, T.k, T.n); } } } //end: //the_end(t0); the_end_quietly(t0); }
void do_it(INT verbose_level) { INT H[16] = { 1,1,1,1, 1,-1,1,-1, 1,1,-1,-1, 1,-1,-1,1 }; INT L[16] = { 0,1,2,3, 1,0,3,2, 2,3,0,1, 3,2,1,0 }; INT C[4][16]; INT A[16 * 16]; INT A2[16 * 16]; INT h, i, j, I, J, l, a, b; for (h = 0; h < 4; h++) { for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { C[h][i * 4 + j] = H[i * 4 + h] * H[j * 4 + h]; } } } for (h = 0; h < 4; h++) { cout << "C_" << h << ":" << endl; INT_matrix_print(C[h], 4, 4); cout << endl; } for (I = 0; I < 4; I++) { for (J = 0; J < 4; J++) { l = L[I * 4 + J]; for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { a = C[l][i * 4 + j]; A[(I * 4 + i) * 16 + J * 4 + j] = a; } } } } cout << "A=" << endl; INT_matrix_print(A, 16, 16); cout << endl; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { a = A[i * 16 + j]; if (a == 1) { b = 0; } else { b = 1; } A[i * 16 + j] = b; } } cout << "A=" << endl; INT_matrix_print(A, 16, 16); cout << endl; for (i = 0; i < 16; i++) { for (j = 0; j < 16; j++) { b = 0; for (h = 0; h < 16; h++) { b += A[i * 16 + h] * A[h * 16 + j]; } A2[i * 16 + j] = b; } } cout << "A2=" << endl; INT_matrix_print(A2, 16, 16); cout << endl; }
void young::create_module(INT *h_alpha, INT *&Base, INT *&base_cols, INT &rk, INT verbose_level) { INT f_v = (verbose_level >= 1); INT i, j; if (f_v) { cout << "young::create_module" << endl; } INT sz; goi = S->group_order_INT(); sz = group_ring_element_size(A, S); INT *M1; M1 = NEW_INT(goi * sz); Base = NEW_INT(goi * sz * D->size_of_instance_in_INT); for (j = 0; j < sz; j++) { M1[0 * sz + j] = h_alpha[j]; } INT *elt4, *elt5; group_ring_element_create(A, S, elt4); group_ring_element_create(A, S, elt5); for (i = 1; i < goi; i++) { group_ring_element_zero(A, S, elt4); elt4[i] = 1; group_ring_element_mult(A, S, h_alpha, elt4, elt5); for (j = 0; j < sz; j++) { M1[i * sz + j] = elt5[j]; } } if (FALSE) { cout << "M1=" << endl; INT_matrix_print(M1, goi, sz); } for (i = 0; i < goi * sz; i++) { D->make_integer(D->offset(Base, i), M1[i], 0 /* verbose_level*/); } if (f_v) { cout << "A basis is:" << endl; D->print_matrix(Base, goi, sz); } INT f_special = FALSE; INT f_complete = TRUE; INT f_P = FALSE; base_cols = NEW_INT(sz); if (f_v) { cout << "Calling Gauss_echelon_form:" << endl; } rk = D->Gauss_echelon_form(Base, f_special, f_complete, base_cols, f_P, NULL, goi, sz, goi, 0 /*verbose_level*/); if (f_v) { cout << "rk=" << rk << endl; cout << "Basis=" << endl; D->print_matrix(Base, rk, sz); } if (f_v) { cout << "base_cols=" << endl; INT_vec_print(cout, base_cols, rk); cout << endl; } FREE_INT(M1); FREE_INT(elt4); FREE_INT(elt5); if (f_v) { cout << "young::create_module done" << endl; } }