Thanks in advance to those who take the time to answer this question. It is one of my first questions, so sorry if it is not formulated in the best way.
The question, as the title indicates, is how I could obtain the indices that each element of a matrix would have if it were ordered. For example:
x = array ([3,8,1,21,7,65,2])
The expected output would be:
array ([2, 4, 0, 5, 3, 6, 1])
Of course most of the examples I have come across refer to the argsort() function, however it does not return the expected output, it returns:
array([2, 6, 0, 4, 1, 3, 5])
As you can see, the output is different. Testing and looking for the best I have found is to apply argsort() twice, that is, argsort(argsort (x)), however I am surprised that it is not necessary to apply a function twice and there is no more direct / simple method, for other side I would like to know if there is a direct way to get what I want and what would be the best / most efficient approach to tackle this task.