15namespace layer2_discreta {
19#undef PERMUTATION_CHANGE_KIND_VERBOSE
20#undef PERMUTATION_COPY_VERBOSE
88 cout <<
"permutation::copy constructor for object: " <<
const_cast<discreta_base &
>(x) <<
"\n";
137#ifdef PERMUTATION_COPY_VERBOSE
138 cout <<
"permutation::copyobject_to()\n";
147#ifdef PERMUTATION_COPY_VERBOSE
148 cout <<
"l=" << l <<
"\n";
151#ifdef PERMUTATION_COPY_VERBOSE
152 cout <<
"calling xx.m_l()\n";
155 for (i = 0; i < l; i++) {
156#ifdef PERMUTATION_COPY_VERBOSE
157 cout <<
"copy " << i <<
": " <<
s_i(i) << endl;
177 int l, l1, first, next, len, n;
178 int f_nothing_printed_at_all =
TRUE;
182 for (l = 0; l < n; l++) {
187 if (have_seen[l].
s_i_i()) {
199 cout <<
"permutation::print_cycle: next = "
200 << next <<
" > n = " << n << endl;
207 if (have_seen[next].
s_i_i()) {
208 cout <<
"permutation::print_cycle: have_seen[next]\n";
217 f_nothing_printed_at_all =
FALSE;
236 if (f_nothing_printed_at_all) {
243 int l, l1, first, next, len, n;
244 int f_nothing_printed_at_all =
TRUE;
248 for (l = 0; l < n; l++) {
253 if (have_seen[l].
s_i_i()) {
265 cout <<
"permutation::print_cycle: next = "
266 << next <<
" > n = " << n << endl;
273 if (have_seen[next].
s_i_i()) {
274 cout <<
"permutation::print_cycle: have_seen[next]\n";
283 f_nothing_printed_at_all =
FALSE;
302 if (f_nothing_printed_at_all) {
321 istringstream ins(s);
322 scan(ins, verbose_level);
328 int f_v = (verbose_level >+ 1);
332 int i, a_last, a, dig, ci;
334 int si, largest_point = 0;
343 while (c ==
' ' || c ==
'\t') {
351 cout <<
"opening parenthesis" << endl;
355 while (c ==
' ' || c ==
'\t')
360 while (c >=
'0' && c <=
'9') {
364 while (c ==
' ' || c ==
'\t')
370 if (dig > largest_point)
373 cout <<
"digit as string: " << s <<
", numeric: " << dig << endl;
376 cout <<
"permutation::scan(): digit < 0" << endl;
384 l1 =
MAXIMUM(l + (l >> 1), largest_point + 1);
385 cout <<
"permutation::scan(): digit = " << dig <<
" >= " << l <<
", extending permutation degree to " << l1 << endl;
387 for (i = 0; i < l; i++) {
392 for (i = 0; i < l; i++) {
399 cycle.
m_ii(ci, dig + 1);
403 cout <<
"closing parenthesis, cycle = ";
404 for (i = 0; i < ci; i++)
405 cout << cycle.
s_ii(i) <<
" ";
408 for (i = 1; i < ci; i++) {
409 a_last = cycle.
s_ii(i - 1);
411 perm.
m_ii(a_last - 1, a - 1);
414 a_last = cycle.
s_ii(ci - 1);
416 perm.
m_ii(a_last - 1, a - 1);
427 while (c ==
' ' || c ==
'\t')
435 perm1.
m_l(largest_point + 1);
436 for (i = 0; i <= largest_point; i++) {
442 cout <<
"read permutation " << perm;
452 cout <<
"permutation::s_i() vector_pointer == NULL\n";
456 if ( i < 0 || i >= l ) {
457 cout <<
"permutation::s_i() addressing error, i = " << i <<
", length = " << l <<
"\n";
470 cout <<
"permutation::mult_to() this not a permutation\n";
474 cout <<
"permutation::mult_to() x is not a permutation\n";
479 cout <<
"permutation::mult_to() px.s_l() != l\n";
483 for (i = 0; i < l; i++) {
495 cout <<
"permutation::invert_to() this is not a permutation\n";
500 for (i = 0; i < l; i++) {
513 for (i = 0; i < l; i++)
522 for (i = 0; i < l; i++)
536 cout <<
"a is not a permutation\n";
542 for (i = 0; i < l1; i++) {
559void permutation::perm2lehmercode(
Vector v)
567 for (i = 0; i < vec->s_li(); ) {
568 k = vec->
s_ii(i) - 1;
571 for (j = i; j < vec->s_li(); j++)
572 if (vec->s_ii(j) > k)
586 for (i = 0; i < l; i++) {
592 for (i = 0; i < l; i++) {
607 for (i = 0; i < l; i++) {
615 for (i = 0; i < l; i++) {
643 for (i = 0; i < l; i++) {
661 int i, j, l, b, a, aa;
668 for (i = 0; i < b; i++) {
677 for (j = 0; j < l; j++) {
683 if (!B.
search(b1, &idx)) {
684 cout <<
"permutation::induce_action_on_blocks, image block not found " << *
this << endl;
685 cout <<
"block: [" << bl <<
"]" << endl;
686 cout <<
"image block: [" << b1 <<
"]" << endl;
698 int k, l, n, n3, m1, m2, m3, bm1, bm2, bm3, x;
701 n3 = n * (n - 1) * (n - 2);
706 for (m1 = 1; m1 <= n; m1++) {
707 for (m2 = m1 + 1; m2 <= n; m2++) {
708 for (m3 = m2 + 1; m3 <= n; m3++) {
709 bm1 =
s_ii(m1 - 1) + 1;
710 bm2 =
s_ii(m2 - 1) + 1;
711 bm3 =
s_ii(m3 - 1) + 1;
713 x = bm1; bm1 = bm2; bm2 = x;
716 x = bm2; bm2 = bm3; bm3 = x;
719 x = bm1; bm1 = bm2; bm2 = x;
722 for (l = bm1 + 1; l < bm2; l++)
724 for (l = 1; l < bm1; l++) {
726 x += ((n - l) * (n - l - 1)) >> 1;
734 cout <<
"permutation::induce3() k != n3" << endl;
746 int i, j,
k, i1, j1, k1, m;
750 m = (n * (n - 1)) >> 1;
752 for (i = 0; i < n - 1; i++) {
754 for (j = i + 1; j < n; j++) {
756 k = Combi.
ij2k(i, j, n);
757 k1 = Combi.
ij2k(i1, j1, n);
767 int n, m, i, j, rank, i1, j1, rank1;
775 for (rank = 0; rank < m; rank++) {
790 for (i = 0; i < n; i++)
792 for (i = 0; i < l; i++) {
794 b.
m_ii(n + i, n + j);
804 for (i = 0; i < l; i++) {
808 for (i = 0; i < n; i++)
809 b.
m_ii(l + i, l + i);
831 cout <<
"permutation::embed_at() n < l" << endl;
835 cout <<
"permutation::embed_at() at + l >= n" << endl;
850 cout <<
"permutation::remove_fixpoint(): i is not a fixpoint" << endl;
854 for (j = 0; j < l; j++) {
870 int i, j, l1, l2, l3;
876 for (i = 0; i < l1; i++) {
880 for (i = 0; i < l2; i++) {
882 m_ii(l1 + i, l1 + j);
889 int n, m, nm, i, j, rank, i1, j1, rank1;
895 for (rank = 0; rank < nm; rank++) {
911 if (i0 < 0 || i0 >= N || i1 < 0 || i1 >= N)
913 cout <<
"permutation::Add2Cycle \ni? < 0 || i? >= N" << endl;
925 if (i0 < 0 || i0 >= N || i1 < 0 ||
926 i1 >= N || i2 < 0 || i2 >= N)
928 cout <<
"permutation::Add3Cycle \ni? < 0 || i? >= N" << endl;
941 if (i0 < 0 || i0 >= N || i1 < 0 ||
942 i1 >= N || i2 < 0 || i2 >= N || i3 < 0 || i3 >= N)
944 cout <<
"permutation::Add4Cycle \ni? < 0 || i? >= N" << endl;
958 if (i0 < 0 || i0 >= N || i1 < 0 ||
959 i1 >= N || i2 < 0 || i2 >= N ||
960 i3 < 0 || i3 >= N || i4 < 0 || i4 >= N)
962 cout <<
"permutation::Add5Cycle \ni? < 0 || i? >= N" << endl;
977 if (first < 1 || first + len - 1 > N)
979 cout <<
"permutation::AddNCycle \nfirst < 1 || first+len-1 > N" << endl;
982 for (i = 0; i < len; i++)
985 m_ii(first + i - 1, first);
987 m_ii(first + i - 1, first + i + 1);
993 int f_v = (verbose_level >= 1);
995 int l, l1, first, next, len, n;
1000 for (l = 0; l < n; l++) {
1005 if (have_seen[l].
s_i_i()) {
1017 cout <<
"permutation::cycle_type: next = "
1018 << next <<
" > n = " << n << endl;
1022 if (next == first) {
1025 if (have_seen[next].
s_i_i()) {
1026 cout <<
"permutation::cycle_type: have_seen[next]\n";
1033 type.
s_ii(len - 1)++;
1036 cout <<
"the permutation " << *
this <<
" has cycle type " << type << endl;
1043 int i, l, inv = 0, ai;
1047 for (i = 1; i <= l; i++) {
1048 ai = type.
s_ii(i - 1);
1049 inv += ai * (i - 1);
1076 int l, l1, first, next, len, n;
1081 for (l = 0; l < n; l++) {
1086 if (have_seen[l].
s_i_i()) {
1095 cycle.
m_ii(len - 1, l);
1100 cout <<
"permutation::cycles: next = "
1101 << next <<
" > n = " << n << endl;
1105 if (next == first) {
1108 if (have_seen[next].
s_i_i()) {
1109 cout <<
"permutation::print_cycle: have_seen[next]\n";
1114 cycle.
m_ii(len, l1);
1127 for (i = 0; i < len; i++) {
1129 if (j > first + len) {
1130 cout <<
"permutation::restrict_to_subset() j > first + len, subset not invariant" << endl;
1134 cout <<
"permutation::restrict_to_subset() j < first, subset not invariant" << endl;
1145 int f_v = (verbose_level >= 1);
1146 int f_vv = (verbose_level >= 2);
1148 int nb_pts, nb_lines;
1149 int i, j, p1, p2, q1, q2;
1153 cout <<
"permutation::induce_on_lines_of_PG_k_q" << endl;
1160 cout <<
"nb_pts=" << nb_pts <<
" nb_lines=" << nb_lines << endl;
1162 if (
s_l() != nb_pts) {
1163 cout <<
"permutation::induce_on_lines_of_PG_k_q() s_l() != nb_pts" << endl;
1170 for (i = 0; i < nb_lines; i++) {
1173 cout <<
"L=\n" << L << endl;
1188 cout <<
"L'=\n" << L << endl;
1192 cout <<
"j=" << j << endl;
1196 cout << i <<
"=("<< p1 <<
"," << p2 <<
") -> (" << q1 <<
"," << q2 <<
") = " << j << endl;
1200 cout <<
"the permutation \n" << *
this << endl;
1201 cout <<
"on projective lines\n" << per << endl;
1207 int f_modified,
int verbose_level)
1209 int f_v = (verbose_level >= 1);
1213 int f_action_from_right =
TRUE;
1216 a.
Singer(p, 3, verbose_level - 2);
1217 cout <<
"permutation::singer_cycle_on_points_of_projective_plane(): primitive polynomial: " << a << endl;
1234 cout <<
"as matrix:" << endl;
1236 M.
PG_rep(*
this, f_action_from_right, f_modified);
1239 cout <<
"singer cycle on points of projective plane of order "<< p <<
" : " << *
this << endl;
1248 cout <<
"permutation::Cn_in_Cnm()n < 1" << endl;
1252 cout <<
"permutation::Cn_in_Cnm()m < 1" << endl;
1258 for (i = 0; i < nm - 1; i++)
1269 for (j = 0; j < l; j++) {
1273 cout <<
"permutation::preimage() error: not a permutation" << endl;
1283 for (i = 0; i < l; i++) {
1293 cout <<
"signum_map() x must be a permutation" << endl;
1304char get_character(istream & is,
int f_v)
1309 cout <<
"get_character() at end" << endl;
1314 cout <<
"get_character: \"" << c <<
"\", ascii=" << (int)c << endl;
a collection of combinatorial functions
int ij2k(int i, int j, int n)
various functions related to geometries
long int nb_PG_elements(int n, int q)
DISCRETA vector class for vectors of DISCRETA objects.
void PG_element_unrank(int a)
Vector & append_integer(int a)
discreta_base & s_i(int i)
bool search(discreta_base &x, int *idx)
DISCRETA base class. All DISCRETA classes are derived from this class.
integer & change_to_integer()
void swap(discreta_base &a)
void copyobject(discreta_base &x)
discreta_base & power_int(int l)
permutation & as_permutation()
discreta_matrix & transpose()
void PG_line_rank(int &a, int f_v)
void PG_point_unrank(int i0, int j0, int di, int dj, int length, int a)
void PG_line_unrank(int a)
discreta_matrix & m_mn_n(int m, int n)
void PG_rep(domain *dom, permutation &p, int f_action_from_right, int f_modified)
void PG_point_rank(int i0, int j0, int di, int dj, int length, int &a)
DISCRETA class for influencing arithmetic operations.
void append(const char *p)
DISCRETA class to serialize data structures.
DISCRETA permutation class.
void read_mem(memory &m, int debug_depth)
int invert_to(discreta_base &x)
void embed_at(permutation &b, int n, int at)
void remove_fixpoint(permutation &b, int i)
void AddNCycle(int first, int len)
std::ostream & print(std::ostream &)
void sscan(const char *s, int verbose_level)
void set_print_type_integer_from_one()
void set_print_type_integer_from_zero()
void freeself_permutation()
void Add3Cycle(int i0, int i1, int i2)
void copyobject_to(discreta_base &x)
void write_mem(memory &m, int debug_depth)
void Add5Cycle(int i0, int i1, int i2, int i3, int i4)
void add_n_fixpoints_in_front(permutation &b, int n)
void cycle_type(Vector &type, int verbose_level)
std::ostream & print_cycle(std::ostream &ost)
void get_fixpoints(Vector &f)
void add_fixpoint_in_front(permutation &b)
void induce_on_2tuples(permutation &p, int f_injective)
void mult_to(discreta_base &x, discreta_base &y)
void cartesian_product_action(permutation &a, permutation &b)
void set_print_type_PG_1_q_element(domain *dom)
void cycles(Vector &cycles)
void add_n_fixpoints_at_end(permutation &b, int n)
void Add4Cycle(int i0, int i1, int i2, int i3)
void Cn_in_Cnm(int n, int m)
void induce_on_lines_of_PG_k_q(int k, int q, permutation &per, int verbose_level)
void induce_action_on_blocks(permutation &gg, Vector &B)
void Add2Cycle(int i0, int i1)
int compare_with(discreta_base &a)
std::ostream & print_list(std::ostream &ost)
int signum(int verbose_level)
int nb_of_inversions(int verbose_level)
void settype_permutation()
void induce2(permutation &b)
permutation & operator=(const discreta_base &x)
void restrict_to_subset(permutation &q, int first, int len)
void induce3(permutation &b)
void singer_cycle_on_points_of_projective_plane(int p, int f_modified, int verbose_level)
void join(permutation &a, permutation &b)
void convert_digit(int i, hollerith &a)
void scan(std::istream &is, int verbose_level)
DISCRETA class for polynomials in one variable.
void Singer(int p, int f, int verbose_level)
DISCRETA class related to class domain.
domain * allocate_finite_field_domain(int q, int verbose_level)
enum printing_mode_enum current_printing_mode()
discreta_base * calloc_nobjects_plus_length(int n, kind k)
void free_nobjects_plus_length(discreta_base *p)
void tuple2_rank(int rank, int &i, int &j, int n, int f_injective)
domain * current_permutation_print_type_dom
void signum_map(discreta_base &x, discreta_base &d)
int nb_PG_lines(int n, int q)
@ PERMUTATION
PERMUTATION.
int tuple2_unrank(int i, int j, int n, int f_injective)
enum permutation_print_type current_permutation_print_type
the orbiter library for the classification of combinatorial objects
discreta_base * vector_pointer