Rader's FFT algorithm: Difference between revisions

Content deleted Content added
No edit summary
Evaluating the convolution: remove dubious claims (see Talk), which were unsourced anyway
 
(37 intermediate revisions by 25 users not shown)
Line 1:
{{Short description|Discrete Fourier transform for prime sizes}}
'''Rader's algorithm''' (1968),<ref>C. M. Rader, "Discrete Fourier transforms when the number of data samples is prime," ''Proc. IEEE'' 56, 1107–1108 (1968).</ref> named for Charles M. Rader of [[MIT Lincoln Laboratory]], is a [[fast Fourier transform]] (FFT) algorithm that computes the [[discrete Fourier transform]] (DFT) of [[prime number|prime]] sizes by re-expressing the DFT as a cyclic [[convolution]]. (Thethe other algorithm for FFTs of prime sizes, [[Bluestein's FFT algorithm|Bluestein's algorithm]], also works by rewriting the DFT as a convolution.).
 
Since Rader's algorithm only depends upon the periodicity of the DFT kernel, it is directly applicable to any other transform (of prime order) with a similar property, such as a [[number-theoretic transform]] or the [[discrete Hartley transform]].
 
The algorithm can be modified to gain a factor of two savings for the case of DFTs of real data, using a slightly modified re-indexing/permutation to obtain two half-size cyclic convolutions of real data;<ref>S. Chu and C. Burrus, "A prime factor FTT <nowiki>[</nowiki>''sic''<nowiki>]</nowiki> algorithm using distributed arithmetic," '' IEEE Transactions on Acoustics, Speech, and Signal Processing'' '''30''' (2), 217&ndash;227 (1982).</ref> an alternative adaptation for DFTs of real data uses the [[discrete Hartley transform]].<ref name=Frigo05>Matteo Frigo and [[Steven G. Johnson]], "[http://fftw.org/fftw-paper-ieee.pdf The Design and Implementation of FFTW3]," ''Proceedings of the IEEE'' '''93''' (2), 216–231 (2005).</ref>
Chu and Burrus (1982) extended the algorithm to handle DFTs of real data, in which case the real DFT (RDFT) is expressed as two half-size convolutions.
 
Winograd extended Rader's algorithm to include prime-power DFT sizes <math>p^m</math>,<ref>S. Winograd, "On Computing the Discrete Fourier Transform", ''Proc. National Academy of Sciences USA'', '''73'''(4), 1005&ndash;1006 (1976).</ref><ref>S. Winograd, "On Computing the Discrete Fourier Transform", ''Mathematics of Computation'', '''32'''(141), 175&ndash;199 (1978).</ref> and today Rader's algorithm is sometimes described as a special case of [[Fast Fourier transform#Other FFT algorithms|Winograd's FFT algorithm]], also called the ''multiplicative Fourier transform algorithm'' (Tolimieri et al., 1997),<ref>R. Tolimieri, M. An, and C.Lu, ''Algorithms for Discrete Fourier Transform and Convolution'', Springer-Verlag, 2nd ed., 1997.</ref> which applies to an even larger class of sizes. However, for [[composite number|composite]] sizes such as prime powers, the [[Cooley–Tukey FFT algorithm]] is much simpler and more practical to implement, so Rader's algorithm is typically only used for large-prime [[Base case (recursion)|base case]]s of Cooley–Tukey's [[Recursion (computer science)|recursive]] decomposition of the DFT.<ref name=Frigo05/>
==Algorithm==
 
==Algorithm==
Recall that the DFT is defined by the formula
[[File:FFT visual Rader 11.jpg|thumb|Visual representation of a [[DFT matrix]] in Rader's FFT algorithm. The array consists of colored clocks representing a DFT matrix of size 11. By permuting rows and columns (except the first of each) according to sequences generated by the powers of the primitive root of 11, the original DFT matrix becomes a [[circulant matrix]]. Multiplying a data sequence with a circulant matrix is equivalent to the [[cyclic convolution]] with the matrix's row vector. This relation is an example of the fact that the [[multiplicative group]] is cyclic: <math>(\mathbb Z/p\mathbb Z)^\times \cong C_{p-1}</math>.]]
Begin with the definition of the discrete Fourier transform:
 
:<math> X_k = \sum_{n=0}^{N-1} x_n e^{-\frac{2\pi i}{N} nk }
Line 13 ⟶ 16:
k = 0,\dots,N-1. </math>
 
If ''N'' is a prime number, then the set of non-zero indices ''<math>n'' =\in{} \{1,...\dots,''N''&ndash;-1\}</math> forms a [[group (mathematics)|group]] under multiplication [[modular arithmetic|modulo]] ''N''. One consequence of the [[number theory]] of such groups is that there exists a [[generating set of a group|generator]] of the group (sometimes called a [[Primitive root modulo n|primitive root]]), which can be found by exhaustive search or slightly better algorithms<ref>Donald E. Knuth, ''The Art of Computer Programming, vol. 2: Seminumerical Algorithms'', 3rd edition, section 4.5.4, p. 391 (Addison–Wesley, 1998).</ref>). This generator is an integer ''g'' such that ''<math>n'' = ''g''<sup>''^q'' \pmod N</supmath> (mod ''N'') for any non-zero index ''n'' and for a unique ''<math>q'' \in{} \{0,...\dots,''N''&ndash;-2\}</math> (forming a [[bijection]] from ''q'' to non-zero ''n''). Similarly, ''<math>k'' = ''g''<sup>&ndash;''^{-p''} \pmod N</supmath> (mod ''N'') for any non-zero index ''k'' and for a unique ''<math>p'' \in{} \{0,...\dots,''N''&ndash;-2\}</math>, where the negative exponent denotes the [[modular multiplicative inverse|multiplicative inverse]] of ''g''<supmath>''g^p''</sup> modulo\mod ''N''</math>. That means that we can rewrite the DFT using these new indices ''p'' and ''q'' as:
 
:<math> X_0 = \sum_{n=0}^{N-1} x_n,</math>
Line 21 ⟶ 24:
p = 0,\dots,N-2. </math>
 
(Recall that ''x''<sub>''n''</sub> and ''X''<sub>''k''</sub> are implicitly periodic in ''N'', and also that ''e''<supmath> e^{2&\pi; i}=1 </supmath>=1. ([[Euler's identity]]). Thus, all indices and exponents are taken modulo ''N'' as required by the group arithmetic.)
 
The final summation, above, is precisely a cyclic convolution of the two sequences ''a''<sub>''q''</sub> and ''b''<sub>''q''</sub> (of length ''N''&ndash;1, (''because <math>q'' =\in{} \{0,...\dots,''N''&ndash;-2\}</math>) defined by:
 
:<math>a_q = x_{g^q}</math>
Line 34 ⟶ 37:
This algorithm, then, requires O(''N'') additions plus O(''N'' log ''N'') time for the convolution. In practice, the O(''N'') additions can often be performed by absorbing the additions into the convolution: if the convolution is performed by a pair of FFTs, then the sum of ''x''<sub>''n''</sub> is given by the DC (0th) output of the FFT of ''a''<sub>''q''</sub> plus ''x''<sub>0</sub>, and ''x''<sub>0</sub> can be added to all the outputs by adding it to the DC term of the convolution prior to the inverse FFT. Still, this algorithm requires intrinsically more operations than FFTs of nearby composite sizes, and typically takes 3&ndash;10 times as long in practice.
 
If Rader's algorithm is performed by using FFTs of size ''N''&ndash;1 to compute the convolution, rather than by zero padding as mentioned above, the efficiency depends strongly upon ''N'' and the number of times that Rader's algorithm must be applied recursively. The worst case would be if ''N''&ndash;1 were 2''N''<sub>2</sub> where ''N''<sub>2</sub> is prime, with ''N''<sub>2</sub>&ndash;1 = 2''N''<sub>3</sub> where ''N''<sub>3</sub> is prime, and so on. In such cases, supposing that the chain of primes extended all the way down to some bounded value, the recursive application of Rader's algorithm would actually require O(''N''<sup>2</sup>) time. Such ''N''<sub>j</sub> are called [[Sophie Germain prime|Sophie Germain primes]]s, and such a sequence of them is called a [[Cunningham chain]] of the first kind. TheHowever, the lengthsalternative of Cunninghamzero chains,padding however,can arealways observedbe toemployed growif more slowly than log<sub>2</sub>(''N''), so Rader's algorithm applied in this way is probably not [[Big O notation|&Omegandash;]](''N''<sup>2</sup>),1 though it is possibly worse than O(''N'' log ''N'') for the worst cases. Fortunately,has a guaranteelarge ofprime O(''N'' log ''N'') complexity can be achieved by zero paddingfactor.
 
==References==
* C. M. Rader, "Discrete Fourier transforms when the number of data samples is prime," ''Proc. IEEE'' '''56''', 1107&ndash;1108 (1968).
 
<references/>
* S. Chu and C. Burrus, "A prime factor FTT algorithm using distributed arithmetic," '' IEEE Transactions on Acoustics, Speech, and Signal Processing'' '''30(2)''', 217&ndash;227 (1982).
 
[[Category:FFT algorithms]]