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
fft_inverse(fft_forward(1..len)) != 1..len
Simply take the out * 1/len to get the correct result.
This may be due to the lack of the necessary 1/n factor in ifft (fft_inverse).
fft_inverse(1..2) != [1.5 + 0.0im, -0.5 + 0.0im]
Same as 1.
fft_forward give correct answer only when len=2
The output of fft_forward is in bit-reversed order.
But the positions of the first and last elements of the array should remain unchanged.
So the result is still wrong.
The behavior here is expected. The order of the frequency domain doesn't matter when performing convolution. And where the scaling is done doesn't matter as long as it's done somewhere. Reference implementations either don't scale at all or they scale by sqrt(length) in both the forward and inverse transforms. (which is not what we want here anyway)
The reason why it appears worse than bit-reversed is because the twiddle factors are not inverted like in reference implementations. If you take the complex conjugate of the frequency domain, it should be bit-reversed from a reference implementation. (aside from scaling factors)
The output of
fft_forward
andfft_inverse
seems inconsistent with other reference implementations.I'm not sure if this is a bug.
But it might have an effect on the precision of the final results.
CPP test code
Details
Add those code to the end of https://github.com/Mysticial/Mini-Pi/blob/master/decomposed/src/FFT.cpp
Compile and Run:
g++ -o fft FFT.cpp FFT.h && ./fft
Test code output:
issues
fft_inverse(fft_forward(1..len)) != 1..len
Simply take the
out * 1/len
to get the correct result.This may be due to the lack of the necessary
1/n
factor in ifft (fft_inverse).fft_inverse(1..2) != [1.5 + 0.0im, -0.5 + 0.0im]
Same as
1.
fft_forward
give correct answer only when len=2The output of
fft_forward
is in bit-reversed order.But the positions of the first and last elements of the array should remain unchanged.
So the result is still wrong.
bitrevorder
position mapThe text was updated successfully, but these errors were encountered: