
14 Mar
2010
14 Mar
'10
2:38 p.m.
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