stg/SYLT-FFT

DIT mode is broken (at least for mac / no asm instructions). (DIF works)

Alex-EEE opened this issue · 2 comments

As also reported on #3, DIT mode does not give correct results. I was testing the trivial input:[0,1000,2000,3000,4000,5000,6000,7000]. Here are the results:

DIT: 3500 + 0j ,-1707 + 707j ,-1000 + 0j ,0 + 0j ,-500 + 0j ,-293 + -707j ,0 + 0j ,0 + 0j
DIF: 3500 + 0j ,-500 + 1207j ,-500 + 500j ,-500 + 207j ,-500 + 0j ,-500 + -207j ,-500 + -500j ,-500 + -1207j

DIF agrees with (after some scaling) Python fft and Wolfram Alpha, so it appears to be working

stg commented

Agreed, I am getting the same results when testing on PC (Windows).

For reference, I am using the following code to reproduce your results.

  fft_complex_t samples[] = {{0, 0}, {1000, 0}, {2000, 0}, {3000, 0}, {4000, 0}, {5000, 0}, {6000, 0}, {7000, 0}};
  fft_fft(samples, 3);
  for(int n = 0; n < 8; n++) printf("%i+%ij ", samples[n].r, samples[n].i);
stg commented

The bug applies only to forward FFT, not inverse FFT.
There was an error in the trivial butterfly math in forward-FFT when compiling with FFT_DIT.
I've committed a correction just now, please let me know if this does not fix your problem and I will re-open the issue.