{
  "aliases": null,
  "backlinks": [
    {
      "field": "uses",
      "target": "S966EZX3ZT"
    }
  ],
  "body": "\n## Statement\n\nFor $M \\ge 1$ let $\\omega_M = e^{-2\\pi i/M}$.\nLet $N = N_1 N_2$ where $N_1, N_2 \\ge 1$ are coprime integers.\nLet $x \\in \\C^N$ and let $X$ be its [[discrete Fourier transform|TST0GH66A5]], $X_k = \\sum_{n=0}^{N-1} x_n \\omega_N^{nk}$.\nFor $0 \\le n_1 \u003c N_1$ and $0 \\le n_2 \u003c N_2$ let $n(n_1, n_2) = (N_2 n_1 + N_1 n_2) \\bmod N$.\nFor $0 \\le k_1 \u003c N_1$ and $0 \\le k_2 \u003c N_2$ let $k(k_1, k_2)$ be the unique $k \\in \\set{0, \\ldots, N-1}$ with $k \\equiv k_1 \\pmod{N_1}$ and $k \\equiv k_2 \\pmod{N_2}$.\nThen both index maps are bijections onto $\\set{0, \\ldots, N-1}$, and\n$$X_{k(k_1, k_2)} = \\sum_{n_1=0}^{N_1-1} \\sum_{n_2=0}^{N_2-1} x_{n(n_1, n_2)}\\, \\omega_{N_1}^{n_1 k_1}\\, \\omega_{N_2}^{n_2 k_2}.$$\nSo a DFT of length $N$ is a two-dimensional DFT of size $N_1 \\times N_2$, with no twiddle factors.\n\n## Remarks\n\nThe output map is a bijection by the [[Chinese remainder theorem|0FNN9B4W64]].\nThe input map is a bijection because $n(n_1, n_2) \\equiv N_2 n_1 \\pmod{N_1}$ and $N_2$ is invertible modulo $N_1$, and similarly modulo $N_2$.\nFor the formula, $\\omega_N^{N_2 n_1 k} = \\omega_{N_1}^{n_1 k} = \\omega_{N_1}^{n_1 k_1}$ since $k \\equiv k_1 \\pmod{N_1}$, and in the same way $\\omega_N^{N_1 n_2 k} = \\omega_{N_2}^{n_2 k_2}$.\nExample: $N = 6 = 2 \\cdot 3$; the input order $n(n_1, n_2) = (3n_1 + 2n_2) \\bmod 6$ lists $0, 2, 4$ for $n_1 = 0$ and $3, 5, 1$ for $n_1 = 1$.\nCoprimality is necessary: for $N_1 = N_2 = 2$ the input map gives $2n_1 + 2n_2 \\bmod 4$, which takes only the values $0$ and $2$.\nFor non-coprime factors one uses the [[Cooley–Tukey algorithm|9N8D9E5TB2]], which pays with twiddle factors.\n\n## Explanations\n\n### L1 human\n\nSuppose the length of a Fourier transform is a product of two coprime numbers, such as $6 = 2 \\cdot 3$ or $15 = 3 \\cdot 5$.\nThen the input and output can be reordered so that the transform becomes a grid of small transforms.\nThe reordering is the Chinese remainder theorem in action.\nUnlike the Cooley–Tukey split, no extra multiplications are needed between the two stages.\n\n### L2 human\n\nThe algorithm is due to Good and to Thomas, and is often called the Good–Thomas algorithm.\nIt is used for lengths with several coprime factors, with each small length done by a hand-optimised module, for example Winograd's.\nThe price is the more complicated index arithmetic.\nA prime-power length such as $8$ or $9$ cannot be split this way, and a Cooley–Tukey or another FFT is used for such factors.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "about": [
      "TST0GH66A5"
    ],
    "kind": "statement",
    "msc": [
      "65T50"
    ],
    "name": "Prime-factor FFT algorithm",
    "role": "theorem",
    "same_as": {
      "wikidata": "Q7243214",
      "wikipedia": "Prime-factor FFT algorithm"
    },
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Prime-factor_FFT_algorithm"
      }
    ],
    "tag": "BH3NNAYJT5",
    "uses": [
      "TST0GH66A5",
      "0FNN9B4W64",
      "9N8D9E5TB2"
    ]
  },
  "kind": "statement",
  "link": "https://tamnd.github.io/math2/node/BH3NNAYJT5/",
  "links": [
    {
      "field": "about",
      "target": "TST0GH66A5"
    },
    {
      "field": "uses",
      "target": "TST0GH66A5"
    },
    {
      "field": "uses",
      "target": "0FNN9B4W64"
    },
    {
      "field": "uses",
      "target": "9N8D9E5TB2"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/BH3NNAYJT5.md",
  "msc": [
    "65T50"
  ],
  "name": "Prime-factor FFT algorithm",
  "prov": null,
  "role": "theorem",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/BH3/BH3NNAYJT5.md",
  "status": null,
  "tag": "BH3NNAYJT5",
  "uri": "m2://BH3NNAYJT5",
  "url": "https://tamnd.github.io/math2/wiki/prime-factor-fft-algorithm/",
  "writing": {
    "tag": "BH3NNAYJT5",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
