signal.correlate with method='fft' doesn't benefit from long doubles (but is expected to) #9520
Labels
defect
A clear bug or issue that prevents SciPy from being installed or used as expected
scipy.signal
test_signaltools.py tests signal.correlate with long double types (both real and complex), which leads to failures on ARMv8. The failures happen only when the 'fft' method is in use and for types larger than 64-bit floats (np.longdouble). The failures are most likely caused by losing precision on conversions of input arrays to double in numpy's fftpack: https://github.com/numpy/numpy/blob/464f79eb1d05bf938d16b49da1c39a4e02506fa3/numpy/fft/fftpack_litemodule.c#L147.
The failure of test for np.clongdouble is related to the precision being lost on prior calculations on .real and .imag parts of complex number, both being long doubles, since correlate using 'auto' method on np.clongdouble doesn't select 'fft'.
The issue is concealed when the tests are running on intel, since the tests require much lesser precision there. This comes from the dynamic requirement regarding the precision implemented at
scipy/scipy/signal/tests/test_signaltools.py
Line 1509 in c2ec858
scipy/scipy/signal/tests/test_signaltools.py
Line 1662 in c2ec858
Intel:
ARMv8 (and likely all other architectures?):
IMO either the tests' requirements towards precision for long doubles could be amended to resolve that, FFT implementation could be extended to support wider types or the tests for long doubles could be removed.
Reproducing code example:
Reproducible on embedded ARM v8 device running cross compiled scipy but also on Ubuntu aarch64 ran in qemu with native compiled scipy (I put some hints how to get it running on PC under #9515. To reproduce just run tests from test_signaltools.py.
Error message:
Test failures from amended test_signaltools.py to only run failing tests:
Scipy/Numpy/Python version information:
Also reproducible on v1.1.0.
The text was updated successfully, but these errors were encountered: