Go to the documentation of this file.
44 #ifndef COMBINATIONS_INCLUDE
45 #define COMBINATIONS_INCLUDE
64 Index = std::vector<int>(0);
82 init(right.n,right.k);
84 for(
int j=0; j<
k; j++)
Index[j] = right.Index[j];
100 if(j < 0 || j >=
k)
return -1;
108 for(
int i=0; i<
k; i++)
109 if(
Index[i] == j)
return true;
119 if(K > N || N < 0 || K < 0) {
120 Exception e(
"Combinations(n,k) must have k <= n, with n,k >= 0");
124 Index = std::vector<int>(K);
128 for(
int j=0; j<
k; j++)
137 for(
int m=j+1; m<
k; m++)
142 if(j-1 < 0)
return -1;
157 #endif // COMBINATIONS_INCLUDE
Combinations(void) noexcept
Default constructor.
int Increment(int j) noexcept
Recursive function to increment Index[j].
Combinations(int N, int K)
int nc
number of combinations computed so far
int Selection(int j) noexcept
Combinations & operator=(const Combinations &right) noexcept
Assignment operator.
#define GNSSTK_THROW(exc)
int n
combinations of n things taken k at a time
bool isSelected(int j) noexcept
Combinations(const Combinations &right) noexcept
copy constructor
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38