Home »
Public Forums »
archive »
IDL 5.2.1 bug? R_Correlate & IDL_Crank
IDL 5.2.1 bug? R_Correlate & IDL_Crank [message #17447] |
Tue, 26 October 1999 00:00 |
barrios_a
Messages: 1 Registered: October 1999
|
Junior Member |
|
|
Has anyone discovered this problem? I've been doing some heavy data
analysis using IDL's rank correlation function:
rank = r_correlate( xarray, yarray)
where "xarray" and "yarray" are both 881-element vectors (with a lot of
ties). The problem is that I get drastically different
rank correlation numbers between IDL's r_correlate routine and the
Numerical Recipes Fortran "spear" routine that does the
same thing. Since IDL basically uses the NR routines these should be
identical, however, I traced the problem to IDL's
idl_crank.pro function in which this statement
s=s + t^3 - t
gives the incorrect result, when comparing line by line with the Fortran
code. The reason is that "t" is computed with integer
values - in the previous line t=jt-j (both "jt" and "j" are integers);
and if "t" is large (which it is in my case), then "t^3"
becomes greater than 32,256 and returns a negative number. A simple fix
is to replace this line at the beginning of the
routine
j=1
with this line
j=1.0
This forces "t" to become a floating point variable and makes both IDL
and NR Fortran routines give identical rank correlation numbers for
identical data sets. Anyone else have this problem or know of any more
IDL mathematical routines that have similar bugs?
Amalia
Sent via Deja.com http://www.deja.com/
Before you buy.
|
|
|
Current Time: Wed Oct 08 17:39:02 PDT 2025
Total time taken to generate the page: 0.00550 seconds