Prime-factor FFT algorithm

Revision as of 00:58, 6 April 2025 by imported>Quondum (rm title case; fmt; fixing weirdness of <math display="block"> not being on its own line in Brave browser)
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

Template:Use American English Template:Short description 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 Template:Nowrap as a two-dimensional Template:Nowrap 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 Template:Nowrap 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.)

AlgorithmEdit

Let <math>a(x)</math> be a polynomial and <math>\omega_n</math> be a principal <math>n</math>-th root of unity. We define the DFT of <math>a(x)</math> as the <math>n</math>-tuple <math>(\hat{a}_j) = (a(\omega_n^j)) </math>. In other words, <math display="block">\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>\text{DFT}_{\omega_n}</math>.

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

Mapping based on CRTEdit

For a coprime factorization Template:Tmath, we have the Chinese remainder map <math>m \mapsto (m \bmod n_d)</math> from <math>\mathbb{Z}_{n}</math> to <math display="inline">\prod_{d = 0}^{D - 1} \mathbb{Z}_{n_d} </math> with <math display="inline">(m_d) \mapsto \sum_{d = 0}^{D - 1} e_d m_d</math> as its inverse where Template:Tmath's are the central orthogonal idempotent elements with <math display="inline">\sum_{d = 0}^{D - 1} e_d = 1 \pmod{n}</math>. Choosing <math>\omega_{n_d} = \omega_n^{e_d}</math> (therefore, Template:Tmath), we rewrite <math>\text{DFT}_{\omega_n}</math> as follows:

<math display="block">\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)} .</math>

Finally, define <math>a_{i_0, \dots, i_{D - 1}} = a_{\sum_{d = 0}^{D - 1} i_d e_d}</math> and Template:Tmath, we have

<math display="block">\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} .</math>

Therefore, we have the multi-dimensional DFT, Template:Tmath.

As algebra isomorphismsEdit

PFA can be stated in a high-level way in terms of algebra isomorphisms. We first recall that for a commutative ring <math>R</math> and a group isomorphism from <math>G</math> to Template:Tmath, we have the following algebra isomorphism

<math display="block">R[G] \cong \bigotimes_d R[G_d] ,</math>

where <math>\bigotimes</math> refers to the tensor product of algebras.

To see how PFA works, we choose <math>G = (\Z_n, +, 0)</math> and <math>G_d = (\Z_{n_d}, +, 0)</math> be additive groups. We also identify <math>R[G]</math> as <math display="inline">\frac{R[x]}{\langle x^n - 1 \rangle}</math> and <math>R[G_d]</math> as Template:Tmath. Choosing <math>\eta = a \mapsto (a \bmod n_d)</math> as the group isomorphism Template:Tmath, we have the algebra isomorphism <math display="inline">\eta^* : R[G] \cong \bigotimes_d R[G_d]</math>, or alternatively,

<math display="block"> \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>\text{DFT}_{\omega_n}</math> is actually an algebra isomorphism from <math display="inline">\frac{R[x]}{\langle x^n - 1 \rangle}</math> to <math display="inline">\prod_i \frac{R[x]}{\langle x - \omega_n^i \rangle}</math> and each <math>\text{DFT}_{\omega_{n_d}}</math> is an algebra isomorphism from <math display="inline">\frac{R[x]}{\langle {x_d}^{n_d} - 1 \rangle}</math> to <math display="inline">\prod_{i_d} \frac{R[x_d]}{\langle x_d - \omega_{n_d}^{i_d} \rangle}</math>, we have an algebra isomorphism <math>\eta'</math> from <math display="inline">\bigotimes_d \prod_{i_d} \frac{R[x_d]}{\langle x_d - \omega_{n_d}^{i_d} \rangle}</math> to <math display="inline">\prod_i \frac{R[x]}{\langle x - \omega_n^i \rangle}</math>. What PFA tells us is that <math display="inline">\text{DFT}_{\omega_n} = \eta' \circ \bigotimes_d \text{DFT}_{\omega_{n_d}} \circ \eta^*</math> where <math>\eta^*</math> and <math>\eta'</math> are re-indexing without actual arithmetic in <math>R</math>.

Counting the number of multi-dimensional transformationsEdit

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

See alsoEdit

NotesEdit

Template:Reflist

ReferencesEdit

Template:Refbegin

Template:Refend