Next: , Previous: The Combination struct, Up: Combinations   [Index]


10.2 Combination allocation

Function: gsl_combination * gsl_combination_alloc (size_t n, size_t k)

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 gsl_combination_calloc 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.

Function: gsl_combination * gsl_combination_calloc (size_t n, size_t k)

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.

Function: void gsl_combination_init_first (gsl_combination * c)

This function initializes the combination c to the lexicographically first combination, i.e. (0,1,2,…,k-1).

Function: void gsl_combination_init_last (gsl_combination * c)

This function initializes the combination c to the lexicographically last combination, i.e. (n-k,n-k+1,…,n-1).

Function: void gsl_combination_free (gsl_combination * c)

This function frees all the memory used by the combination c.

Function: int gsl_combination_memcpy (gsl_combination * dest, const gsl_combination * src)

This function copies the elements of the combination src into the combination dest. The two combinations must have the same size.