Bug #1087

xcorr.c assumes ri=2 in do_range_interpolation function

Added by Hao 5 months ago.

Status:NewStart date:2017-05-01
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Affected version:all Platform:

Description

do_range_interpolate function in xcorr.c writes:

/* replace original with interpolated (only half) */
for (i=0; i<nx; i++) {
    c[i].r = work[i+nx/2].r;
    c[i].i = work[i+nx/2].i;
}

I think the code means to take nx elements in the middle from interpolated array. Obviously current code gives meaningless result when range_interp factor (ri) larger than 2 because it assumes ri=2 and shift interpolated array by nx/2.

xcorr use 2 as default values so it won't affect users of automated scripts. But anyway I don't think this is expected behaviour. Maybe you should replace nx/2 with nx * (ri - 1) / 2 .

Also available in: Atom PDF