There are some edge cases in the cross correlation calculation:
[x] If the obtained lag is the same as the input length, hereshift_end and shift_start would both be input_length, and thus, when doing double avg1 = sum1 / (shift_end - shift_start); it would be dividing by zero. Can be solved by modifying the if to >= rather than >. A test should be done for this, too.
[x] Does fftw_alloc_complex check for NULL and other allocation errors?
[x] This variable name conflicts with the abs() function from math.h.
[x] Checking for NaN like this won't work when -Ofast is used. There should be a better way to do that, or at least some fix should be applied to CMake and setup.py.
There are some edge cases in the cross correlation calculation:
[x] If the obtained lag is the same as the input length, here
shift_end
andshift_start
would both beinput_length
, and thus, when doingdouble avg1 = sum1 / (shift_end - shift_start);
it would be dividing by zero. Can be solved by modifying theif
to>=
rather than>
. A test should be done for this, too.[x] Does
fftw_alloc_complex
check for NULL and other allocation errors?[x] This variable name conflicts with the
abs()
function frommath.h
.[x] Checking for NaN like this won't work when
-Ofast
is used. There should be a better way to do that, or at least some fix should be applied to CMake andsetup.py
.