|Function||Sort the index-array of a vector|
|Syntax C/C++||#include <VFstd.h>
void VF_sortind( uiVector Ind, fVector X, ui size, int dir );
|C++ VecObj||#include <OptiVec.h>
void vector<ui>::sortind( const vector<T>& X, int dir=1 );
procedure VF_sortind( Ind:uiVector; X:fVector; size:UIntSize; dir:Integer );
|Description||The routine is similar to VF_sort, but this time it is the index-array of X rather than the vector X itself that is ordered. Ascending order is obtained by setting dir to any positive number. Here, ascending order means that Ind0 will contain the index of the smallest element of X, Ind1 the index of the second-smallest, and so on, up to Indsize-1, the index of the largest element in X. Descending order is obtained by setting dir negative. In the case of two or more identical vector elements, the lower index comes first (regardless of the sortind direction).
This routine is used if other vectors are correlated with X and the correlation of the individual elements has to be maintained. After sorting the index-array, use VF_indpick (VD_indpick, VI_indpick, etc.) to actually perform the sorting of X and the other vectors correlated with X.
VectorLib Table of Contents OptiVec home