Module rgsl::sort::objects

source ·
Expand description

The following function provides a simple alternative to the standard library function qsort. It is intended for systems lacking qsort, not as a replacement for it. The function qsort should be used whenever possible, as it will be faster and can provide stable ordering of equal elements. Documentation for qsort is available in the GNU C Library Reference Manual.

The functions described in this section are defined in the header file gsl_heapsort.h.

Functions

This function sorts the count elements of the array array, each of size size, into ascending order using the comparison function compare. The type of the comparison function is defined by,
This function indirectly sorts the count elements of the array array, each of size size, into ascending order using the comparison function compare. The resulting permutation is stored in p, an array of length n. The elements of p give the index of the array element which would have been stored in that position if the array had been sorted in place. The first element of p gives the index of the least element in array, and the last element of p gives the index of the greatest element in array. The array itself is not changed.