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)
| ||||
| Combinations (const Combinations &right) throw () | ||||
| copy constructor | ||||
| ~Combinations (void) | ||||
| destructor | ||||
| Combinations & | operator= (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. | ||||
|
|
Default constructor.
Definition at line 46 of file PRSolution.cpp. |
|
||||||||||||
|
Constructor for C(n,k) = combinations of n things taken k at a time (k <= n)
Definition at line 55 of file PRSolution.cpp. References GPSTK_RETHROW, and gpstk::K. |
|
|
copy constructor
Definition at line 63 of file PRSolution.cpp. |
|
|
destructor
Definition at line 70 of file PRSolution.cpp. |
|
|
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(). |
|
|
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(). |
|
|
Assignment operator.
Definition at line 77 of file PRSolution.cpp. |
|
|
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. |
1.3.9.1