Struct rgsl::types::combination::Combination [−][src]
pub struct Combination { /* fields omitted */ }
Implementations
This function allocates memory for a new combination with parameters n, k. The combination
is not initialized and its elements are undefined. Use the function
Combination::new_init_first
if you want to create a combination which is initialized to
the lexicographically first combination. A null pointer is returned if insufficient memory
is available to create the combination.
This function allocates memory for a new combination with parameters n, k and initializes it to the lexicographically first combination. A null pointer is returned if insufficient memory is available to create the combination.
This function initializes the combination c to the lexicographically first combination, i.e. (0,1,2,…,k-1).
This function initializes the combination c to the lexicographically last combination, i.e. (n-k,n-k+1,…,n-1).
This function copies the elements of the combination self into the combination dest. The two combinations must have the same size.
This function returns the value of the i-th element of the combination self. If i lies outside the allowed range of 0 to k-1 then the error handler is invoked and 0 is returned.
This function returns the number of elements (k) in the combination self.
This function checks that the combination self is valid. The k elements should lie in the range 0 to n-1, with each value occurring once at most and in increasing order.
This function advances the combination self to the next combination in lexicographic order
and returns Success
. If no further combinations are available it returns Failure and
leaves self unmodified. Starting with the first combination and repeatedly applying this
function will iterate through all possible combinations of a given order.