28 #ifndef _CHAINCON_SHUFFLES_H_ 29 #define _CHAINCON_SHUFFLES_H_ 38 #include "chomp/system/config.h" 63 template <
class ArrayP,
class ArrayQ>
64 bool get (ArrayP &alpha, ArrayQ &beta,
int &sig);
85 if ((p < 0) || (q < 0))
86 throw "Trying to define shuffles with negative p or q.";
93 for (
int i = 0; i <
_p; ++ i)
98 template <
class ArrayP,
class ArrayQ>
105 for (
int i = 0; i <
_pq; ++ i)
107 if ((cur <
_p) && (
_alpha [cur] == i))
109 alpha [alpha_i ++] = i;
114 beta [beta_i ++] = i;
120 for (
int i = 0; i <
_p; ++ i)
140 while ((cur < _p - 1) && (
_alpha [cur + 1] -
_alpha [cur] == 1))
143 if ((cur >= _p) || ((cur == _p - 1) && (
_alpha [cur] == _pq - 1)))
150 for (
int i = 0; i < cur; ++ i)
157 #endif // _CHAINCON_SHUFFLES_H_ An iterator of all the (p,q)-shuffles.
std::vector< int > _alpha
A vector of counters that correspond to the first set in the partition.
Shuffles(int p, int q)
The constructor in which the size of the shuffle is given.
int _p
The number p of the elements of the first set in the partition.
void rewind()
Rewinds the counter of the (p,q)-shuffles.
bool get(ArrayP &alpha, ArrayQ &beta, int &sig)
Gets a (p,q)-shuffle and its signature.
int _pq
The sum of the numbers of the elements of both sets in the partition: p + q.