The ChainCon Software (Release 0.03)
Public Member Functions | Private Attributes | List of all members
Shuffles Class Reference

An iterator of all the (p,q)-shuffles. More...

#include <shuffles.h>

Public Member Functions

 Shuffles (int p, int q)
 The constructor in which the size of the shuffle is given. More...
 
void rewind ()
 Rewinds the counter of the (p,q)-shuffles. More...
 
template<class ArrayP , class ArrayQ >
bool get (ArrayP &alpha, ArrayQ &beta, int &sig)
 Gets a (p,q)-shuffle and its signature. More...
 

Private Attributes

int _p
 The number p of the elements of the first set in the partition. More...
 
int _pq
 The sum of the numbers of the elements of both sets in the partition: p + q. More...
 
std::vector< int > _alpha
 A vector of counters that correspond to the first set in the partition. More...
 

Detailed Description

An iterator of all the (p,q)-shuffles.

A (p,q)-shuffle (alpha, beta) is a partition of the set {0,...,p+q-1} into two disjoint subsets, such that alpha_1 < ... < alpha_p and beta_1 < ... < beta_q.

Definition at line 51 of file shuffles.h.

Constructor & Destructor Documentation

◆ Shuffles()

Shuffles::Shuffles ( int  p,
int  q 
)
inline

The constructor in which the size of the shuffle is given.

Definition at line 82 of file shuffles.h.

References rewind().

Member Function Documentation

◆ get()

template<class ArrayP , class ArrayQ >
bool Shuffles::get ( ArrayP &  alpha,
ArrayQ &  beta,
int &  sig 
)
inline

Gets a (p,q)-shuffle and its signature.

Returns true if more (p,q)-shuffles are available, or false if this was the last one (and rewinds the iterator).

Definition at line 99 of file shuffles.h.

References _alpha, _p, _pq, and rewind().

◆ rewind()

void Shuffles::rewind ( )
inline

Rewinds the counter of the (p,q)-shuffles.

Definition at line 91 of file shuffles.h.

References _alpha, and _p.

Referenced by get(), and Shuffles().

Member Data Documentation

◆ _alpha

std::vector<int> Shuffles::_alpha
private

A vector of counters that correspond to the first set in the partition.

Definition at line 76 of file shuffles.h.

Referenced by get(), and rewind().

◆ _p

int Shuffles::_p
private

The number p of the elements of the first set in the partition.

Definition at line 68 of file shuffles.h.

Referenced by get(), and rewind().

◆ _pq

int Shuffles::_pq
private

The sum of the numbers of the elements of both sets in the partition: p + q.

Definition at line 72 of file shuffles.h.

Referenced by get().


The documentation for this class was generated from the following file: