library.sort Submodule

Module Summary

Interfaces for the NAG Mark 28.5 sort Chapter.

sort - Sorting and Searching

This module is concerned with sorting and searching numeric or character data. It handles only the simplest types of data structure and it is concerned only with internal sorting and searching – that is, sorting and searching a set of data which can all be stored within the program.

If you have large files of data or complicated data structures to be sorted or searched you should use a comprehensive sorting or searching program or package.

Functionality Index


arbitrary data: arbitrary_rank()

columns of a matrix

integer numbers: intmat_rank_columns()

real numbers: realmat_rank_columns()

rows of a matrix

integer numbers: intmat_rank_rows()

real numbers: realmat_rank_rows()


character data: charvec_rank()

integer numbers: intvec_rank()

real numbers: realvec_rank()

Rearranging (according to pre-determined ranks)


character data: charvec_rank_rearrange()

complex numbers: cmplxvec_rank_rearrange()

integer numbers: intvec_rank_rearrange()

real numbers: realvec_rank_rearrange()

Searching (i.e., exact match or the nearest lower value)

binary search


integer numbers: intvec_search()

real numbers: realvec_search()

strings: charvec_search()

direct search


real numbers: realvec_vec_search()

Service functions

check validity of a permutation: permute_check()

decompose a permutation into cycles: permute_decompose()

invert a permutation (ranks to indices or vice versa): permute_invert()

Sorting (i.e., rearranging into sorted order)

quick sort


character data: charvec_sort()

integer numbers: intvec_sort()

real numbers: realvec_sort()

For full information please refer to the NAG Library document