10#undef VECTOR_COPY_VERBOSE
11#undef VECTOR_CHANGE_KIND_VERBOSE
17namespace layer2_discreta {
76#ifdef VECTOR_COPY_VERBOSE
77 cout <<
"in Vector::copyobject_to()\n";
81#ifdef VECTOR_CHANGE_KIND_VERBOSE
82 cout <<
"warning: Vector::copyobject_to x not a vector\n";
88#ifdef VECTOR_COPY_VERBOSE
89 cout <<
"source=" << *
this << endl;
90 cout <<
"target=" << x << endl;
93#ifdef VECTOR_COPY_VERBOSE
94 cout <<
"l=" << l << endl;
98#ifdef VECTOR_COPY_VERBOSE
99 cout <<
"after xx.m_l(l)\n";
101 for (i = 0; i < l; i++) {
102#ifdef VECTOR_COPY_VERBOSE
103 cout <<
"in Vector::copyobject_to() copy element "
104 << i <<
"=" <<
s_i(i) <<
"\n";
110#undef PRINT_WITH_TYPE
117 ost <<
"vector not allocated";
120#ifdef PRINT_WITH_TYPE
121 ost <<
"(VECTOR of length " << l <<
", \n";
123 for (i = 0; i < l; i++) {
128#ifdef PRINT_WITH_TYPE
141 ost <<
"vector not allocated";
146 for (i = 0; i < l; i++) {
154#ifdef PRINT_WITH_TYPE
155 ost <<
"(VECTOR of length " << l <<
", ";
159 for (i = 0; i < l; i++) {
174 ost <<
"vector not allocated";
177 for (i = 0; i < l; i++) {
189 ost <<
"vector not allocated";
193 for (i = 0; i < l; i++) {
207 cout <<
"Vector::s_i() vector_pointer == NULL\n";
211 if ( i < 0 || i >= l ) {
212 cout <<
"Vector::s_i() addressing error, i = " << i <<
", length = " << l <<
"\n";
242 for (i = 0; i < l; i++) {
252 for (i = 0; i < l; i++) {
262 for (i = 0; i < l; i++) {
274 for (i = 0; i <
MINIMUM(l, ll); i++) {
288 cout <<
"Vector::mult_to() error: cannot multiply vector with vector\n";
294 cout <<
"vector::mult_to() object x is of bad type\n";
305 cout <<
"Vector::add_to() this is not a vector\n";
309 cout <<
"matrix::add_to() x is not a vector\n";
317 cout <<
"vector::add_to() l != px.s_l()\n";
321 for (i = 0; i < l; i++) {
337 cout <<
"Vector::dec() length is zero\n";
351 cout <<
"a is not a vector\n";
357 for (i = 0; i < l1; i++) {
381 for (i = 0; i < l1; i++) {
384 for (i = 0; i < l2; i++) {
385 w[l1 + i].
swap(v[i]);
417 for (j = l; j > i; j--) {
433 cout <<
"Vector::get_and_delete_element() i >= l" << endl;
444 for (j = i + 1; j < l; j++) {
487 int l, r, m, res, len;
488 bool f_found =
false;
524static void quicksort(
Vector& v,
int left,
int right);
525static void quicksort_with_logging(
Vector& v,
permutation& p,
int left,
int right);
526static void partition(
Vector& v,
int left,
int right,
int *middle);
527static void partition_with_logging(
Vector& v,
permutation& p,
int left,
int right,
int *middle);
534 quicksort(*
this, 0, l - 1);
558 quicksort_with_logging(*
this, p, 0, l - 1);
563static void quicksort(
Vector& v,
int left,
int right)
568 partition(v, left, right, &middle);
569 quicksort(v, left, middle - 1);
570 quicksort(v, middle + 1, right);
574static void quicksort_with_logging(Vector& v, permutation& p,
int left,
int right)
579 partition_with_logging(v, p, left, right, &middle);
580 quicksort_with_logging(v, p, left, middle - 1);
581 quicksort_with_logging(v, p, middle + 1, right);
585static void partition(Vector& v,
int left,
int right,
int *middle)
587 int l, r, m, len, m1, res, pivot;
590 len = right + 1 - left;
594 v[pivot].swap(v[left + m1]);
601 res = v[l].compare_with(v[pivot]);
609 res = v[r].compare_with(v[pivot]);
624static void partition_with_logging(Vector& v, permutation& p,
int left,
int right,
int *middle)
626 int l, r, m, len, m1, res, pivot;
630 len = right + 1 - left;
634 v[pivot].swap(v[left + m1]);
635 Algo.
int_swap(p[pivot], p[left + m1]);
643 res = v[l].compare_with(v[pivot]);
651 res = v[r].compare_with(v[pivot]);
677 for (i = 1; i < l; i++) {
690 for (i = 0; i <
k; i++) {
700 cout <<
"Vector::n_choose_k_next() k != s_l()";
703 for (i = 0; i <
k; i++) {
706 m_ii(
k - 1 - i, a + 1);
707 for (ii = i - 1; ii >= 0; ii--) {
721 for (i = l - 1, j = 0; i >= 0; i--, j++) {
743 for (i = 0; i < l; i++)
746 for (i = 0; i < l; i++) {
773 for (i = l - 1; i >= 0; i--) {
786 for (i = 0; i < l; i++) {
802 while (
s_ii(i) == q - 1) {
829 int n, i,
k, ipk, f_rg;
838 while (
s_ii(ipk) ==
s_ii(i) && i < n - 1) {
847 }
while (f_rg &&
k <= n - 1);
858 for (i = 0; i < l; i++) {
870 for (i = 0; i < l; i++) {
887 for (i = 0; i < l; i++) {
909 for (i = 0; i < l; i++) {
915 mult.insert_element(idx, int_ob);
927 for (i = 0; i < l; i++) {
942 for (i = 0; i < l; i++) {
944 cout <<
"Vector::hip1(): object not of type INTEGER\n";
957 char f_hip = 0, f_hip1 = 0;
961 f_hip = (char)
hip();
963 f_hip1 = (char)
hip1();
964 if (debug_depth > 0) {
972 cout <<
"Vector of length " << l << endl;
978 for (i = 0; i < l; i++) {
984 for (i = 0; i < l; i++) {
990 for (i = 0; i < l; i++) {
991 if (debug_depth > 0) {
1004 char c, f_hip = 0, f_hip1 = 0;
1012 if (debug_depth > 0) {
1020 cout <<
"Vector of length " << l << endl;
1024 for (i = 0; i < l; i++) {
1031 for (i = 0; i < l; i++) {
1038 for (i = 0; i < l; i++) {
1039 if (debug_depth > 0) {
1057 f_hip = (char)
hip();
1060 f_hip1 = (char)
hip1();
1068 for (i = 0; i < l; i++)
1082 for (i = 0; i < l; i++) {
1101 int l1, l2, l3, i1 = 0, i2 = 0, r;
1108 while (i1 < l1 || i2 < l2) {
1111 if (i1 < l1 && i2 < l2) {
1123 v3[i1 + i2] = v1[i1];
1127 v3[i1 + i2] = v2[i2];
1137 int l1, l2, l3, i1 = 0, i2 = 0, r;
1145 while (i1 < l1 || i2 < l2) {
1148 if (i1 < l1 && i2 < l2) {
1160 v3[i1 + i2] = v1[i1];
1161 v3_fellow[i1 + i2] = v1_fellow[i1];
1165 v3[i1 + i2] = v2[i2];
1166 v3_fellow[i1 + i2] = v2_fellow[i2];
1175 int i1, i2, l1, l2, a1, a2, f_add1, f_add2;
1184 while (i1 < l1 || i2 < l2) {
1187 if (i1 < l1 && i2 < l2) {
1237 for (i = 0; i < l; i++) {
1249 for (i = 0; i < l; i++) {
1259 for (i = 0; i < len; i++) {
1260 v.
s_i(i) =
s_i(first + i);
1272 for (i = l - 1; i >= 0; i--) {
1278 for (j = i; j >= 0; j--) {
1284 cout <<
"Vector::PG_element_normalize() zero vector()" << endl;
1291 int l, i, j, q, q_power_j, b;
1294 cout <<
"Vector::PG_element_rank() no finite field domain" << endl;
1300 cout <<
"Vector::PG_element_rank() vector not allocated()" << endl;
1304 for (i = l - 1; i >= 0; i--) {
1309 cout <<
"Vector::PG_element_rank() zero vector" << endl;
1313 cout <<
"Vector::PG_element_rank() vector not normalized" << endl;
1319 for (j = 0; j < i; j++) {
1326 for (j = i - 1; j >= 0; j--) {
1337 int l, i, j, q, q_power_j, b;
1340 cout <<
"Vector::PG_element_rank_modified() no finite field domain" << endl;
1346 cout <<
"Vector::PG_element_rank_modified() vector not allocated()" << endl;
1350 for (i = 0; i < l; i++) {
1355 cout <<
"Vector::PG_element_rank_modified() zero vector" << endl;
1358 for (j = i + 1; j < l; j++) {
1368 for (i = l - 1; i >= 0; i--) {
1373 cout <<
"Vector::PG_element_rank_modified() zero vector" << endl;
1377 cout <<
"Vector::PG_element_rank_modified() vector not normalized" << endl;
1383 for (j = 0; j < i; j++) {
1390 for (j = i - 1; j >= 0; j--) {
1402 int q, n, l, qhl,
k, j, r, a1 = a;
1405 cout <<
"Vector::PG_element_unrank() no finite field domain" << endl;
1411 cout <<
"Vector::PG_element_unrank() vector not allocated()" << endl;
1425 for (
k = l + 1;
k < n;
k++) {
1440 cout <<
"Vector::PG_element_unrank() a too large" << endl;
1441 cout <<
"n = " << n << endl;
1442 cout <<
"a = " << a1 << endl;
1449 int q, n, l, qhl,
k, j, r, a1 = a;
1452 cout <<
"Vector::PG_element_unrank_modified() no finite field domain" << endl;
1458 cout <<
"Vector::PG_element_unrank_modified() vector not allocated()" << endl;
1462 for (
k = 0;
k < n;
k++) {
1482 for (
k = l + 1;
k < n;
k++) {
1497 cout <<
"Vector::PG_element_unrank_modified() a too large" << endl;
1498 cout <<
"n = " << n << endl;
1499 cout <<
"a = " << a1 << endl;
1509 cout <<
"Vector::AG_element_rank() no finite field domain" << endl;
1515 cout <<
"Vector::AG_element_rank() vector not allocated()" << endl;
1519 for (i = l - 1; i >= 0; i--) {
1532 cout <<
"Vector::AG_element_unrank() no finite field domain" << endl;
1538 cout <<
"Vector::AG_element_unrank() vector not allocated()" << endl;
1541 for (i = 0; i < n; i++) {
1554 for (i = 0; i < l; i++) {
1568 cout <<
"Vector::scalar_product() l != w.s_l()" << endl;
1571 for (i = 0; i < l; i++) {
1589 cout <<
"Vector::hadamard_product() l != w.s_l()" << endl;
1592 for (i = 0; i < l; i++) {
1609 for (i = 0; i < l1; i++) {
1629 cout <<
"intersection_of_vectors() no vectors" << endl;
1633 for (i = 0; i < l; i++) {
1634 vl.
m_ii(i, V[i].as_vector().s_l());
1639 for (i = 1; i < l; i++) {
1651 for (i = 0; i < l; i++) {
1654 cout <<
"vector::vector_of_vectors_overall_length element is not a vector" << endl;
1655 cout << *
this << endl;
1665 int l = exponents.
s_l();
1677 while (
s_ii(i) == exponents.
s_ii(i)) {
1695 while (
s_ii(i) == exponents.
s_ii(i)) {
1702 for (i = 0; i < n; i++) {
1719 for (i = 0; i < n; i++) {
1735 for (i = 0; i < l; i++) {
1737 cout <<
"Vector::hash() must be vector of integers" << endl;
1750 for (i = 0; i <
s_l(); i++) {
1759 int l1, l2, l3, i,
k;
1766 for (i = 0; i < l1; i++) {
1770 for (i = 0; i < l2; i++) {
1776#undef DEBUG_PRint_WORD_NICELY
1780 if (f_generator_labels) {
1786#ifdef DEBUG_PRint_WORD_NICELY
1787 cout << *
this <<
" = ";
1788 if (f_generator_labels) {
1805 for (i = 0; i < l; i += e) {
1806 for (j = i + 1; j < l; j++) {
1814 ost <<
"^{" << e <<
"} ";
1817 ost <<
"^" << e <<
" ";
1830 for (i = 0; i < l; i += e) {
1831 for (j = i + 1; j < l; j++) {
1839 ost <<
"^{" << e <<
"} ";
1842 ost <<
"^" << e <<
" ";
1855 for (i = 0; i < l; i++) {
1857 lengths.
m_ii(i, ll);
1866 vec_of_orders.
m_l_n(l);
1867 for (i = 0; i < l; i++) {
1869 vec_of_orders.
m_ii(i, o);
catch all class for algorithms
void int_swap(int &x, int &y)
DISCRETA vector class for vectors of DISCRETA objects.
void first_word(int n, int q)
Vector & append(discreta_base &x)
void apply_permutation_to_elements(permutation &p)
void PG_element_unrank_modified(int a)
int vector_of_vectors_overall_length()
void mult_scalar(discreta_base &a)
void extract_subvector(Vector &v, int first, int len)
void mult_to(discreta_base &x, discreta_base &y)
int n_choose_k_next(int n, int k)
void q_adic(int n, int q)
void scalar_product(Vector &w, discreta_base &a)
void PG_element_unrank(int a)
Vector & get_and_delete_element(int i, discreta_base &x)
void vector_of_vectors_replace(Vector &v)
int is_subset_of(Vector &w)
void print_word_nicely_with_generator_labels(std::ostream &ost, Vector &generator_labels)
int compare_with(discreta_base &a)
int next_regular_word(int q)
void n_choose_k_first(int n, int k)
std::ostream & Print(std::ostream &)
Vector & append_integer(int a)
void apply_permutation(permutation &p)
std::ostream & print_intvec(std::ostream &ost)
void conjugate(discreta_base &a)
void first_divisor(Vector &exponents)
void append_vector(Vector &v)
void lehmercode2perm(permutation &p)
int next_non_trivial_divisor(Vector &exponents)
void AG_element_rank(int &a)
void concatenation(Vector &v1, Vector &v2)
std::ostream & print_unformatted(std::ostream &ost)
void first_regular_word(int n, int q)
discreta_base & s_i(int i)
void hadamard_product(Vector &w)
void intersect(Vector &b, Vector &c)
void add_to(discreta_base &x, discreta_base &y)
void m_l_x(int l, discreta_base &x)
Vector & operator=(const discreta_base &x)
Vector & delete_element(int i)
void get_first_and_remove(discreta_base &x)
void sum_of_all_entries(discreta_base &x)
void vector_of_vectors_lengths(Vector &lengths)
void write_mem(memory &m, int debug_depth)
void PG_element_rank_modified(int &a)
Vector & sort_with_logging(permutation &p)
void sort_with_fellow(Vector &fellow)
void print_word_nicely(std::ostream &ost, int f_generator_labels, Vector &generator_labels)
void read_mem(memory &m, int debug_depth)
void content_multiplicities_only(Vector &c, Vector &mult)
void content(Vector &c, Vector &where)
bool insert_sorted(discreta_base &x)
Vector & insert_element(int i, discreta_base &x)
void PG_element_normalize()
void get_element_orders(Vector &vec_of_orders)
void multiply_out(Vector &primes, discreta_base &x)
int next_divisor(Vector &exponents)
bool search(discreta_base &x, int *idx)
void print_word_nicely2(std::ostream &ost)
void AG_element_unrank(int a)
void conjugate_with_inverse(discreta_base &a)
std::ostream & print(std::ostream &)
void copyobject_to(discreta_base &x)
void PG_element_rank(int &a)
DISCRETA base class. All DISCRETA classes are derived from this class.
virtual std::ostream & print(std::ostream &)
discreta_matrix & as_matrix()
void add(discreta_base &x, discreta_base &y)
void mult(discreta_base &x, discreta_base &y)
virtual int compare_with(discreta_base &a)
hollerith & as_hollerith()
void read_memory(memory &m, int debug_depth)
void swap(discreta_base &a)
void copyobject(discreta_base &x)
discreta_base & power_int(int l)
void write_memory(memory &m, int debug_depth)
Vector & change_to_vector()
void multiply_vector_from_left(Vector &x, Vector &y)
DISCRETA class for influencing arithmetic operations.
DISCRETA class to serialize data structures.
DISCRETA permutation class.
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 intersection_of_vectors(Vector &V, Vector &v)
void merge_with_fellows(Vector &v1, Vector &v1_fellow, Vector &v2, Vector &v2_fellow, Vector &v3, Vector &v3_fellow)
int hash_int(int hash0, int a)
int is_finite_field_domain(domain *&d)
void merge(Vector &v1, Vector &v2, Vector &v3)
void merge_with_value(Vector &idx1, Vector &idx2, Vector &idx3, Vector &val1, Vector &val2, Vector &val3)
int finite_field_domain_order_int(domain *d)
the orbiter library for the classification of combinatorial objects
discreta_base * vector_pointer