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: