17namespace layer3_group_actions {
21static void dimensions(
int n,
int &nb_rows,
int &nb_cols);
22static void place_binary(
long int h,
int &i,
int &j);
101 int verbose_level = 0;
102 int f_v = (verbose_level >= 1);
105 cout <<
"wreath_product::freeself" << endl;
187 cout <<
"wreath_product::freeself finished" << endl;
195 int f_v = (verbose_level >= 1);
201 cout <<
"wreath_product::init_tensor_wreath_product" << endl;
204 cout <<
"wreath_product::init_tensor_wreath_product "
205 "the input group must be of type general linear "
206 "(not projective)" << endl;
210 cout <<
"wreath_product::init_tensor_wreath_product "
211 "the input group must be of type general linear "
212 "(not affine)" << endl;
223 cout <<
"wreath_product::init_tensor_wreath_product before P->init" << endl;
227 cout <<
"wreath_product::init_tensor_wreath_product after P->init" << endl;
234 sprintf(str2,
" \\wr {\\rm Sym}(%d)",
nb_factors);
249 cout <<
"wreath_product::init_tensor_wreath_product "
250 "computing degree_of_tensor_action" << endl;
257 cout <<
"wreath_product::init_tensor_wreath_product "
263 cout <<
"wreath_product::init_tensor_wreath_product "
267 cout <<
"wreath_product::init_tensor_wreath_product "
268 "degree_of_matrix_group = "
270 cout <<
"wreath_product::init_tensor_wreath_product "
271 "dimension_of_matrix_group = "
273 cout <<
"wreath_product::init_tensor_wreath_product "
274 "low_level_point_size = "
276 cout <<
"wreath_product::init_tensor_wreath_product "
277 "dimension_of_tensor_action = "
279 cout <<
"wreath_product::init_tensor_wreath_product "
280 "degree_of_tensor_action = "
282 cout <<
"wreath_product::init_tensor_wreath_product "
307 cout <<
"wreath_product::init_tensor_wreath_product "
321 cout <<
"wreath_product::init_tensor_wreath_product "
323 cout <<
"wreath_product::init_tensor_wreath_product "
325 cout <<
"wreath_product::init_tensor_wreath_product "
330 FALSE , verbose_level - 1);
332 cout <<
"wreath_product::init_tensor_wreath_product "
349 cout <<
"wreath_product::init_tensor_wreath_product "
350 "base_for_component = ";
353 cout <<
"wreath_product::init_tensor_wreath_product "
354 "tl_for_component = ";
364 cout <<
"wreath_product::init_tensor_wreath_product "
365 "before compute_base_and_transversals" << endl;
369 cout <<
"wreath_product::init_tensor_wreath_product "
370 "after compute_base_and_transversals" << endl;
373 cout <<
"wreath_product::init_tensor_wreath_product "
377 cout <<
"wreath_product::init_tensor_wreath_product "
378 "the_transversal_length = ";
385 cout <<
"wreath_product::init_tensor_wreath_product "
386 "before create_all_rank_one_tensors" << endl;
393 cout <<
"wreath_product::init_tensor_wreath_product "
394 "after create_all_rank_one_tensors" << endl;
402 cout <<
"wreath_product::init_tensor_wreath_product done" << endl;
408 int f_v = (verbose_level >= 1);
411 cout <<
"wreath_product::compute_tensor_ranks" << endl;
419 cout <<
"wreath_product::unrank_point "
420 "we are in the permutation, cannot unrank" << endl;
424 if (a < nb_factors * M->degree) {
425 cout <<
"wreath_product::unrank_point "
426 "we are in the projected components, cannot unrank" << endl;
447 int f_v = (verbose_level >= 1);
448 long int f, a0, b, c;
452 cout <<
"wreath_product::element_image_of" << endl;
458 cout <<
"wreath_product::element_image_of "
459 "we are in the permutation" << endl;
469 cout <<
"wreath_product::element_image_of "
470 "we are in component " << f
471 <<
" reduced input a=" << a << endl;
478 cout <<
"wreath_product::element_image_of "
479 "we are in component " << f
480 <<
" reduced output c=" << c << endl;
492 cout <<
"wreath_product::element_image_of "
493 "we are in the tensor product component "
494 "reduced input a = " << a << endl;
499 cout <<
"wreath_product::element_image_of "
506 cout <<
"wreath_product::element_image_of "
516 cout <<
"wreath_product::element_image_of "
523 cout <<
"wreath_product::element_image_of "
531 cout <<
"wreath_product::element_image_of "
532 "we are in tensor product component " << f
533 <<
" reduced output c=" << c << endl;
537 cout <<
"wreath_product::element_image_of "
538 "we are in tensor product component " << f
539 <<
" output b=" << b << endl;
544 cout <<
"wreath_product::element_image_of " << a0
545 <<
" maps to " << b << endl;
551 int *input,
int *output,
int verbose_level)
554 int f_v = (verbose_level >= 1);
557 cout <<
"wreath_product::element_image_of_low_level" << endl;
560 cout <<
"wreath_product::element_image_of_low_level "
567 cout <<
"wreath_product::element_image_of_low_level "
577 cout <<
"wreath_product::element_image_of_low_level "
584 cout <<
"wreath_product::element_image_of_low_level "
590 cout <<
"wreath_product::element_image_of_low_level done" << endl;
617 if (!
F->is_scalar_multiple_of_identity_matrix(
630 int f_v = (verbose_level >= 1);
635 cout <<
"wreath_product::element_mult" << endl;
646 cout <<
"wreath_product::element_mult done" << endl;
652 int f_v = (verbose_level >= 1);
655 cout <<
"wreath_product::element_move" << endl;
666 cout <<
"wreath_product::element_move done" << endl;
672 int f_v = (verbose_level >= 1);
677 cout <<
"wreath_product::element_invert" << endl;
685 cout <<
"wreath_product::element_invert done" << endl;
710 int *v_in,
int *v_out,
int verbose_level)
712 int f_v = (verbose_level >= 1);
716 cout <<
"wreath_product::apply_permutation" << endl;
719 cout <<
"wreath_product::apply_permutation perm=";
724 cout <<
"wreath_product::apply_permutation v_in=";
734 cout <<
"wreath_product::apply_permutation induced_perm=";
745 cout <<
"wreath_product::apply_permutation" << endl;
747 cout <<
"i : in[i] : perm[i] : out[i] " << endl;
749 cout << setw(3) << i <<
" & " << setw(3) << v_in[i]
751 <<
" & " << setw(3) << v_out[i] << endl;
755 cout <<
"wreath_product::apply_permutation v_out=";
760 cout <<
"wreath_product::apply_permutation done" << endl;
771 int f_v = (verbose_level >= 1);
775 cout <<
"wreath_product::create_matrix" << endl;
791 cout <<
"wreath_product::create_matrix "
792 "after step " << f <<
":" << endl;
799 cout <<
"wreath_product::create_matrix done" << endl;
808 elt[f] = (
uchar) Elt[f];
883 int f,
int *Elt_component)
912 int f_v = (verbose_level >= 1);
916 cout <<
"wreath_product::make_element" << endl;
919 cout <<
"wreath_product::make_element data:" << endl;
933 cout <<
"wreath_product::make_element created this element:" << endl;
937 cout <<
"wreath_product::make_element done" << endl;
946 ost << Elt[f] <<
",";
957 ost <<
"begin element of wreath product: " << endl;
967 ost <<
"factor " << f <<
":" << endl;
970 ost <<
"end element of wreath product" << endl;
982 ost <<
"; \\;" << endl;
994 ost <<
"\\right)" << endl;
999 int f_v = (verbose_level >= 1);
1003 cout <<
"wreath_product::compute_base_and_transversals" << endl;
1020 cout <<
"wreath_product::compute_base_and_transversals "
1021 "h != base_length (1)" << endl;
1035 cout <<
"wreath_product::compute_base_and_transversals "
1036 "h != base_length (2)" << endl;
1040 cout <<
"wreath_product::compute_base_and_transversals done" << endl;
1045 int &size,
int &nb_gens,
int verbose_level)
1047 int f_v = (verbose_level >= 1);
1056 cout <<
"wreath_product::make_strong_generators_data" << endl;
1059 cout <<
"wreath_product::make_strong_generators_data "
1060 "before strong_generators_for_general_linear_group" << endl;
1069 GL_data, GL_size, GL_nb_gens,
1073 cout <<
"wreath_product::make_strong_generators_data "
1074 "after strong_generators_for_general_linear_group" << endl;
1079 data =
NEW_int(nb_gens * size);
1085 for (g = 0; g < GL_nb_gens; g++) {
1116 cout <<
"h != nb_gens" << endl;
1121 cout <<
"wreath_product::make_strong_generators_data done" << endl;
1125 ostream &ost,
int verbose_level)
1128 int f_v = (verbose_level >= 1);
1129 int f_vv = (verbose_level >= 2);
1140 int i, j, h, a, len, N;
1141 int nb_rows, nb_cols;
1145 cout <<
"wreath_product::report_rank_one_tensors" << endl;
1146 cout <<
"wreath_product::report_rank_one_tensors "
1153 cout <<
"wreath_product::report_rank_one_tensors nb_rows = " << nb_rows << endl;
1154 cout <<
"wreath_product::report_rank_one_tensors nb_cols = " << nb_cols << endl;
1167 cout <<
"wreath_product::create_all_rank_one_tensors "
1173 ost <<
"{\\renewcommand{\\arraystretch}{1.1}" << endl;
1174 ost <<
"$$" << endl;
1175 ost <<
"\\begin{array}{|r|r|r|r|r|r|}" << endl;
1176 ost <<
"\\hline" << endl;
1180 if (i && (i % 10) == 0) {
1181 ost <<
"\\end{array}" << endl;
1182 ost <<
"$$" << endl;
1183 ost <<
"$$" << endl;
1184 ost <<
"\\begin{array}{|r|r|r|r|r|r|}" << endl;
1185 ost <<
"\\hline" << endl;
1198 ost <<
" & " << endl;
1200 ost <<
" & " << endl;
1202 ost <<
"\\left[" << endl;
1205 ost <<
"\\right]" << endl;
1209 cout <<
"wreath_product::create_all_rank_one_tensors " << i
1211 cout <<
"projections: ";
1212 for (j = 0; j < len; j++) {
1213 cout << projections[j] <<
" ";
1228 place_binary(j,
u,
v);
1229 T[
u * nb_cols +
v] = 1;
1233 cout <<
"wreath_product::create_all_rank_one_tensors " << i
1237 cout << tensor[j] <<
" ";
1251 ost <<
" & " << endl;
1252 ost <<
"\\left[" << endl;
1254 ost <<
"\\right]" << endl;
1261 ost <<
"\\\\" << endl;
1262 ost <<
"\\hline" << endl;
1264 ost <<
"\\end{array}" << endl;
1265 ost <<
"$$}" << endl;
1277static void dimensions(
int n,
int &nb_rows,
int &nb_cols)
1281 place_binary(n - 1, i, j);
1286static void place_binary(
long int h,
int &i,
int &j)
1295 for (c = 0; h; c++) {
1315 uint32_t *&rank_one_tensors,
1316 int &nb_rank_one_tensors,
int verbose_level)
1318 int f_v = (verbose_level >= 1);
1319 int f_vv = (verbose_level >= 5);
1327 int i, j, h, a, len, N;
1331 cout <<
"wreath_product::create_all_rank_one_tensors" << endl;
1334 cout <<
"wreath_product::create_all_rank_one_tensors requires q == 2" << endl;
1344 cout <<
"wreath_product::create_all_rank_one_tensors "
1357 cout <<
"wreath_product::create_all_rank_one_tensors " << i
1359 cout <<
"projections: ";
1360 for (j = 0; j < len; j++) {
1361 cout << projections[j] <<
" ";
1375 cout <<
"wreath_product::create_all_rank_one_tensors " << i
1379 cout << tensor[j] <<
" ";
1408 cout <<
"wreath_product::create_all_rank_one_tensors done" << endl;
1476 int f_v = (verbose_level >= 1);
1479 cout <<
"wreath_product::save_rank_one_tensors" << endl;
1483 sprintf(fname,
"rank_one_tensors_q%d_f%d.txt",
q,
nb_factors);
1496 cout <<
"wreath_product::save_rank_one_tensors done" << endl;
1502 int f_v = (verbose_level >= 1);
1507 long int nb_processed;
1508 std::deque<uint32_t> D;
1510 long int one_percent;
1514 cout <<
"wreath_product::compute_tensor_ranks" << endl;
1521 sprintf(fname1,
"tensor_q%d_w%d_ranks.bin",
q,
nb_factors);
1522 sprintf(fname2,
"tensor_q%d_w%d_ranks_prev.bin",
q,
nb_factors);
1526 cout <<
"wreath_product::compute_tensor_ranks nb_rank_one_tensors = " <<
nb_rank_one_tensors << endl;
1537 cout <<
"reading tensor ranks from file" << endl;
1540 ifstream fp(fname1, ios::binary);
1544 fp.read((
char *) &d,
sizeof(
long int));
1546 cout <<
"d != degree_of_tensor_action + 1" << endl;
1549 for (i = 0; i < d; i++) {
1550 fp.read((
char *) &
TR [i],
sizeof(
char));
1553 cout <<
"reading tensor ranks from file done" << endl;
1555 cout <<
"reading Prev from file:" << endl;
1557 ifstream fp(fname2, ios::binary);
1561 fp.read((
char *) &d,
sizeof(
long int));
1563 cout <<
"d != degree_of_tensor_action + 1" << endl;
1566 for (i = 0; i < d; i++) {
1567 fp.read((
char *) &
Prev [i],
sizeof(uint32_t));
1570 cout <<
"reading Prev from file done" << endl;
1574 cout <<
"computing tensor ranks:" << endl;
1579 D.push_back((uint32_t) 0);
1589 cout <<
"wreath_product::compute_tensor_ranks sz < degree_of_tensor_action + 1 and D.empty()" << endl;
1590 cout <<
"sz=" << sz << endl;
1597 cout <<
"wreath_product::compute_tensor_ranks expanding " << a <<
" of rank " << r <<
", sz=" << sz << endl;
1604 cout <<
"wreath_product::compute_tensor_ranks expanding generator " << i <<
" = " << b <<
" maps " << a <<
" to " << c << endl;
1608 cout <<
"wreath_product::compute_tensor_ranks expanding generator setting tensor rank of " << c <<
" to " << r + 1 << endl;
1614 if (sz % one_percent == 0) {
1615 cout <<
"wreath_product::compute_tensor_ranks "
1616 << sz / one_percent <<
" % of tree completed, size of "
1617 "queue is " << D.size() <<
" = "
1623 cout <<
"wreath_product::compute_tensor_ranks expanding generator setting tensor rank of " << c <<
" is " << (int)
TR[c] <<
" skipping" << endl;
1629 if (nb_processed % one_percent == 0) {
1630 cout <<
"wreath_product::compute_tensor_ranks "
1631 << nb_processed / one_percent <<
" % processed, size of "
1632 "queue is " << D.size() <<
" = "
1634 <<
" % tree at " << sz / one_percent <<
" %" << endl;
1638 cout <<
"wreath_product::compute_tensor_ranks TR:" << endl;
1640 cout << i <<
" : " << (int)
TR[i] << endl;
1645 cout <<
"computing tensor ranks done." << endl;
1648 cout <<
"writing TR to file:" << endl;
1650 ofstream fp(fname1, ios::binary);
1655 fp.write((
char *) &d,
sizeof(
long int));
1656 for (i = 0; i < d; i++) {
1657 fp.write((
char *) &
TR [i],
sizeof(
char));
1661 cout <<
"writing Prev to file:" << endl;
1663 ofstream fp(fname2, ios::binary);
1668 fp.write((
char *) &d,
sizeof(
long int));
1669 for (i = 0; i < d; i++) {
1670 fp.write((
char *) &
Prev [i],
sizeof(uint32_t));
1677 cout <<
"computing maximum tensor rank:" << endl;
1686 cout <<
"wreath_product::compute_tensor_ranks max tensor rank = " << m << endl;
1688 long int *Nb_by_rank;
1691 cout <<
"computing Nb_by_rank:" << endl;
1694 for (i = 0; i <= m; i++) {
1702 cout <<
"number of tensors by rank:" << endl;
1703 for (i = 0; i <= m; i++) {
1704 cout << i <<
" : " << Nb_by_rank[i] << endl;
1714 cout <<
"q == 2 && nb_factors == 5" << endl;
1730 for (i = 0; i < N; i++) {
1741 cout <<
"tensor ranks of orbit representatives:" << endl;
1742 cout <<
"i : orbit length[i] : PG rank of rep[i] : tensor rank [i] : affine rank of rep(i) : rank one decomposition" << endl;
1743 for (i = 0; i < N; i++) {
1746 cout << i <<
" : " << L[i] <<
" : " << a <<
" : " << R[i] <<
" : " << S[i] <<
" : ";
1749 cout << (
Prev[s] ^ s);
1770 nb_types, verbose_level);
1772 cout <<
"classification of orbit reps by tensor rank:" << endl;
1775 for (
int t = 0; t < nb_types; t++) {
1776 cout <<
"working on type " << t <<
" of value " << types[t] <<
":" << endl;
1777 cout <<
"There are " << SoS->
Set_size[t] <<
" orbits" << endl;
1783 for (s = 0; s < SoS->
Set_size[t]; s++) {
1784 a = SoS->
Sets[t][s];
1787 Ago[s] = 933120 / L[s];
1793 cout <<
"classification of orbit lengths for tensor rank " << types[t] <<
":" << endl;
1798 cout <<
"classification of ago for tensor rank " << types[t] <<
":" << endl;
1813 cout <<
"q == 2 && nb_factors == 4" << endl;
1827 for (i = 0; i < N; i++) {
1836 cout <<
"R[i]=" << R[i] << endl;
1839 cout <<
"tensor ranks of orbit representatives:" << endl;
1840 cout <<
"i : orbit length[i] : ago : PG rank of rep[i] : tensor rank [i] : affine rank of rep(i) : rank one decomposition" << endl;
1841 for (i = 0; i < N; i++) {
1845 cout << i <<
" : " << L[i] <<
" : " << ago <<
" : " << a <<
" : " << R[i] <<
" : " << S[i] <<
" : ";
1848 cout << (
Prev[s] ^ s);
1869 nb_types, verbose_level);
1871 cout <<
"classification of orbit reps by tensor rank:" << endl;
1874 for (
int t = 0; t < nb_types; t++) {
1875 cout <<
"working on type " << t <<
" of value " << types[t] <<
":" << endl;
1876 cout <<
"There are " << SoS->
Set_size[t] <<
" orbits" << endl;
1882 for (s = 0; s < SoS->
Set_size[t]; s++) {
1883 a = SoS->
Sets[t][s];
1886 Ago[s] = 31104 / L[s];
1892 cout <<
"classification of orbit lengths for tensor rank " << types[t] <<
":" << endl;
1897 cout <<
"classification of ago for tensor rank " << types[t] <<
":" << endl;
1914 cout <<
"wreath_product::compute_tensor_ranks done" << endl;
1920 int f_v = (verbose_level >= 1);
1923 cout <<
"wreath_product::report" << endl;
1925 ost <<
"\\section*{Wreath product group}" << endl << endl;
1928 ost <<
"Group name: $" <<
label_tex <<
"$\\\\" << endl;
1929 ost <<
"Number of factors: " <<
nb_factors <<
"\\\\" << endl;
1939 ost <<
"\\bigskip" << endl << endl;
1941 ost <<
"\\section*{Rank One Tensors}" << endl << endl;
1959 ost <<
" : " << a <<
" : " << b <<
"\\\\" << endl;
1973 cout <<
"wreath_product::report done" << endl;
1981 int &nb_gens,
int °ree,
1985 int f_v = (verbose_level >= 1);
1987 int *generator_stack;
1988 int **generators_transposed;
1995 cout <<
"wreath_product::compute_permutations_and_write_to_file" << endl;
2001 mtx_n2 = mtx_n * mtx_n;
2006 for (h = 0; h < SG->
gens->
len; h++) {
2008 cout <<
"generator " << h <<
" / "
2009 << SG->
gens->
len <<
" is: " << endl;
2018 cout <<
"wreath_product::compute_permutations_and_write_to_file matrix:" << endl;
2021 generators_transposed[h] =
NEW_int(mtx_n2);
2024 generator_stack + h * mtx_n2,
2025 generators_transposed[h], mtx_n, mtx_n);
2031 cout <<
"wreath_product::compute_permutations_and_write_to_file generator_stack:" << endl;
2036 cout <<
"wreath_product::compute_permutations_and_write_to_file generators transposed:" << endl;
2037 for (
size_t h = 0; h < SG->
gens->
len; h++) {
2038 int_matrix_print(generators_transposed[h], mtx_n, mtx_n);
2042 cout <<
"wreath_product::compute_permutations_and_write_to_file perms:" << endl;
2044 cout <<
"mtx_n=" << mtx_n << endl;
2045 cout <<
"SG->gens->len * mtx_n=" << SG->
gens->
len * mtx_n << endl;
2049 linalg::Matrix<int>
v (mtx_n, 1);
2057 vector<linalg::Matrix<char>> N (SG->
gens->
len);
2058 for (
size_t h = 0; h < N.size(); ++h) {
2059 N[h].INIT(mtx_n, mtx_n);
2061 for (
size_t i=0; i < mtx_n; ++i)
2062 for (
size_t j = 0; j < mtx_n; ++j) {
2063 N[h].matrix_[i*mtx_n+j] = generator_stack [h * mtx_n2 + i * mtx_n + j];
2069 for (
size_t h=0; h<N.size(); ++h) {
2070 printf(
"=========================================================\n");
2071 printf(
"h = %ld\n", h);
2072 printf(
"=========================================================\n");
2074 linalg::print(N[h]);
2076 printf(
"=========================================================\n");
2096 cout <<
"W->degree_of_tensor_action - 1 does not fit into a unsigned int" << endl;
2101 cout <<
"W->degree_of_tensor_action fits into a unsigned int, this is good" << endl;
2107 int block_size = 1L << 28;
2110 cout <<
"wreath_product::compute_permutations_and_write_to_file block_size=" << block_size << endl;
2116 cout <<
"wreath_product::compute_permutations_and_write_to_file nb_blocks=" << nb_blocks << endl;
2128 cout <<
"wreath_product::compute_permutations_and_write_to_file before allocating T, "
2129 "an unsigned int array of size " << block_size << endl;
2132 unsigned int* T =
new unsigned int [block_size];
2136 cout <<
"wreath_product::compute_permutations_and_write_to_file after allocating T, "
2137 "an unsigned int array of size " << block_size << endl;
2145 for (b = 0; b < nb_blocks; ++b) {
2147 cout <<
"wreath_product::compute_permutations_and_write_to_file block b=" << b <<
" / " << nb_blocks << endl;
2155 cout <<
"wreath_product::compute_permutations_and_write_to_file l=" << l << endl;
2163 M->init(mtx_n, l, 0 );
2166 cout <<
"wreath_product::compute_permutations "
2167 "unranking the elements of the PG to the bitmatrix" << endl;
2169 M->unrank_PG_elements_in_columns_consecutively(
2170 F, (
long int) b * (
long int) block_size,
2175 cout <<
"wreath_product::compute_permutations_and_write_to_file unranking the elements of the PG" << endl;
2178 for (
size_t i=0; i<l; ++i) {
2179 if ((i % l1) == 0) {
2180 cout <<
"block b=" << b <<
", " << i / l1 <<
" % done unranking" << endl;
2182 W->F->PG_element_unrank_modified_lint (
v.matrix_, 1, mtx_n,
2183 (
long int) b * (
long int) block_size + (
long int)i) ;
2184 for (
size_t j=0; j<mtx_n; ++j)
2190 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2191 "unranking the elements of the PG done" << endl;
2201 NM->
init(mtx_n, l, 0 );
2204 for (h = 0; h < SG->
gens->
len; ++h) {
2206 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2207 "generator h=" << h <<
" / " << SG->
gens->
len << endl;
2229 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2230 "before CPU multiplication" << endl;
2236 M->mult_int_matrix_from_the_left(
2237 generators_transposed[h], mtx_n, mtx_n,
2240 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2241 "after CPU multiplication" << endl;
2244 cout <<
"the multiplication took ";
2254 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2255 "before ranking the elements of the PG" << endl;
2258 F, perms + h * mtx_n, T,
2262 for (
size_t i=0; i<l; ++i) {
2263 if ((i % l1) == 0) {
2264 cout <<
"h=" << h <<
", b=" << b <<
", " << i/l1 <<
" % done ranking" << endl;
2266 for (
size_t j=0; j<mtx_n; ++j) {
2267 int a = perms[h * mtx_n + j];
2268 v.matrix_[a*
v.alloc_cols] = MN (i, j);
2272 W->F->PG_element_rank_modified_lint (
v.matrix_, 1, mtx_n, res);
2273 T [i] = (
unsigned int) res;
2277 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2278 "after ranking the elements of the PG" << endl;
2283 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2284 "writing to file:" << endl;
2290 ofstream fp(fname, ios::binary);
2292 fp.write((
char *) &l,
sizeof(
int));
2293 for (
int i = 0; i < l; i++) {
2294 fp.write((
char *) &T [i],
sizeof(
int));
2300 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2301 "written file " << fname << endl;
2309 cout <<
"wreath_product::compute_permutations_and_write_to_file "
2310 "the case h=" << h <<
", b=" << b
2311 <<
" has already been done" << endl;
2325 for (
unsigned int i=0; i < W->degree_of_tensor_action; ++i) {
2326 if (S[i] == i) ++nb_orbits;
2328 cout <<
"nb_orbits: " << nb_orbits << endl;
2330 long int *orbit_length;
2331 long int *orbit_rep;
2333 orbit_length =
NEW_lint(nb_orbits);
2336 for (
int i = 0; i < nb_orbits; i++) {
2337 orbit_length[i] = 0;
2341 for (
unsigned int i=0; i < W->degree_of_tensor_action; ++i) {
2347 cout <<
"the orbit representatives are: " << endl;
2348 for (
int i = 0; i < nb_orbits; i++) {
2349 cout << i <<
" : " << orbit_rep[i] << endl;
2386 cout <<
"wreath_product::compute_permutations done" << endl;
2393 sprintf(fname,
"w%d_h%d_b%d.bin",
nb_factors, h, b);
2414 int &nb_gens,
int °ree,
2418 int f_v = (verbosity >= 1);
2421 cout <<
"wreath_product::orbits_using_files_and_union_find" << endl;
2424 long int j, r, orbit_idx, rep;
2425 long int nb_orbits = 0;
2434 int block_size = 1L << 28;
2437 cout <<
"block_size=" << block_size << endl;
2443 cout <<
"nb_blocks=" << nb_blocks << endl;
2448 cout <<
"allocating S, an unsigned int array of size "
2460 cout <<
"allocating T, an unsigned int array of size "
2470 for (h = 0; h < SG->
gens->
len; ++h) {
2472 cout <<
"wreath_product::orbits_using_files_and_union_find "
2473 "generator h=" << h <<
" / " << SG->
gens->
len << endl;
2476 for (b = 0; b < nb_blocks; ++b) {
2478 cout <<
"wreath_product::orbits_using_files_and_union_find "
2479 "block b=" << b <<
" / " << nb_blocks << endl;
2485 cout <<
"wreath_product::orbits_using_files_and_union_find "
2493 cout <<
"file does not exist h=" << h <<
" b=" << b << endl;
2501 cout <<
"wreath_product::orbits_using_files_and_union_find "
2502 "reading from file " << fname << endl;
2505 ifstream fp(fname, ios::binary);
2508 fp.read((
char *) &l1,
sizeof(
int));
2510 cout <<
"l1 != l" << endl;
2512 for (
int i = 0; i < l; i++) {
2513 fp.read((
char *) &T [b * block_size + i],
sizeof(
int));
2519 cout <<
"wreath_product::orbits_using_files_and_union_find "
2520 "read file " << fname << endl;
2529 cout <<
"wreath_product::orbits_using_files_and_union_find "
2530 "performing the union-find for generator " << h
2531 <<
" / " << SG->
gens->
len <<
":" << endl;
2540 if ((i % l1) == 0) {
2541 cout << i/l1 <<
" % done with union-find" << endl;
2544 unsigned int t = T[i];
2562 cout <<
"wreath_product::orbits_using_files_and_union_find Done with the loop" << endl;
2563 cout <<
"wreath_product::orbits_using_files_and_union_find Computing the orbit representatives" << endl;
2573 cout <<
"wreath_product::orbits_using_files_and_union_find nb_orbits: " << nb_orbits << endl;
2576 long int *orbit_length;
2577 long int *orbit_rep;
2579 orbit_length =
NEW_lint(nb_orbits);
2582 for (i = 0; i < nb_orbits; i++) {
2583 orbit_length[i] = 0;
2593 cout <<
"wreath_product::orbits_using_files_and_union_find the orbit representatives are: " << endl;
2594 for (
int i = 0; i < nb_orbits; i++) {
2595 cout << i <<
", " << orbit_rep[i] <<
", " << endl;
2599 cout <<
"wreath_product::orbits_using_files_and_union_find Path compression:" << endl;
2606 cout <<
"wreath_product::orbits_using_files_and_union_find Path compression done" << endl;
2618 cout <<
"wreath_product::orbits_using_files_and_union_find "
2619 "goi=" << goi << endl;
2623 Orbit = (uint32_t *)
NEW_int(goi);
2626 cout <<
"wreath_product::orbits_using_files_and_union_find "
2627 "determining the orbits: " << endl;
2629 for (orbit_idx = 0; orbit_idx < nb_orbits; orbit_idx++) {
2631 rep = orbit_rep[orbit_idx];
2635 cout <<
"wreath_product::orbits_using_files_and_union_find "
2636 "determining orbit " << orbit_idx <<
" / " << nb_orbits
2637 <<
" with rep " << rep << endl;
2644 orbit_length[orbit_idx] = len;
2646 cout <<
"wreath_product::orbits_using_files_and_union_find "
2647 "orbit " << orbit_idx <<
" / " << nb_orbits <<
" has length " << len << endl;
2649 char fname_orbit[1000];
2651 sprintf(fname_orbit,
"wreath_q%d_w%d_orbit_%ld.bin",
q,
nb_factors, orbit_idx);
2653 cout <<
"Writing the file " << fname_orbit << endl;
2656 ofstream fp(fname_orbit, ios::binary);
2658 fp.write((
char *) &len,
sizeof(uint32_t));
2659 for (i = 0; i < (
long int) len; i++) {
2660 fp.write((
char *) &Orbit[i],
sizeof(uint32_t));
2664 cout <<
"We are done writing the file " << fname_orbit << endl;
2670 cout <<
"wreath_product::orbits_using_files_and_union_find the orbits are: " << endl;
2671 for (
int orbit_idx = 0; orbit_idx < nb_orbits; orbit_idx++) {
2672 cout << orbit_idx <<
", " << orbit_rep[orbit_idx] <<
", " << orbit_length[orbit_idx] <<
", " << endl;
2677 cout <<
"wreath_product::orbits_using_files_and_union_find done" << endl;
2686 int &nb_gens,
int °ree,
2688 std::string &orbits_restricted_fname,
2691 int f_v = (verbose_level >= 1);
2695 cout <<
"wreath_product::orbits_restricted "
2696 "orbits_restricted_fname=" << orbits_restricted_fname << endl;
2704 long int *Set_in_PG;
2709 long int i, j, b, h;
2712 Set, set_m, set_n, verbose_level);
2715 cout <<
"orbits_restricted set_n != 1" << endl;
2719 cout <<
"Restricting to a set of size " << set_m << endl;
2720 cout <<
"converting points to PG point labels" << endl;
2727 for (i = 0; i < set_m; i++) {
2734 cout <<
"after sorting, Set_in_PG:" << endl;
2735 for (i = 0; i < set_m; i++) {
2736 cout << i <<
" : " << Set_in_PG[i] << endl;
2746 int block_size = 1L << 28;
2749 cout <<
"block_size=" << block_size << endl;
2755 cout <<
"nb_blocks=" << nb_blocks << endl;
2758 restr_first =
NEW_int(nb_blocks);
2759 restr_length =
NEW_int(nb_blocks);
2761 for (b = 0; b < nb_blocks; b++) {
2764 cout <<
"block b=" << b <<
" / " << nb_blocks << endl;
2772 restr_first[b] = idx;
2775 for (b = 0; b < nb_blocks; b++) {
2776 cout << b <<
" : " << restr_first[b] << endl;
2779 for (b = nb_blocks - 1; b >= 0; b--) {
2781 cout <<
"b=" << b << endl;
2783 if (b == nb_blocks - 1) {
2784 restr_length[b] = set_m - restr_first[b];
2787 restr_length[b] = restr_first[b + 1] - restr_first[b];
2791 for (b = 0; b < nb_blocks; b++) {
2792 cout << b <<
" : " << restr_first[b] <<
" : " << restr_length[b] << endl;
2802 cout <<
"allocating T, an unsigned int array of size " << block_size << endl;
2805 unsigned int* T =
new unsigned int [block_size];
2811 for (h = 0; h < SG->
gens->
len; ++h) {
2813 cout <<
"generator h=" << h <<
" / " << SG->
gens->
len << endl;
2816 for (
int b = 0; b < nb_blocks; ++b) {
2818 cout <<
"block b=" << b <<
" / " << nb_blocks << endl;
2824 cout <<
"l=" << l << endl;
2832 cout <<
"file does not exist h=" << h <<
" b=" << b << endl;
2839 cout <<
"reading from file " << fname << endl;
2842 ifstream fp(fname, ios::binary);
2845 fp.read((
char *) &l1,
sizeof(
int));
2847 cout <<
"l1 != l" << endl;
2849 for (
int i = 0; i < l; i++) {
2850 fp.read((
char *) &T [i],
sizeof(
int));
2854 cout <<
"read file " << fname << endl;
2859 for (
long int u = 0;
u < restr_length[b];
u++) {
2860 i = restr_first[b] +
u;
2862 if (x < b * block_size) {
2863 cout <<
"x < b * block_size" << endl;
2864 cout <<
"x=" << x <<
" b=" << b << endl;
2867 if (x >= (b + 1) * block_size) {
2868 cout <<
"x >= (b + 1) * block_size" << endl;
2869 cout <<
"x=" << x <<
" b=" << b << endl;
2872 y = T[x - b * block_size];
2876 cout <<
"did not find element y=" << y <<
" in Set_in_PG "
2877 "under generator h=" << h <<
", something is wrong" << endl;
2878 cout <<
"x=" << x << endl;
2884 cout <<
"affine rank s=" << s << endl;
2886 cout <<
"y=" << y << endl;
2892 cout <<
"affine rank s=" << s << endl;
2897 Perms[i * SG->
gens->
len + h] = j;
2907 fname.assign(orbits_restricted_fname);
2910 fname.append(
"_restricted_action.txt");
2914 cout <<
"wreath_product::orbits_restricted done" << endl;
2922 int &nb_gens,
int °ree,
2924 std::string &orbits_restricted_fname,
2927 int f_v = (verbose_level >= 1);
2930 cout <<
"wreath_product::orbits_restricted_compute "
2931 "orbits_restricted_fname=" << orbits_restricted_fname << endl;
2938 long int *Set_in_PG;
2943 Set, set_m, set_n, verbose_level);
2946 cout <<
"orbits_restricted set_n != 1" << endl;
2950 cout <<
"Restricting to a set of size " << set_m << endl;
2951 cout <<
"converting points to PG point labels" << endl;
2958 for (i = 0; i < set_m; i++) {
2965 cout <<
"after sorting, Set_in_PG:" << endl;
2968 for (i = 0; i < set_m; i++) {
2969 cout << i <<
" : " << Set_in_PG[i] << endl;
2982 int perms_m, perms_n;
2984 fname.assign(orbits_restricted_fname);
2987 fname.append(
"_restricted_action.txt");
2989 if (perms_n != SG->
gens->
len) {
2990 cout <<
"perms_n != SG->gens->len" << endl;
2993 if (perms_m != set_m) {
2994 cout <<
"perms_m != set_m" << endl;
3013 cout <<
"created A_perm = " << A_perm->
label << endl;
3023 cout <<
"created A_perm_matrix = " << A_perm_matrix->
label << endl;
3034 Gens->
init(A_perm, verbose_level - 2);
3036 for (i = 0; i < SG->
gens->
len; i++) {
3038 Permutation_representation->
Elts
3050 Sch->
init(A_perm, verbose_level - 2);
3055 cout <<
"before Sch->compute_all_point_orbits" << endl;
3059 cout <<
"after Sch->compute_all_point_orbits" << endl;
3070 cout <<
"Action " << A->
label << endl;
3071 cout <<
"group order " << go << endl;
3072 cout <<
"computing stabilizers:" << endl;
3076 cout <<
"wreath_product::orbits_restricted_compute looping over all orbits" << endl;
3080 for (orbit_idx = 0; orbit_idx < Sch->
nb_orbits; orbit_idx++) {
3082 cout <<
"computing point stabilizer for orbit " << orbit_idx <<
":" << endl;
3086 long int orbit_rep_in_PG;
3087 uint32_t orbit_rep_in_PG_uint;
3091 orbit_rep_in_PG = Set_in_PG[orb_rep];
3102 cout <<
"orbit representative is " << orb_rep <<
" = " << orbit_rep_in_PG <<
" = " << orbit_rep_in_PG_uint << endl;
3110 cout <<
"before Sch->point_stabilizer in action " << A_perm_matrix->
label << endl;
3113 Stab, orbit_idx, verbose_level - 5);
3115 cout <<
"after Sch->point_stabilizer in action " << A_perm_matrix->
label << endl;
3121 gens->
init(A_perm_matrix);
3133 cout <<
"computing restricted action on the orbit:" << endl;
3139 cout <<
"generators restricted to the orbit of degree " << Orbits->
Set_size[orbit_idx] - 1 <<
":" << endl;
3144 sims *derived_group;
3150 cout <<
"computing the derived subgroup:" << endl;
3153 derived_group->
init(A_perm_matrix, verbose_level - 2);
3161 cout <<
"the derived subgroup has order: " << d_go << endl;
3167 d_gens->
init(A_perm_matrix);
3177 cout <<
"computing orbits of stabilizer on the rest of the orbit:" << endl;
3186 cout <<
"Found " << Sch_orbit->
nb_orbits <<
" orbits" << endl;
3198 cout <<
"wreath_product::orbits_restricted_compute done" << endl;
generators for various classes of groups
void general_linear_matrix_group_base_and_transversal_length(int n, field_theory::finite_field *F, int f_semilinear, int base_len, int degree, long int *base, int *transversal_length, int verbose_level)
int matrix_group_base_len_general_linear_group(int n, int q, int f_semilinear, int verbose_level)
void strong_generators_for_general_linear_group(int n, field_theory::finite_field *F, int f_semilinear, int *&data, int &size, int &nb_gens, int verbose_level)
a collection of combinatorial functions
void perm_inverse(int *a, int *b, long int n)
void perm_mult(int *a, int *b, int *c, long int n)
void perm_print(std::ostream &ost, int *a, int n)
void perm_identity(int *a, long int n)
void perm_elementary_transposition(int *a, long int n, int f)
catch all class for algorithms
uint32_t root_of_tree_uint32_t(uint32_t *S, uint32_t i)
matrices over GF(2) stored as bitvectors
void init(int m, int n, int verbose_level)
void rank_PG_elements_in_columns(field_theory::finite_field *F, int *perms, unsigned int *PG_ranks, int verbose_level)
a catch-all container class for everything related to data structures
int bitvector_s_i(uchar *bitvec, long int i)
void bitvector_m_ii(uchar *bitvec, long int i, int a)
bulk storage of group elements in compressed form
void init(int entry_size, int page_length_log, int verbose_level)
a collection of functions related to sorted vectors
int lint_vec_search(long int *v, int len, long int a, int &idx, int verbose_level)
void lint_vec_heapsort(long int *v, int len)
a statistical analysis of data consisting of single integers
void init(int *data, int data_length, int f_second, int verbose_level)
data_structures::set_of_sets * get_set_partition_and_types(int *&types, int &nb_types, int verbose_level)
void print_naked_tex(std::ostream &ost, int f_backwards)
void print_naked(int f_backwards)
void PG_element_unrank_modified_lint(int *v, int stride, int len, long int a)
linear_algebra::linear_algebra * Linear_algebra
void PG_element_rank_modified_lint(int *v, int stride, int len, long int &a)
various functions related to geometries
void AG_element_unrank(int q, int *v, int stride, int len, long int a)
long int AG_element_rank(int q, int *v, int stride, int len)
provides access to pre-computed combinatorial data in encoded form
int tensor_orbits_nb_reps(int n)
long int * tensor_orbits_rep(int n, int idx)
void mult_vector_from_the_left(int *v, int *A, int *vA, int m, int n)
int is_identity_matrix(int *A, int n)
void identity_matrix(int *A, int n)
void transpose_matrix(int *A, int *At, int ma, int na)
void Kronecker_product_square_but_arbitrary(int *A, int *B, int na, int nb, int *AB, int &N, int verbose_level)
basic number theoretic functions
int i_power_j(int i, int j)
long int i_power_j_lint_safe(int i, int j, int verbose_level)
a collection of functions related to file io
void lint_matrix_write_csv(std::string &fname, long int *M, int m, int n)
void int_matrix_read_csv(std::string &fname, int *&M, int &m, int &n, int verbose_level)
long int file_size(std::string &fname)
void lint_matrix_read_csv(std::string &fname, long int *&M, int &m, int &n, int verbose_level)
interface to create latex output files
void int_matrix_print_tex(std::ostream &ost, int *p, int m, int n)
interface to system functions
void time_check_delta(std::ostream &ost, int dt)
a class to represent arbitrary precision integers
a permutation group in a fixed action.
action * restricted_action(long int *points, int nb_points, int verbose_level)
void element_print_quick(void *elt, std::ostream &ost)
void element_move(void *a, void *b, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
void init_permutation_representation(action *A_original, int f_stay_in_the_old_action, data_structures_groups::vector_ge *gens, int *Perms, int degree, int verbose_level)
void all_point_orbits_from_generators(groups::schreier &Schreier, groups::strong_generators *SG, int verbose_level)
void element_print_as_permutation(void *elt, std::ostream &ost)
to hold a vector of group elements
void allocate(int length, int verbose_level)
void init(actions::action *A, int verbose_level)
a matrix group over a finite field in projective, vector space or affine action
void GL_print_easy(int *Elt, std::ostream &ost)
void GL_invert(int *A, int *Ainv)
void GL_print_for_make_element(int *Elt, std::ostream &ost)
void GL_invert_internal(int *A, int *Ainv, int verbose_level)
void GL_mult(int *A, int *B, int *AB, int verbose_level)
void make_element(int *Elt, int *data, int verbose_level)
void GL_print_latex(int *Elt, std::ostream &ost)
void GL_copy(int *A, int *B)
field_theory::finite_field * GFq
a domain for permutation groups whose elements are given in the permutation representation
void init(int degree, int page_length_log, int verbose_level)
homomorphism to a permutation group
Schreier trees for orbits of groups on points.
void compute_all_point_orbits(int verbose_level)
void orbits_as_set_of_sets(data_structures::set_of_sets *&S, int verbose_level)
void print_orbit_lengths_tex(std::ostream &ost)
void init_generators(data_structures_groups::vector_ge &generators, int verbose_level)
void point_stabilizer(actions::action *default_action, ring_theory::longinteger_object &go, groups::sims *&Stab, int orbit_no, int verbose_level)
void init(actions::action *A, int verbose_level)
void print_and_list_orbits_tex(std::ostream &ost)
a permutation group represented via a stabilizer chain
void init(actions::action *A, int verbose_level)
void group_order(ring_theory::longinteger_object &go)
void init_trivial_group(int verbose_level)
void build_up_subgroup_random_process(sims *G, void(*choose_random_generator_for_subgroup)(sims *G, int *Elt, int verbose_level), int verbose_level)
a strong generating set for a permutation group with respect to a fixed action
void init(actions::action *A)
void print_generators_MAGMA(actions::action *A, std::ostream &ost)
void print_generators_tex()
void init_from_sims(groups::sims *S, int verbose_level)
data_structures_groups::vector_ge * gens
void group_order(ring_theory::longinteger_object &go)
void element_unpack(uchar *elt, int *Elt)
void tensor_PG_unrank(int *tensor, long int PG_rk)
void create_matrix(int *Elt, int *A, int verbose_level)
void element_invert(int *A, int *Av, int verbose_level)
void element_print_easy(int *Elt, std::ostream &ost)
void put_digit(uchar *elt, int f, int i, int j, int d)
uint32_t PG_rank_to_affine_rank(long int PG_rk)
void report(std::ostream &ost, int verbose_level)
void element_one(int *Elt)
void unrank_point(long int a, int *v, int verbose_level)
data_structures::page_storage * Elts
void compute_tensor_ranks(int verbose_level)
void element_move(int *A, int *B, int verbose_level)
permutation_representation_domain * P
uint32_t * rank_one_tensors
void tensor_affine_unrank(int *tensor, uint32_t rk)
field_theory::finite_field * F
int element_is_one(int *Elt)
void orbits_restricted_compute(strong_generators *SG, actions::action *A, int *&result, int &nb_gens, int °ree, int nb_factors, std::string &orbits_restricted_fname, int verbose_level)
void element_print_latex(int *Elt, std::ostream &ost)
void init_tensor_wreath_product(matrix_group *M, actions::action *A_mtx, int nb_factors, int verbose_level)
long int element_image_of(int *Elt, long int a, int verbose_level)
int test_if_file_exists(int nb_factors, int h, int b)
void element_print_for_make_element(int *Elt, std::ostream &ost)
int dimension_of_tensor_action
void make_element_from_one_component(int *Elt, int f, int *Elt_component)
void make_strong_generators_data(int *&data, int &size, int &nb_gens, int verbose_level)
void compute_induced_permutation(int *Elt, int *perm)
long int affine_rank_to_PG_rank(uint32_t affine_rk)
void make_fname(char *fname, int nb_factors, int h, int b)
void apply_permutation(int *Elt, int *v_in, int *v_out, int verbose_level)
void create_all_rank_one_tensors(uint32_t *&rank_one_tensors, int &nb_rank_one_tensors, int verbose_level)
void report_rank_one_tensors(std::ostream &ost, int verbose_level)
int * the_transversal_length
void save_rank_one_tensors(int verbose_level)
long int * base_for_component
int base_len_in_component
void element_image_of_low_level(int *Elt, int *input, int *output, int verbose_level)
void make_element(int *Elt, int *data, int verbose_level)
int dimension_of_matrix_group
void orbits_using_files_and_union_find(strong_generators *SG, actions::action *A, int *&result, int &nb_gens, int °ree, int nb_factors, int verbosity)
int get_digit(uchar *elt, int f, int i, int j)
void element_pack(int *Elt, uchar *elt)
void element_mult(int *A, int *B, int *AB, int verbose_level)
long int * rank_one_tensors_in_PG_sorted
long int * rank_one_tensors_in_PG
void compute_permutations_and_write_to_file(strong_generators *SG, actions::action *A, int *&result, int &nb_gens, int °ree, int nb_factors, int verbose_level)
void orbits_restricted(strong_generators *SG, actions::action *A, int *&result, int &nb_gens, int °ree, int nb_factors, std::string &orbits_restricted_fname, int verbose_level)
long int degree_of_tensor_action
void make_element_from_permutation(int *Elt, int *perm)
void compute_base_and_transversals(int verbose_level)
long int tensor_PG_rank(int *tensor)
int degree_of_matrix_group
uint32_t tensor_affine_rank(int *tensor)
long int rank_point(int *v, int verbose_level)
#define Lint_vec_copy(A, B, C)
#define Int_vec_zero(A, B)
#define Lint_vec_print(A, B, C)
#define Int_matrix_print(A, B, C)
#define Int_vec_copy(A, B, C)
#define Int_vec_print(A, B, C)
void choose_random_generator_derived_group(sims *G, int *Elt, int verbose_level)
the orbiter library for the classification of combinatorial objects
groups::permutation_representation * Permutation_representation