REAL-FFT returns X_0, …, X_(n/2) of a real sequence with n lg n + 3n + 8 real multiplications and (3/2) n lg n + (5/2) n + 8 real additions full
This proof shows: correctness, complexity.
Setting. Let K be C with complex conjugation, or Zp[i]=Zp[t]/(t2+1) for an odd prime p with a+bi=a−bi. In both cases conjugation is a ring automorphism of order at most 2 that fixes the subring F of "real" elements (R or Zp) and sends i to −i, and 2 and i are units. Let n=2h with h=2s, s≥0, and let ω∈K satisfy ωn=1, ωh=−1 and ωωˉ=1. Over C, ω=e−2πi/n satisfies all three.
Statement. For every x∈Fn, REAL-FFT returns X0,…,Xh, where Xk=∑j=0n−1xjωjk, and moreover Xn−k=Xk for all k. If moreover ωk−1 is a unit for 0<k<n (true over C, in the field Zp[i] for p≡3(mod4), and for the roots used in the tests when p≡1(mod4), whose images in Zp×Zp are (ak−1,a−k−1) with a of order n), the inverse procedure of the page returns x from X0,…,Xh. Counting a multiplication in K as 4 multiplications and 2 additions in F, and an addition in K as 2 additions in F, REAL-FFT does nlgn+3n+8 multiplications and 23nlgn+25n+8 additions in F.
Conjugation of a transform. For y∈Fm and ν∈K with νm=1 and ννˉ=1, write Yk=∑j<myjνjk. Then νˉ=ν−1, so Yk=∑jyjν−jk=∑jyjνj(m−k)=Ym−k, using yˉj=yj and νjm=1. Applied to x and ω this gives Xn−k=Xk. (1)
The pieces. Let ν=ω2, so νh=1 and ννˉ=1, and let ej=x2j, oj=x2j+1 for 0≤j<h, with transforms Ek=∑jejνjk and Ok=∑jojνjk, defined for all integers k and of period h. Splitting the sum for Xk by the parity of the index,
Xk=j∑x2jω2jk+j∑x2j+1ω(2j+1)k=Ek+ωkOkfor all k.(2) Lines L2 to L4. Line L2 sets zj=ej+ioj. Line L3 computes Zk=∑jzjνjk for 0≤k<h: the radix-2 FFT of length h with root ν is correct when νh/2=−1 for h≥2, which holds since νh/2=ωh=−1 (see the iterative FFT page for its proof). By linearity, Zk=Ek+iOk. Line L4 extends Z by period h, which is consistent since νjh=1.
Lines L6 and L7. By (1) for e and o with root ν, Eh−k=Ek and Oh−k=Ok. Hence Zh−k=Eh−k+iˉOh−k=Ek−iOk. So Zk+Zh−k=2Ek and Zk−Zh−k=2iOk, and since 2 and i are units, lines L6 and L7 set E=Ek and O=Ok, for each 0≤k≤h.
Line L8. By (2), E+ωkO=Xk. So the returned list is (X0,…,Xh). For n=1 the procedure returns x0=X0 directly.
Inverse. Given X0,…,Xh of a real x, (1) gives Xk+h=Xh−k for 0≤k<h. By (2) and the period h of E,O, Xk=Ek+ωkOk and Xk+h=Ek+ωk+hOk=Ek−ωkOk. So 21(Xk+Xh−k)=Ek and 21(Xk−Xh−k)ω−k=Ok, and the procedure forms Zk=Ek+iOk, which is the transform of z=e+io with root ν. The inverse transform of length h, with ν−1 and the factor 1/h, returns z: for 0<k<h, νk−1=ω2k−1 is a unit by hypothesis, so ∑j<hνjk=(νkh−1)/(νk−1)=0, which is the orthogonality the inverse needs, and h is a unit because 2 is. Writing zj=ej+ioj with ej,oj∈F, the real and imaginary parts give x2j=ej and x2j+1=oj, because F⊕Fi=K is a direct sum.
Operation count. The radix-2 FFT of length h=2s does 2hs multiplications and hs additions in K, one multiplication and two additions for each of the 2h butterflies of each of the s stages. With s=lgn−1 and h=n/2, this is 4n(lgn−1) multiplications and 2n(lgn−1) additions in K, so n(lgn−1) multiplications and 2n(lgn−1)+n(lgn−1)=23n(lgn−1) additions in F. Each of the h+1 iterations of lines L5 to L8 does: at L6, one addition in K (2 in F) and a scaling by 21 (2 multiplications in F); at L7, one addition in K (2) and a scaling by 2i1=−2i, which maps a+bi to 2b−2ai (2 multiplications); at L8, one multiplication in K (4 multiplications and 2 additions) and one addition in K (2). That is 8 multiplications and 8 additions in F per iteration, 4n+8 of each in total, since h+1=2n+1. Conjugation is a sign change and is not counted. Adding up, the multiplications number n(lgn−1)+4n+8=nlgn+3n+8 and the additions 23n(lgn−1)+4n+8=23nlgn+25n+8. ■