6.15 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
Available since 2.0
row_vector
sort_asc
(row_vector v)
Sort the elements of v in ascending order
Available since 2.0
vector
sort_desc
(vector v)
Sort the elements of v in descending order
Available since 2.0
row_vector
sort_desc
(row_vector v)
Sort the elements of v in descending order
Available since 2.0
array[] 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.
Available since 2.3
array[] 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.
Available since 2.3
array[] 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.
Available since 2.3
array[] 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.
Available since 2.3
int
rank
(vector v, int s)
Number of components of v less than v[s]
Available since 2.0
int
rank
(row_vector v, int s)
Number of components of v less than v[s]
Available since 2.0