You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using numpy's real-valued FFT implementation on arrays with nearly prime length, the results are very inaccurate (this was already noticed, but not fixed, in #10625)
To reproduce, run, e.g.:
from __future__ import print_function
import numpy as np
for i in range(2, 4096):
a=np.random.rand(i)-0.5
b=np.fft.irfft(np.fft.rfft(a),i)
err = np.linalg.norm(a-b)/np.linalg.norm(a)
if err>1e-12:
b2 = np.fft.ifft(np.fft.fft(a))
err2 = np.linalg.norm(a-b2)/np.linalg.norm(a)
print("Length: ", i,": error measure",err," (error measure of complex FFT:", err2,")")
(NB: the FFT implementation proposed in #11885 does not have this problem)
Activity
mreineck commentedon Apr 17, 2019
Should be fixed in 1.17.