Re: [Boost-users] ranking of ublas vector

Oops. I guess I didn't understand exactly what you wanted. The temp vector, should contain the result you want.
In Christ, Steven Watanabe
There is an error: I create a random vector like: [4](0.405121, 0.943918, 0.887914, 0.338921) I think it's clear that: 0.338921 < 0.405121 < 0.887914 < 0.943918 The code returns: [4](2,0,1,3) and that's wrong because the 2nd element is not the smallest value. The (mathematical) rank is: 3, 0, 2, 1 because the 3rd element is the smallest and the first the largest in the original vector. I hope that's clearer Thanks Phil

AMDG Kraus Philipp wrote:
There is an error:
I create a random vector like:
[4](0.405121, 0.943918, 0.887914, 0.338921)
I think it's clear that: 0.338921 < 0.405121 < 0.887914 < 0.943918
The code returns: [4](2,0,1,3) and that's wrong because the 2nd element is not the smallest value.
I can't get this result. In the code I gave, temp contains [3, 0, 2, 1] and ranking contains [1, 3, 2, 0]
The (mathematical) rank is: 3, 0, 2, 1 because the 3rd element is the smallest and the first the largest in the original vector.
In Christ, Steven Watanabe
participants (2)
-
Kraus Philipp
-
Steven Watanabe