Combinations Class Reference

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 43 of file PRSolution.cpp.

Public Member Functions

 Combinations (void) throw ()
 Default constructor.
 Combinations (int N, int K) throw (gpstk::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
 ~Combinations (void)
 destructor
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 46 of file PRSolution.cpp.

Combinations int  N,
int  K
throw (gpstk::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 55 of file PRSolution.cpp.

References GPSTK_RETHROW, and gpstk::K.

Combinations const Combinations right  )  throw () [inline]
 

copy constructor

Definition at line 63 of file PRSolution.cpp.

~Combinations void   )  [inline]
 

destructor

Definition at line 70 of file PRSolution.cpp.


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 102 of file PRSolution.cpp.

Referenced by PRSolution::RAIMCompute().

int Next void   )  throw ()
 

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

Definition at line 126 of file PRSolution.cpp.

Referenced by PRSolution::RAIMCompute().

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

Assignment operator.

Definition at line 77 of file PRSolution.cpp.

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 93 of file PRSolution.cpp.


The documentation for this class was generated from the following file:
Generated on Wed Feb 8 03:31:24 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1