npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
npstat::NMCombinationSequencer Class Reference

#include <NMCombinationSequencer.hh>

Public Member Functions

 NMCombinationSequencer (unsigned M, unsigned N)
 
unsigned M () const
 
unsigned N () const
 
NMCombinationSequenceroperator++ ()
 
void operator++ (int)
 
void reset ()
 
const unsigned * combination () const
 
unsigned long count () const
 
bool isValid () const
 

Detailed Description

This class iterates over all possible choices of j1, .., jm from N possible values for each jk in such a way that all j1, .., jm are distinct and appear in the sequence in the increasing order, last index changing most often.

For the case m = 2 (two-dimensional), this is like going over the indices of the part of a square N x N matrix which is above the diagonal. In general, the total number of permutations equals the binomial coefficient C(N, M).

Constructor & Destructor Documentation

◆ NMCombinationSequencer()

npstat::NMCombinationSequencer::NMCombinationSequencer ( unsigned  M,
unsigned  N 
)

M is the number of indices and N is the number of possible values for each index (from 0 to N-1)

Member Function Documentation

◆ combination()

const unsigned* npstat::NMCombinationSequencer::combination ( ) const
inline

Retrieve the current combination of indices

◆ count()

unsigned long npstat::NMCombinationSequencer::count ( ) const
inline

Linear iteration number

◆ isValid()

bool npstat::NMCombinationSequencer::isValid ( ) const
inline

This method returns "false" upon cycling over the complete sequence of all possible choices

◆ M()

unsigned npstat::NMCombinationSequencer::M ( ) const
inline

Examine object properties

◆ operator++() [1/2]

NMCombinationSequencer& npstat::NMCombinationSequencer::operator++ ( )

Prefix increment

◆ operator++() [2/2]

void npstat::NMCombinationSequencer::operator++ ( int  )

Postfix increment (distinguished by the dummy "int" parameter)

◆ reset()

void npstat::NMCombinationSequencer::reset ( )

Reset the sequencer


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