Purpose: Compute a DFT of arbitrary length — including large primes — in , by turning it into a convolution. Also called the chirp-z transform.
The Chirp Trick
Start from the DFT and use the identity
Substituting into :
The sum is a convolution of the sequences and . Convolutions of any length can be computed by zero-padding to a power of two and running an ordinary radix-2 FFT.
Algorithm
- Form for .
- Form for .
- Convolve and using FFT with padding to , a power of two.
- Multiply the result by to recover .
Note requires a half power; use so the exponents stay integral: .
Complexity
- Time: — three FFTs of size
- Space:
- Constant factor: about 3-6× a native power-of-two FFT of the same length
When you need it
| Situation | Use |
|---|---|
| is a power of 2 | Cooley-Tukey directly |
| factors into small primes | mixed-radix Cooley-Tukey |
| , coprime | Good-Thomas |
| is prime | Rader or Bluestein |
| arbitrary, or a partial spectrum wanted | Bluestein |
The competitive programming reality
You almost never need a DFT of a fixed non-power-of-two length. Zero-padding a convolution to the next power of two is correct and simpler. Bluestein earns its place for two other reasons:
- Cyclic convolution of exact length — when wraparound matters and padding would change the answer.
- Chirp-z evaluation — evaluating a polynomial at points in geometric progression in , which is exactly what Bluestein computes and what several “evaluate at powers of ” problems require.
Chirp-z as polynomial evaluation
Given of degree , evaluating at is
the same shape as the DFT with replaced by . The chirp identity applies unchanged, giving — a strictly more general tool than the DFT, and a genuinely useful one for problems involving geometric sequences of evaluation points.
Variants / Use Cases
- FFT and NTT — the topic page
- Rader’s algorithm — the other prime-length technique; uses a group-theoretic permutation instead of a chirp
- Multipoint evaluation — the method for arbitrary evaluation points
- Zoom FFT / spectral analysis — the signal-processing use of chirp-z