GNU Scientific Library – Reference Manual: Permutation allocation

Next: Accessing permutation elements, Previous: The Permutation struct, Up: Permutations [Index]

### 9.2 Permutation allocation

Function: gsl_permutation * gsl_permutation_alloc (size_t n)

  This function allocates memory for a new permutation of size n. The permutation is not initialized and its elements are undefined. Use the function `gsl_permutation_calloc` if you want to create a permutation which is initialized to the identity. A null pointer is returned if insufficient memory is available to create the permutation.

Function: gsl_permutation * gsl_permutation_calloc (size_t n)

  This function allocates memory for a new permutation of size n and initializes it to the identity. A null pointer is returned if insufficient memory is available to create the permutation.

Function: void gsl_permutation_init (gsl_permutation * p)

  This function initializes the permutation p to the identity, i.e. (0,1,2,…,n-1).

Function: void gsl_permutation_free (gsl_permutation * p)

  This function frees all the memory used by the permutation p.

Function: int gsl_permutation_memcpy (gsl_permutation * dest, const gsl_permutation * src)

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