Using value_locate with a non-monotonic vector! And it's working!??! [message #52076] |
Sat, 30 December 2006 22:03 |
cgguido
Messages: 195 Registered: August 2005
|
Senior Member |
|
|
Hi all,
I am using value_locate on a unsorted vector and I am a little worried
because the IDL manual does not really say what happens in that case. I
would greatly appreciate your opinion and suggestions...
Say I have an unsorted vector of non-unique sparsely distributed
numbers a:
a=[4.3, 4.3, 2.1, 10000,2.1]
and I want to create a 1 to 1 map to a list of consecutive numbers that
indicate ranking...
What I do is:
b=a[uniq(a,sort(a))]
c=value_locate(b,a)
print, c
1 1 0 2 0
the variable c is exactly what I want in this case.
The arrays I am going to deal with are much longer (10x1e6 elements) so
i can't really check them...
I am just worried that by not using value_locate as the RSI/ITTVIS
people intended I might be getting my self into trouble.
Any advice?
Thanks,
Gianguido
|
|
|