Next: , Previous: Permutation properties, Up: Permutations


9.5 Permutation functions

— Function: void gsl_permutation_reverse (gsl_permutation * p)

This function reverses the elements of the permutation p.

— Function: int gsl_permutation_inverse (gsl_permutation * inv, const gsl_permutation * p)

This function computes the inverse of the permutation p, storing the result in inv.

— Function: int gsl_permutation_next (gsl_permutation * p)

This function advances the permutation p to the next permutation in lexicographic order and returns GSL_SUCCESS. If no further permutations are available it returns GSL_FAILURE and leaves p unmodified. Starting with the identity permutation and repeatedly applying this function will iterate through all possible permutations of a given order.

— Function: int gsl_permutation_prev (gsl_permutation * p)

This function steps backwards from the permutation p to the previous permutation in lexicographic order, returning GSL_SUCCESS. If no previous permutation is available it returns GSL_FAILURE and leaves p unmodified.