Boost logo

Ublas :

Subject: [ublas] sorting a ublas vector and get index
From: Kaveh Kohan (kaveh.kohan_at_[hidden])
Date: 2009-12-02 17:15:13


Hi All,

I have a simple question but it seems that the answer is not that trivial not at least to me. Could you please tell me how to sort a vector and get corresponding indexes? Let me give and example from MATLAB:

[a,b]=sort([5, 8, 7])

a = 5 7 8
b = 1 3 2

a is the sorted vector and b is corresponding indexes. It seems that the same functionality exist in gsl:

gsl_sort_vector_index (gsl_permutation * p, const gsl_vector * v)
http://www.gnu.org/software/gsl/manual/html_node/Sorting-vectors.html

but I was wondering the same functionality exist in boost be applied on ublas vectors?

Thanks,
Kaveh