The prime-factor algorithm (PFA), also called the Good–Thomas algorithm (1958/1963), is a fast Fourier transform (FFT) algorithm that re-expresses the discrete Fourier transform (DFT) of a size N = N1N2 as a two-dimensional N1×N2 DFT, but only for the case where N1 and N2 are relatively prime. These smaller transforms of size N1 and N2 can then be evaluated by applying PFA recursively or by using some other FFT algorithm.
PFA should not be confused with the mixed-radix generalization of the popular Cooley–Tukey algorithm, which also subdivides a DFT of size N = N1N2 into smaller transforms of size N1 and N2. The latter algorithm can use any factors (not necessarily relatively prime), but it has the disadvantage that it also requires extra multiplications by roots of unity called twiddle factors, in addition to the smaller transforms. On the other hand, PFA has the disadvantages that it only works for relatively prime factors (e.g. it is useless for power-of-two sizes) and that it requires more complicated re-indexing of the data based on the additive groupisomorphisms. Note, however, that PFA can be combined with mixed-radix Cooley–Tukey, with the former factorizing N into relatively prime components and the latter handling repeated factors.
PFA is also closely related to the nested Winograd FFT algorithm, where the latter performs the decomposed N1 by N2 transform via more sophisticated two-dimensional convolution techniques. Some older papers therefore also call Winograd's algorithm a PFA FFT.
(Although the PFA is distinct from the Cooley–Tukey algorithm, Good's 1958 work on the PFA was cited as inspiration by Cooley and Tukey in their 1965 paper, and there was initially some confusion about whether the two algorithms were different. In fact, it was the only prior FFT work cited by them, as they were not then aware of the earlier research by Gauss and others.)
Let be a polynomial and be a principal -th root of unity. We define the DFT of as the -tuple .
In other words,
For simplicity, we denote the transformation as .
The PFA relies on a coprime factorization of and turns into for some choices of 's where is the tensor product.
For a coprime factorization , we have the Chinese remainder map from to with as its inverse where 's are the central orthogonal idempotent elements with .
Choosing (therefore, ), we rewrite as follows:
Finally, define and ,
we have
Therefore, we have the multi-dimensional DFT, .
To see how PFA works, we choose and be additive groups.
We also identify as and as .
Choosing as the group isomorphism , we have the algebra isomorphism , or alternatively,
Now observe that is actually an algebra isomorphism from to and each is an algebra isomorphism from to ,
we have an algebra isomorphism from to .
What PFA tells us is that where and are re-indexing without actual arithmetic in .
Counting the Number of Multi-Dimensional Transformations
Notice that the condition for transforming into relies on "an" additive group isomorphism from to .
Any additive group isomorphism will work.
To count the number of ways transforming into ,
we only need to count the number of additive group isomorphisms from to , or alternative, the number of additive group automorphisms on .
Since is cyclic, any automorphism can be written as where is a generator of .
By the definition of , 's are exactly those coprime to .
Therefore, there are exactly many such maps where is the Euler's totient function.
The smallest example is where , demonstrating the two maps in the literature: the "CRT mapping" and the "Ruritanian mapping".[1]
Good, I. J. (1958). "The interaction algorithm and practical Fourier analysis". Journal of the Royal Statistical Society, Series B. 20 (2): 361–372. doi:10.1111/j.2517-6161.1958.tb00300.x. JSTOR2983896. Addendum, ibid.22 (2), 373-375 (1960) JSTOR2984108.
Thomas, L. H. (1963). "Using a computer to solve problems in physics". Applications of Digital Computers. Boston: Ginn.
Chan, S. C.; Ho, K. L. (1991). "On indexing the prime-factor fast Fourier transform algorithm". IEEE Transactions on Circuits and Systems. 38 (8): 951–953. doi:10.1109/31.85638.
Good, I. J. (1971). "The relationship between two fast Fourier transforms". IEEE Transactions on Computers. 100 (3): 310–317. doi:10.1109/T-C.1971.223236. S2CID585818.