DOCI-Exact  1.0
doci::Permutation Class Reference

#include <Permutation.h>

Public Member Functions

 Permutation (unsigned int)
 
virtual mybitset next ()
 
virtual mybitset get () const
 
virtual void reset ()
 
 Permutation (unsigned int)
 
virtual mybitset next ()
 
virtual mybitset get () const
 
virtual void reset ()
 

Static Public Member Functions

static unsigned long long CalcCombinations (unsigned int, unsigned int)
 
static unsigned long long gcd (unsigned long long, unsigned long long)
 
static unsigned int getMax ()
 
static unsigned long long CalcCombinations (unsigned int, unsigned int)
 
static unsigned long long gcd (unsigned long long, unsigned long long)
 
static unsigned int getMax ()
 

Detailed Description

This class is used to generate all permutations of bitsets with n bits set. These permutations are not stored but generated on the fly. Currently, should work well with up to 32 bits (64 if you switch to unsigned long long). Beyond that, troubles are waiting.

There is also no protect against overflows for the moment.

Definition at line 40 of file Permutation.h.

Constructor & Destructor Documentation

Permutation::Permutation ( unsigned int  n)

Constructor

Parameters
nthe number of bit that needs to be set

Definition at line 14 of file Permutation.cpp.

+ Here is the call graph for this function:

doci::Permutation::Permutation ( unsigned  int)

Member Function Documentation

unsigned long long Permutation::CalcCombinations ( unsigned int  L,
unsigned int  N 
)
static

Calculate the number of combinations to choose N out of L From: https://stackoverflow.com/questions/1838368/calculating-the-amount-of-combinations

Parameters
Lthe total number of sites
Nthe number of sites to choose
Returns
the number of possible combinations to choose N out of L

Definition at line 78 of file Permutation.cpp.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static unsigned long long doci::Permutation::CalcCombinations ( unsigned  int,
unsigned  int 
)
static
unsigned long long Permutation::gcd ( unsigned long long  x,
unsigned long long  y 
)
static

Find greatest common divider

Parameters
xthe first number
ythe second number
Returns
the greatest common divider from x and y

Definition at line 114 of file Permutation.cpp.

+ Here is the caller graph for this function:

static unsigned long long doci::Permutation::gcd ( unsigned long  long,
unsigned long  long 
)
static
virtual mybitset doci::Permutation::get ( ) const
virtual
mybitset Permutation::get ( ) const
virtual

Get current permutation

Returns
current permutation

Definition at line 57 of file Permutation.cpp.

unsigned int Permutation::getMax ( )
static
Returns
Return the maximum number of sp states that can be represented by the current type

Definition at line 132 of file Permutation.cpp.

+ Here is the caller graph for this function:

static unsigned int doci::Permutation::getMax ( )
static
mybitset Permutation::next ( )
virtual

Permutate to the next permutation and return it

Returns
the next permutation

Definition at line 30 of file Permutation.cpp.

+ Here is the caller graph for this function:

virtual mybitset doci::Permutation::next ( )
virtual
void Permutation::reset ( )
virtual

Back to the begin position: the lowest n bits are set

Definition at line 66 of file Permutation.cpp.

+ Here is the caller graph for this function:

virtual void doci::Permutation::reset ( )
virtual

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