Re: Correlate function (bug?) [message #11085] |
Mon, 16 March 1998 00:00 |
wmc
Messages: 117 Registered: February 1995
|
Senior Member |
|
|
In article 9AA03CE1@fz-juelich.de, Theo Brauers <Th.Brauers@fz-juelich.de> writes:
> I was facing a problem with the correlate function
> which is demonstrated by the following IDL procedure:
> pro testc
> x=[1.D-5, 1.D-6, 0.0]
> y=[1.D-5, 1.1D-6, 0.0]
> print, correlate(x,y, /double)
> giving the following result:
>
> NAN
The problem is due to stupid programming in the correlate function.
You can look at the source in $IDL_DIR/lib/correlate.pro.
There is a tolerance (set to 1e-12 at /double, or 1e-6 otherwise) and if
||x'||^2*||y'||^2 is less than this, NAN is returned. Double precision should be
good for a lot better than 1e-12, and anyway its more the ratio between x and y
that would matter not the absolute value. Ho hum.
Just take the code and insert tol=0 in the appropriate place...
ps - the documentation doesn't mention this tolerance factor, presumably to avoid
worrying our pretty little heads...
- William
---
William M Connolley | wmc@bas.ac.uk | http://www.nbs.ac.uk/public/icd/wmc/
Climate Modeller, British Antarctic Survey | Disclaimer: I speak for myself
|
|
|