gvector_sort — Performs quicksort of a given array.
|inout data vector ,
|in elements_in_group integer ,
|in key_idx_in_group integer ,
|in sort_ascending integer
The function gets an vector that consists of groups of elements.
All groups are of equal size, namely
elements_in_group , so the total
should be whole multiple of
elements_in_group . One element of
each group is a key of sorting; it is identified by its zero-based
position within the group,
key_idx_in_group . The sorting
reorders groups in such a way that their keys become ordered
ascending or descending, depending on
The simplest case is plain sorting of a uniform array. In this
case every element is an individual group,
elements_in_group is 1 and
key_idx_in_group is 0.
Other popular case is sorting of result of
dict_to_vector (). In this case, every item
of the original dictionary is represended in the vector by a pair
of elements (
elements_in_group is 2), so to sort
items by their keys, the
key_idx_in_group is 0 and to sort
them by associated values, the
key_idx_in_group is 1.
elements_in_block is 2 for arrays
like "lines" or "params" of a VSP page.
A group vector (gvector) to sort.
The number of vector elements in every group, usually 1, should be in range 1 to 1024.
Zero-based position of key element in group, should be
nonnegative and less than
Direction of sorting, nonzero for ascending sort, zero for descending.
The function returns number of groups in the
data vector .