Prime-factor FFT algorithm

Fast Fourier Transform algorithm

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 group isomorphisms. 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.)

Algorithm

Let a ( x ) {\displaystyle a(x)} a polynomial and ω n {\displaystyle \omega _{n}} a principal n {\displaystyle n} th root of unity. We define the DFT of a ( x ) {\displaystyle a(x)} as the n {\displaystyle n} -tuple ( a ^ j ) = ( a ( ω n j ) ) {\displaystyle ({\hat {a}}_{j})=(a(\omega _{n}^{j}))} . In other words,

a ^ j = i = 0 n 1 a i ω n i j  for all  j = 0 , 1 , , n 1. {\displaystyle {\hat {a}}_{j}=\sum _{i=0}^{n-1}a_{i}\omega _{n}^{ij}\quad {\text{ for all }}j=0,1,\dots ,n-1.}
For simplicity, we denote the transformation as DFT ω n {\displaystyle {\text{DFT}}_{\omega _{n}}} .

The PFA relies on a coprime factorization of n = d = 0 D 1 n d {\textstyle n=\prod _{d=0}^{D-1}n_{d}} and turns DFT ω n {\displaystyle {\text{DFT}}_{\omega _{n}}} into d DFT ω n d {\textstyle \bigotimes _{d}{\text{DFT}}_{\omega _{n_{d}}}} for some choices of ω n d {\displaystyle \omega _{n_{d}}} 's where {\textstyle \bigotimes } is the tensor product.

Mapping Based on CRT

For a coprime factorization n = d = 0 D 1 n d {\textstyle n=\prod _{d=0}^{D-1}n_{d}} , we have the Chinese remainder map m ( m mod n d ) {\displaystyle m\mapsto (m{\bmod {n}}_{d})} from Z n {\displaystyle \mathbb {Z} _{n}} to d = 0 D 1 Z n d {\textstyle \prod _{d=0}^{D-1}\mathbb {Z} _{n_{d}}} with ( m d ) d = 0 D 1 e d m d {\textstyle (m_{d})\mapsto \sum _{d=0}^{D-1}e_{d}m_{d}} as its inverse where e d {\displaystyle e_{d}} 's are the central orthogonal idempotent elements with d = 0 D 1 e d = 1 ( mod n ) {\textstyle \sum _{d=0}^{D-1}e_{d}=1{\pmod {n}}} . Choosing ω n d = ω n e d {\displaystyle \omega _{n_{d}}=\omega _{n}^{e_{d}}} (therefore, d = 0 D 1 ω n d = ω n d = 0 D 1 e d = ω n {\textstyle \prod _{d=0}^{D-1}\omega _{n_{d}}=\omega _{n}^{\sum _{d=0}^{D-1}e_{d}}=\omega _{n}} ), we rewrite DFT ω n {\displaystyle {\text{DFT}}_{\omega _{n}}} as follows:

a ^ j = i = 0 n 1 a i ω n i j = i = 0 n 1 a i ( d = 0 D 1 ω n d ) i j = i = 0 n 1 a i d = 0 D 1 ω n d ( i mod n d ) ( j mod n d ) = i 0 = 0 n 0 1 i D 1 = 0 n D 1 1 a d = 0 D 1 e d i d d = 0 D 1 ω n d i d ( j mod n d ) . {\displaystyle {\hat {a}}_{j}=\sum _{i=0}^{n-1}a_{i}\omega _{n}^{ij}=\sum _{i=0}^{n-1}a_{i}\left(\prod _{d=0}^{D-1}\omega _{n_{d}}\right)^{ij}=\sum _{i=0}^{n-1}a_{i}\prod _{d=0}^{D-1}\omega _{n_{d}}^{(i{\bmod {n}}_{d})(j{\bmod {n}}_{d})}=\sum _{i_{0}=0}^{n_{0}-1}\cdots \sum _{i_{D-1}=0}^{n_{D-1}-1}a_{\sum _{d=0}^{D-1}e_{d}i_{d}}\prod _{d=0}^{D-1}\omega _{n_{d}}^{i_{d}(j{\bmod {n}}_{d})}.}
Finally, define a i 0 , , i D 1 = a d = 0 D 1 i d e d {\displaystyle a_{i_{0},\dots ,i_{D-1}}=a_{\sum _{d=0}^{D-1}i_{d}e_{d}}} and a ^ j 0 , , j D 1 = a ^ d = 0 D 1 j d e d {\displaystyle {\hat {a}}_{j_{0},\dots ,j_{D-1}}={\hat {a}}_{\sum _{d=0}^{D-1}j_{d}e_{d}}} , we have
a ^ j 0 , , j D 1 = i 0 = 0 n 0 1 i D 1 = 0 n D 1 1 a i 0 , , i D 1 d = 0 D 1 ω n d i d j d . {\displaystyle {\hat {a}}_{j_{0},\dots ,j_{D-1}}=\sum _{i_{0}=0}^{n_{0}-1}\cdots \sum _{i_{D-1}=0}^{n_{D-1}-1}a_{i_{0},\dots ,i_{D-1}}\prod _{d=0}^{D-1}\omega _{n_{d}}^{i_{d}j_{d}}.}
Therefore, we have the multi-dimensional DFT, d = 0 D 1 DFT ω n d {\displaystyle \otimes _{d=0}^{D-1}{\text{DFT}}_{\omega _{n_{d}}}} .

As Algebra Isomorphisms

PFA can be stated in a high-level way in terms of algebra isomorphisms. We first recall that for a commutative ring R {\displaystyle R} and a group isomorphism from G {\displaystyle G} to d G d {\textstyle \prod _{d}G_{d}} , we have the following algebra isomorphism

R [ G ] d R [ G d ] {\displaystyle R[G]\cong \bigotimes _{d}R[G_{d}]}
where {\displaystyle \bigotimes } refers to the tensor product of algebras.

To see how PFA works, we choose G = ( Z n , + , 0 ) {\displaystyle G=(\mathbb {Z} _{n},+,0)} and G d = ( Z n d , + , 0 ) {\displaystyle G_{d}=(\mathbb {Z} _{n_{d}},+,0)} be additive groups. We also identify R [ G ] {\displaystyle R[G]} as R [ x ] x n 1 {\textstyle {\frac {R[x]}{\langle x^{n}-1\rangle }}} and R [ G d ] {\displaystyle R[G_{d}]} as R [ x d ] x d n d 1 {\textstyle {\frac {R[x_{d}]}{\langle x_{d}^{n_{d}}-1\rangle }}} . Choosing η = a ( a mod n d ) {\displaystyle \eta =a\mapsto (a{\bmod {n}}_{d})} as the group isomorphism G d G d {\textstyle G\cong \prod _{d}G_{d}} , we have the algebra isomorphism η : R [ G ] d R [ G d ] {\textstyle \eta ^{*}:R[G]\cong \bigotimes _{d}R[G_{d}]} , or alternatively,

η : R [ x ] x n 1 d R [ x d ] x d n d 1 . {\displaystyle \eta ^{*}:{\frac {R[x]}{\langle x^{n}-1\rangle }}\cong \bigotimes _{d}{\frac {R[x_{d}]}{\langle x_{d}^{n_{d}}-1\rangle }}.}
Now observe that DFT ω n {\displaystyle {\text{DFT}}_{\omega _{n}}} is actually an algebra isomorphism from R [ x ] x n 1 {\textstyle {\frac {R[x]}{\langle x^{n}-1\rangle }}} to i R [ x ] x ω n i {\textstyle \prod _{i}{\frac {R[x]}{\langle x-\omega _{n}^{i}\rangle }}} and each DFT ω n d {\displaystyle {\text{DFT}}_{\omega _{n_{d}}}} is an algebra isomorphism from R [ x ] x d n d 1 {\textstyle {\frac {R[x]}{\langle {x_{d}}^{n_{d}}-1\rangle }}} to i d R [ x d ] x d ω n d i d {\textstyle \prod _{i_{d}}{\frac {R[x_{d}]}{\langle x_{d}-\omega _{n_{d}}^{i_{d}}\rangle }}} , we have an algebra isomorphism η {\displaystyle \eta '} from d i d R [ x d ] x d ω n d i d {\textstyle \bigotimes _{d}\prod _{i_{d}}{\frac {R[x_{d}]}{\langle x_{d}-\omega _{n_{d}}^{i_{d}}\rangle }}} to i R [ x ] x ω n i {\textstyle \prod _{i}{\frac {R[x]}{\langle x-\omega _{n}^{i}\rangle }}} . What PFA tells us is that DFT ω n = η d DFT ω n d η {\textstyle {\text{DFT}}_{\omega _{n}}=\eta '\circ \bigotimes _{d}{\text{DFT}}_{\omega _{n_{d}}}\circ \eta ^{*}} where η {\displaystyle \eta ^{*}} and η {\displaystyle \eta '} are re-indexing without actual arithmetic in R {\displaystyle R} .

Counting the Number of Multi-Dimensional Transformations

Notice that the condition for transforming DFT ω n {\displaystyle {\text{DFT}}_{\omega _{n}}} into η d DFT ω n d η {\textstyle \eta '\circ \bigotimes _{d}{\text{DFT}}_{\omega _{n_{d}}}\circ \eta ^{*}} relies on "an" additive group isomorphism η {\displaystyle \eta } from ( Z n , + , 0 ) {\displaystyle (\mathbb {Z} _{n},+,0)} to d ( Z n d , + , 0 ) {\textstyle \prod _{d}(\mathbb {Z} _{n_{d}},+,0)} . Any additive group isomorphism will work. To count the number of ways transforming DFT ω n {\displaystyle {\text{DFT}}_{\omega _{n}}} into η d DFT ω n d η {\textstyle \eta '\circ \bigotimes _{d}{\text{DFT}}_{\omega _{n_{d}}}\circ \eta ^{*}} , we only need to count the number of additive group isomorphisms from ( Z n , + , 0 ) {\displaystyle (\mathbb {Z} _{n},+,0)} to d ( Z n d , + , 0 ) {\textstyle \prod _{d}(\mathbb {Z} _{n_{d}},+,0)} , or alternative, the number of additive group automorphisms on ( Z n , + , 0 ) {\displaystyle (\mathbb {Z} _{n},+,0)} . Since ( Z n , + , 0 ) {\displaystyle (\mathbb {Z} _{n},+,0)} is cyclic, any automorphism can be written as 1 g {\displaystyle 1\mapsto g} where g {\displaystyle g} is a generator of ( Z n , + , 0 ) {\displaystyle (\mathbb {Z} _{n},+,0)} . By the definition of ( Z n , + , 0 ) {\displaystyle (\mathbb {Z} _{n},+,0)} , g {\displaystyle g} 's are exactly those coprime to n {\displaystyle n} . Therefore, there are exactly φ ( n ) {\displaystyle \varphi (n)} many such maps where φ {\displaystyle \varphi } is the Euler's totient function. The smallest example is n = 6 {\displaystyle n=6} where φ ( n ) = 2 {\displaystyle \varphi (n)=2} , demonstrating the two maps in the literature: the "CRT mapping" and the "Ruritanian mapping".[1]

See also

Notes

References

  • Good, I. J. (1958). "The interaction algorithm and practical Fourier analysis". Journal of the Royal Statistical Society, Series B. 20 (2): 361–372. JSTOR 2983896. Addendum, ibid. 22 (2), 373-375 (1960) JSTOR 2984108.
  • Thomas, L. H. (1963). "Using a computer to solve problems in physics". Applications of Digital Computers. Boston: Ginn.
  • Duhamel, P.; Vetterli, M. (1990). "Fast Fourier transforms: a tutorial review and a state of the art". Signal Processing. 19 (4): 259–299. doi:10.1016/0165-1684(90)90158-U.
  • 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. S2CID 585818.