FOURIER : use Bluestein's algorithm for N != 2^k
For inputs that are not an even power of 2, use
Bluestein's algorithm[1] to match the output of
fft()/ifft() in Octave/Matlab() in those cases.
This algorithm is slower than radix-2 FFT algorithm
but still has the asymptotic time complexity of
O(N lg(N)).
This patch also introduces considerable speedup in case
of real valued inputs. DFT of a real valued input of
length N can be computed using any DFT algorithm with
a N/2 length complex valued input, provided we do some
pre and post processing[2].
All implementations in this patch are written from scratch
using the below theory references.
[1] https://en.wikipedia.org/wiki/Chirp_Z-transform#Bluestein.27s_algorithm
[2] Jones, K., 2010. Fast Solutions to Real-Data Discrete Fourier Transform.
In The Regularized Fast Hartley Transform (pp. 15-25). Springer, Dordrecht.
---------------------------
Below are some perf measurements for various input cases :-
Timing numbers are only for the DFT computation part and does not include
the time for writing data to the spreadsheet model. We don't use threading
yet, so these are numbers for just one cpu-core.
Exact Powers of 2
=================
Real Input size,Time (ms)
32768,2
65536,4
262144,21
1048576,185
Complex Input size, Time(ms)
32768,2
65536,5
262144,30
1048576,400
Even non-powers of 2 : 2^k - 2
================================
Real Input size,Time (ms)
32766,8
65534,20
262142,105
1048574,1440
Complex Input size, Time(ms)
32766,15
65534,36
262142,313
1048574,3332
Odd non-powers of 2 : 2^k - 1
================================
Real Input size,Time (ms)
32767,16
65535,39
262143,313
1048575,2729
Complex Input size, Time(ms)
32767,16
65535,38
262143,309
1048575,2703
Change-Id: Iccc31455e526ee5e6d18c20812dfa53defcf869f
Reviewed-on: https://gerrit.libreoffice.org/68639
Tested-by: Jenkins
Reviewed-by: Dennis Francis <dennis.francis@collabora.com>