SPLIT-RADIX-FFT computes the DFT of length 2^m with n lg n additions and (n/2) lg n − n + 1 multiplications full
This proof shows: correctness, complexity.
Statement. Let R be a commutative ring, n=2m with m≥0, and ω∈R with ωn/2=−1 if n≥2 (any ω if n=1). For every x∈Rn, SPLIT-RADIX-FFT(x,ω) returns X with Xk=∑j=0n−1xjωjk for 0≤k<n. It does exactly A(n)=nlgn additions and subtractions and exactly
T(n)=31nlgn−98n+1−91(−1)m,G(n)=61nlgn−91n+91(−1)m multiplications by twiddle factors (line L8) and by J (line L9), so T(n)+G(n)=2nlgn−n+1 multiplications in all.
The hypothesis is inherited. If n≥2 then ωn=(ωn/2)2=1. If n≥4, the call at line L3 has length n/2 and root ω2, and (ω2)(n/2)/2=ωn/2=−1; the calls at lines L4 and L5 have length n/4 and root ω4, and if n/4≥2 then (ω4)(n/4)/2=ωn/2=−1. So every recursive call satisfies the hypothesis of the statement.
Lemma 1 (the splitting). Let n≥4, q=n/4, and let Uk=∑j<2qx2jω2jk, Zk=∑j<qx4j+1ω4jk and Zk′=∑j<qx4j+3ω4jk, defined for all integers k≥0. Then for every k≥0,
Xk=Uk+ωkZk+ω3kZk′, and U has period 2q and Z,Z′ have period q in k.
Proof. Each j∈[0,n) is even, or 1 or 3 modulo 4, and in exactly one way of the form 2j′, 4j′+1 or 4j′+3. So Xk is the sum of ∑j′x2j′ω2j′k, ∑j′x4j′+1ω(4j′+1)k=ωkZk and ∑j′x4j′+3ω(4j′+3)k=ω3kZk′. The periods follow from ω2⋅2q=ωn=1 and ω4q=ωn=1. □
Lemma 2 (the L-shaped butterfly). With J=ωq and 0≤k<q, put a=ωkZk, b=ω3kZk′, s=a+b and d=J(a−b). Then
Xk=Uk+s,Xk+2q=Uk−s,Xk+q=Uk+q+d,Xk+3q=Uk+q−d. Proof. We have J2=ωn/2=−1, so J3=−J and J4=1. Apply Lemma 1 at k+rq for r=0,1,2,3. By the periods, Zk+rq=Zk and Zk+rq′=Zk′, and Uk+2q=Uk, Uk+3q=Uk+q. The twiddle factors are ωk+rq=Jrωk and ω3(k+rq)=J3rω3k. For r=0 this gives Xk=Uk+a+b. For r=2, J2=J6=−1, so Xk+2q=Uk−a−b. For r=1, J3=−J, so Xk+q=Uk+q+Ja−Jb=Uk+q+d. For r=3, J3=−J and J9=J, so Xk+3q=Uk+q−Ja+Jb=Uk+q−d. □
Correctness. By induction on m. For n=1, line L1 returns x, and X0=x0. For n=2, ω=ωn/2=−1, so X0=x0+x1 and X1=x0−x1, which line L2 returns. Let n≥4. The recursive calls satisfy the hypothesis and are on shorter inputs, so by induction lines L3, L4 and L5 compute the sequences U (for 0≤k<2q), Z and Z′ (for 0≤k<q) of Lemma 1: line L3 gets the DFT of (x2j) with root ω2, and lines L4 and L5 get those of (x4j+1) and (x4j+3) with root ω4. Line L6 sets J=ωq. At k=0 the factors ω0 are 1, so line L8 sets a=Z0 and b=Z0′ without a product, which are the values of Lemma 2. By Lemma 2, lines L9 to L11 write the correct values to positions k,k+q,k+2q,k+3q. As k runs over [0,q) and r over {0,1,2,3}, k+rq runs over [0,n) exactly once (division by q). So line L12 returns X.
Inverse. If n is a unit and ω is a principal n-th root of unity (for example, R a field, where ω has order exactly n because ωn/2=−1=1), then ω−1 also satisfies (ω−1)n/2=−1, and the procedure with ω−1 followed by division by n inverts the DFT, as shown on the page of the inverse discrete Fourier transform.
Operation count. For n≥4 each iteration of lines L7 to L11 does 6 additions and subtractions (a+b, a−b and four at lines L10 and L11), one product by J, and two twiddle products unless k=0. With q=n/4 iterations, the recurrences are
A(n)=A(n/2)+2A(n/4)+23n,T(n)=T(n/2)+2T(n/4)+2n−2,G(n)=G(n/2)+2G(n/4)+4n, for n≥4, with A(1)=0, A(2)=2, and T and G zero at n=1,2, since lines L1 and L2 do no multiplications. Each recurrence determines its function from its two initial values, so it suffices to check that the claimed formulas take these values and satisfy the recurrences. Write ϵ=(−1)m, so (−1)m−1=−ϵ and (−1)m−2=ϵ.
- A: nlgn is 0 at n=1 and 2 at n=2, and 2n(m−1)+2⋅4n(m−2)+23n=nm−2n−n+23n=nm.
- T: at n=1, 0−98+1−91=0; at n=2, 32−916+1+91=0. And T(n/2)+2T(n/4)=61n(m−1)−94n+1+91ϵ+61n(m−2)−94n+2−92ϵ=31nm−21n−98n+3−91ϵ; adding 2n−2 gives T(n).
- G: at n=1, 0−91+91=0; at n=2, 31−92−91=0. And G(n/2)+2G(n/4)=121n(m−1)−181n−91ϵ+121n(m−2)−181n+92ϵ=61nm−41n−91n+91ϵ; adding 4n gives G(n).
Adding, T(n)+G(n)=21nlgn−n+1.
Time and space. Each call does O(1) work besides its counted operations and its loop, and the number of calls C(n)=1+C(n/2)+2C(n/4) with C(1)=C(2)=1 is O(n) (by induction, C(n)≤2n−1, since 1+(n−1)+2(2n−1)=2n−2). So the time is Θ(nlogn). A call of length n holds its three partial results and its output, O(n) entries, while it runs; along a root-to-leaf path the lengths at least halve, so the live storage is O(n+n/2+…)=O(n), plus the table of n powers and a recursion stack of depth lgn. The extra space is Θ(n). ■