This is the basic C++ program of C++ armadillo library which shows how to get the value of indices of elements of vetor of some particular size sorted in ascending order. It can be carried out by the help of inbuilt function "sort_index" in armadillo library. It takes one parameter i.e vector name.
Return a vector which describes the sorted order of the elements of X (ie. it contains the indices of the elements of X)
The output vector must have the type uvec (ie. the indices are stored as unsigned integers of type uword)
X is interpreted as a vector, with column-by-column ordering of the elements of X
The sort_direction argument is optional; sort_direction is either "ascend" or "descend"; by default "ascend" is used
The stable_sort_index() variant preserves the relative order of elements with equivalent values
For matrices and vectors with complex numbers, sorting is via absolute values
Comments