comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » possible bug in a_correlate()
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
possible bug in a_correlate() [message #35833] Fri, 01 August 2003 08:02
t.osborn is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: minor glitch in total()
Next Topic: Re: minor glitch in total()

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 17:48:54 PDT 2025

Total time taken to generate the page: 0.00525 seconds