possible bug in a_correlate() [message #35833] |
Fri, 01 August 2003 08:02 |
t.osborn
Messages: 6 Registered: July 1995
|
Junior Member |
|
|
Dear all,
another possible bug to check with you all [this one could be more
major than the total() one reported earlier today]!
IDL Version 5.4 (OSF alpha).
IDL> x=findgen(50)+randomn(seed,50)
IDL> print,correlate(x[0:48],x[1:49])
% Compiled module: CORRELATE.
0.998140
IDL> print,a_correlate(x,[1])
% Compiled module: A_CORRELATE.
0.940559
Shouldn't these two give the same answer? The first correlates
elements 0-48 with 1-49, while the second computes the lag-1
autocorrelation of the 50-element vector.
A quick check through the IDL code for a_correlate() seems to indicate
a possible source of the bug. The function Auto_Cov computes the mean
over the full length of the vector, whereas I think it should compute
the mean over each segment separately (0:nx-m-1) and (m:nx-1), where m
is the lag.
Have I got this right, and has anyone else noticed or corrected this?
Cheers
Tim
|
|
|