5.14 Sort Functions
See the sorting functions section for examples of how the functions work.
vector
sort_asc
(vector v)
Sort the elements of v in ascending order
row_vector
sort_asc
(row_vector v)
Sort the elements of v in ascending order
vector
sort_desc
(vector v)
Sort the elements of v in descending order
row_vector
sort_desc
(row_vector v)
Sort the elements of v in descending order
int[]
sort_indices_asc
(vector v)
Return an array of indices between 1 and the size of v, sorted to index v in ascending order.
int[]
sort_indices_asc
(row_vector v)
Return an array of indices between 1 and the size of v, sorted to index v in ascending order.
int[]
sort_indices_desc
(vector v)
Return an array of indices between 1 and the size of v, sorted to index v in descending order.
int[]
sort_indices_desc
(row_vector v)
Return an array of indices between 1 and the size of v, sorted to index v in descending order.
int
rank
(vector v, int s)
Number of components of v less than v[s]
int
rank
(row_vector v, int s)
Number of components of v less than v[s]