Combinations Class Reference

#include <Combinations.hpp>

List of all members.


Detailed Description

Class Combinations will compute C(n,k), all the combinations of n things taken k at a time (where k <= n).

Let n 'things' be indexed by i (i=0...n-1), e.g. stored in an array of length n. This class computes C(n,k) as sets of k indexes into the 'things' array. These indexes are accessible via member functions Selection() or isSelected(). Next() computes the next combination until there are no more (when it returns -1).

Definition at line 675 of file Combinations.hpp.

Public Member Functions

 Combinations (void) throw ()
 Default constructor.
 Combinations (int N, int K) throw (Exception)
 Constructor for C(n,k) = combinations of n things taken k at a time (k <= n)
Exceptions:
on invalid input (k>n).

 Combinations (const Combinations &right) throw ()
 copy constructor
Combinationsoperator= (const Combinations &right) throw ()
 Assignment operator.
int Next (void) throw ()
 Compute the next combination, returning the number of combinations computed so far; if there are no more combinations, return -1.
int Selection (int j) throw ()
 Return index i (0 <= i < n) of jth selection (0 <= j < k); if j is out of range, return -1.
bool isSelected (int j) throw ()
 Return true if the given index j (0 <= j < n) is currently selected (i.e.


Constructor & Destructor Documentation

Combinations void   )  throw () [inline]
 

Default constructor.

Definition at line 678 of file Combinations.hpp.

Combinations int  N,
int  K
throw (Exception) [inline]
 

Constructor for C(n,k) = combinations of n things taken k at a time (k <= n)

Exceptions:
on invalid input (k>n).

Definition at line 686 of file Combinations.hpp.

Combinations const Combinations right  )  throw () [inline]
 

copy constructor

Definition at line 690 of file Combinations.hpp.


Member Function Documentation

bool isSelected int  j  )  throw () [inline]
 

Return true if the given index j (0 <= j < n) is currently selected (i.e.

if j = Selection(i) for some i)

Definition at line 723 of file Combinations.hpp.

Referenced by PRSolution2::RAIMCompute(), and PRSolution::RAIMCompute().

int Next void   )  throw () [inline]
 

Compute the next combination, returning the number of combinations computed so far; if there are no more combinations, return -1.

Definition at line 707 of file Combinations.hpp.

Referenced by PRSolution2::RAIMCompute(), and PRSolution::RAIMCompute().

Combinations& operator= const Combinations right  )  throw () [inline]
 

Assignment operator.

Definition at line 697 of file Combinations.hpp.

int Selection int  j  )  throw () [inline]
 

Return index i (0 <= i < n) of jth selection (0 <= j < k); if j is out of range, return -1.

Definition at line 715 of file Combinations.hpp.


The documentation for this class was generated from the following files:
Generated on Sat May 18 03:31:43 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1