Prime-factor FFT algorithm

From HandWiki
Short description: 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 [math]\displaystyle{ a(x) }[/math] a polynomial and [math]\displaystyle{ \omega_n }[/math] a principal [math]\displaystyle{ n }[/math]th root of unity. We define the DFT of [math]\displaystyle{ a(x) }[/math] as the [math]\displaystyle{ n }[/math]-tuple [math]\displaystyle{ (\hat{a}_j) = (a(\omega_n^j)) }[/math]. In other words, [math]\displaystyle{ \hat{a}_j = \sum_{i=0}^{n-1} a_i \omega_n^{ij} \quad \text{ for all } j = 0, 1, \dots, n - 1. }[/math] For simplicity, we denote the transformation as [math]\displaystyle{ \text{DFT}_{\omega_n} }[/math].

The PFA relies on a coprime factorization of [math]\displaystyle{ n = \prod_{d = 0}^{D - 1} n_d }[/math] and turns [math]\displaystyle{ \text{DFT}_{\omega_n} }[/math] into [math]\displaystyle{ \bigotimes_d \text{DFT}_{\omega_{n_d}} }[/math] for some choices of [math]\displaystyle{ \omega_{n_d} }[/math]'s where [math]\displaystyle{ \bigotimes }[/math] is the tensor product.

Mapping Based on CRT

For a coprime factorization [math]\displaystyle{ n = \prod_{d = 0}^{D - 1} n_d }[/math], we have the Chinese remainder map [math]\displaystyle{ m \mapsto (m \bmod q_d) }[/math] from [math]\displaystyle{ \mathbb{Z}_{n} }[/math] to [math]\displaystyle{ \prod_{d = 0}^{D - 1} \mathbb{Z}_{n_d} }[/math] with [math]\displaystyle{ (m_d) \mapsto \sum_{d = 0}^{D - 1} e_d m_d }[/math] as its inverse where [math]\displaystyle{ e_d }[/math]'s are the central orthogonal idempotent elements with [math]\displaystyle{ \sum_{d = 0}^{D - 1} e_d = 1 \pmod{n} }[/math]. Choosing [math]\displaystyle{ \omega_{n_d} = \omega_n^{e_d} }[/math] (therefore, [math]\displaystyle{ \prod_{d = 0}^{D - 1} \omega_{n_d} = \omega_n^{\sum_{d = 0}^{D - 1} e_d} = \omega_n }[/math]), we rewrite [math]\displaystyle{ \text{DFT}_{\omega_n} }[/math] as follows: [math]\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}}^{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)} . }[/math] Finally, define [math]\displaystyle{ a_{i_0, \dots, i_{D - 1}} = a_{\sum_{d = 0}^{D - 1} i_d e_d} }[/math] and [math]\displaystyle{ \hat{a}_{j_0, \dots, j_{D - 1}} = \hat{a}_{\sum_{d = 0}^{D - 1} j_d e_d} }[/math], we have [math]\displaystyle{ \hat{a}_{j_0, \dots, j_{D - 1}} = \sum_{i_0 = 0}^{n_0 - 1} \cdots \sum_{i_{D - 1}}^{n_{D - 1} - 1} a_{i_0, \dots, i_{D - 1}} \prod_{d = 0}^{D - 1} \omega_{n_d}^{i_d j_d} . }[/math] Therefore, we have the multi-dimensional DFT, [math]\displaystyle{ \otimes_{d = 0}^{D - 1} \text{DFT}_{\omega_{n_d}} }[/math].

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 [math]\displaystyle{ R }[/math] and a group isomorphism from [math]\displaystyle{ G }[/math] to [math]\displaystyle{ \prod_d G_d }[/math], we have the following algebra isomorphism [math]\displaystyle{ R[G] \cong \bigotimes_d R[G_d] }[/math] where [math]\displaystyle{ \bigotimes }[/math] refers to the tensor product of algebras.

To see how PFA works, we choose [math]\displaystyle{ G = (\mathbb{Z}_n, +, 0) }[/math] and [math]\displaystyle{ G_d = (\mathbb{Z}_{n_d}, +, 0) }[/math] be additive groups. We also identify [math]\displaystyle{ R[G] }[/math] as [math]\displaystyle{ \frac{R[x]}{\langle x^n - 1 \rangle} }[/math] and [math]\displaystyle{ R[G_d] }[/math] as [math]\displaystyle{ \frac{R[x_d]}{\langle x_d^{n_d} - 1 \rangle} }[/math]. Choosing [math]\displaystyle{ \eta = a \mapsto (a \bmod n_d) }[/math] as the group isomorphism [math]\displaystyle{ G \cong \prod_d G_d }[/math], we have the algebra isomorphism [math]\displaystyle{ \eta^* : R[G] \cong \bigotimes_d R[G_d] }[/math], or alternatively, [math]\displaystyle{ \eta^* : \frac{R[x]}{\langle x^n - 1 \rangle} \cong \bigotimes_d \frac{R[x_d]}{\langle x_d^{n_d} - 1 \rangle} . }[/math] Now observe that [math]\displaystyle{ \text{DFT}_{\omega_n} }[/math] is actually an algebra isomorphism from [math]\displaystyle{ \frac{R[x]}{\langle x^n - 1 \rangle} }[/math] to [math]\displaystyle{ \prod_i \frac{R[x]}{\langle x - \omega_n^i \rangle} }[/math] and each [math]\displaystyle{ \text{DFT}_{\omega_{n_d}} }[/math] is an algebra isomorphism from [math]\displaystyle{ \frac{R[x]}{\langle {x_d}^{n_d} - 1 \rangle} }[/math] to [math]\displaystyle{ \prod_{i_d} \frac{R[x_d]}{\langle x_d - \omega_{n_d}^{i_d} \rangle} }[/math], we have an algebra isomorphism [math]\displaystyle{ \eta' }[/math] from [math]\displaystyle{ \bigotimes_d \prod_{i_d} \frac{R[x_d]}{\langle x_d - \omega_{n_d}^{i_d} \rangle} }[/math] to [math]\displaystyle{ \prod_i \frac{R[x]}{\langle x - \omega_n^i \rangle} }[/math]. What PFA tells us is that [math]\displaystyle{ \text{DFT}_{\omega_n} = \eta' \circ \bigotimes_d \text{DFT}_{\omega_{n_d}} \circ \eta^* }[/math] where [math]\displaystyle{ \eta^* }[/math] and [math]\displaystyle{ \eta' }[/math] are re-indexing without actual arithmetic in [math]\displaystyle{ R }[/math].

Counting the Number of Multi-Dimensional Transformations

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

See also

Notes

References