Algorithm Search⌘K

Proofs: Sparse Fourier transform

These are the human proofs of Sparse Fourier transform, at full length.

SPARSE-DFT reports only correct coefficients for every K-sparse spectrum when T ≥ K, and finds the whole spectrum exactly when the support contains no stopping set full

This proof shows: correctness, complexity.

Setting. Let RR be a field, n=f1⋯fdn = f_1 \cdots f_d with pairwise coprime fi≥1f_i \ge 1, n≠0n \ne 0 in RR, and ω∈R\omega \in R of order exactly nn. For x∈Rnx \in R^n let Xk=∑j<nxjωjkX_k = \sum_{j<n} x_j \omega^{jk}. Write ωf=ωn/f\omega_f = \omega^{n/f} for a divisor ff of nn; it has order exactly ff. Since n≠0n \ne 0 in RR, every divisor of nn is nonzero in RR, so the fractions fi/nf_i/n and n/fin/f_i exist. Let S={0,…,T}∪{n/f1,…,n/fd}S = \{0, \ldots, T\} \cup \{n/f_1, \ldots, n/f_d\}, and for Y∈RnY \in R^n define the aliased sums

Ab(i,s)(Y)=fin∑0≤k<n, k≡b (fi)Yk ω−sk.A^{(i,s)}_b(Y) = \frac{f_i}{n} \sum_{0 \le k < n,\ k \equiv b \ (f_i)} Y_k\, \omega^{-sk}.

Statement. Suppose XX has at most KK nonzero entries and T≥KT \ge K. Then SPARSE-DFT terminates, every pair (k,v)(k, v) it returns has v=Xk≠0v = X_k \ne 0, and the flag success is true if and only if the returned map equals the nonzero part of XX. This happens if and only if the support of XX contains no nonempty stopping set, a set DD such that for every ii and bb the bucket {k:k≡b (fi)}\{k : k \equiv b \ (f_i)\} meets DD in 00 or at least 22 elements. The algorithm reads F∣S∣F |S| samples, F=∑ifiF = \sum_i f_i, and does O((K+d)F(F+K+d+log⁡n))O((K + d) F (F + K + d + \log n)) additions and multiplications.

Lemma 1 (aliasing). Line L2 sets Z(i,s)=A(i,s)(X)Z^{(i,s)} = A^{(i,s)}(X).

Proof. The inverse DFT gives xj=1n∑kXkω−jkx_j = \frac1n \sum_k X_k \omega^{-jk}; this uses that ω\omega has order nn, so ∑j<nωjm=0\sum_{j<n} \omega^{jm} = 0 for m≢0 (n)m \not\equiv 0 \ (n), and that nn is invertible. With j=tn/f+sj = t n/f + s, ω−jk=ωf−tkω−sk\omega^{-jk} = \omega_f^{-tk} \omega^{-sk}, and the sum over jj is unchanged by reducing indices modulo nn. So

∑t<fxtn/f+s ωftb=1n∑kXkω−sk∑t<fωft(b−k).\sum_{t<f} x_{tn/f + s}\, \omega_f^{tb} = \frac1n \sum_k X_k \omega^{-sk} \sum_{t<f} \omega_f^{t(b - k)}.

The inner sum is ff if k≡b (f)k \equiv b \ (f), since then each term is 11, and 00 otherwise, since ωfb−k≠1\omega_f^{b-k} \ne 1 is a root of uf−1=(u−1)(1+u+⋯+uf−1)u^f - 1 = (u - 1)(1 + u + \cdots + u^{f-1}). □\square

Lemma 2 (invariant). At all times Z(i,s)=A(i,s)(Y)Z^{(i,s)} = A^{(i,s)}(Y) for all i,si, s, where Y=X−∑k∈foundfound[k] ekY = X - \sum_{k \in \text{found}} \text{found}[k]\, e_k is the residual spectrum.

Proof. True after line L2 by Lemma 1, with found empty. The aliased sums are linear in YY, and Ac(l,s)(vek)A^{(l,s)}_c(v e_k) is flnvω−sk\frac{f_l}{n} v \omega^{-sk} for c=k mod flc = k \bmod f_l and 00 for other cc. So the update at line L9, which adds vv to found[k][k] and subtracts exactly these values, keeps the equality. Nothing else changes ZZ or found. □\square

Lemma 3 (Vandermonde). Let D⊆[0,n)D \subseteq [0, n) with ∣D∣≤T+1|D| \le T + 1, and c∈RDc \in R^D with ∑k∈Dckω−sk=0\sum_{k \in D} c_k \omega^{-sk} = 0 for s=0,1,…,Ts = 0, 1, \ldots, T. Then c=0c = 0.

Proof. The elements ω−k\omega^{-k}, k∈Dk \in D, are distinct because ω\omega has order nn. The rows s=0,…,∣D∣−1≤Ts = 0, \ldots, |D| - 1 \le T of the system form the square Vandermonde matrix (ω−sk)s,k(\omega^{-sk})_{s, k} on distinct nodes, whose determinant ∏k<k′(ω−k′−ω−k)\prod_{k < k'} (\omega^{-k'} - \omega^{-k}) is nonzero in the field RR. □\square

Lemma 4 (soundness of one peel). Suppose ∣supp Y∣≤K|\mathrm{supp}\, Y| \le K when bucket bb of stage ii passes line L8 with (k,v)(k, v). Then k≡b (fi)k \equiv b \ (f_i), v≠0v \ne 0, and in the class bb modulo fif_i the residual is exactly vekv e_k: Yk=vY_k = v and Yk′=0Y_{k'} = 0 for every other k′≡bk' \equiv b.

Proof. At line L7, kk satisfies k≡ri=b (fi)k \equiv r_i = b \ (f_i) by the Chinese remainder theorem. Since Zb(i,0)≠0Z^{(i,0)}_b \ne 0 (line L5) and n/fi≠0n/f_i \ne 0, v≠0v \ne 0. Let DD be the union of {k}\{k\} and the residual support in the class bb, so ∣D∣≤K+1≤T+1|D| \le K + 1 \le T + 1, and let ck′=Yk′−v[k′=k]c_{k'} = Y_{k'} - v [k' = k] on DD. Line L8 passed, so by Lemma 2, for s=0,…,Ts = 0, \ldots, T (all in SS),

0=Zb(i,s)−finvω−sk=fin∑k′∈Dck′ω−sk′.0 = Z^{(i,s)}_b - \frac{f_i}{n} v \omega^{-sk} = \frac{f_i}{n} \sum_{k' \in D} c_{k'} \omega^{-sk'}.

By Lemma 3, c=0c = 0. □\square

Lemma 5 (singletons pass). If the residual meets the class bb modulo fif_i in exactly one frequency kk, then bucket bb of stage ii passes lines L5 to L8 with this kk and v=Ykv = Y_k.

Proof. By Lemma 2, Zb(i,s)=finYkω−skZ^{(i,s)}_b = \frac{f_i}{n} Y_k \omega^{-sk} for all s∈Ss \in S, and Zb(i,0)≠0Z^{(i,0)}_b \ne 0. For j≠ij \ne i, Zb(i,n/fj)=ω−(n/fj)kZb(i,0)=ω−(n/fj)rZb(i,0)Z^{(i, n/f_j)}_b = \omega^{-(n/f_j) k} Z^{(i,0)}_b = \omega^{-(n/f_j) r} Z^{(i,0)}_b with r=k mod fjr = k \bmod f_j, because ωn=1\omega^{n} = 1. The powers ω−(n/fj)r=ωfj−r\omega^{-(n/f_j) r} = \omega_{f_j}^{-r}, 0≤r<fj0 \le r < f_j, are distinct, and Zb(i,0)≠0Z^{(i,0)}_b \ne 0, so line L6 finds exactly rj=k mod fjr_j = k \bmod f_j, and ri=b=k mod fir_i = b = k \bmod f_i. Since the fjf_j are pairwise coprime, the solution in [0,n)[0, n) of the congruences is unique and equals kk. Line L7 gives v=nfiZb(i,0)=Ykv = \frac{n}{f_i} Z^{(i,0)}_b = Y_k, and line L8 passes because its equations hold by the first sentence. □\square

Soundness. By induction on the peels, the residual support is always a subset of supp X\mathrm{supp}\, X, so it has at most KK elements: initially Y=XY = X, and by Lemma 4 each peel picks kk with Yk=v≠0Y_k = v \ne 0 and sets YkY_k to 00, leaving the other entries unchanged. So each peel removes one element of the residual support. A frequency is peeled at most once, since afterwards Yk=0Y_k = 0 forever, and when it is peeled found[k][k] goes from 00 to v=Yk=Xkv = Y_k = X_k (the residual at kk equals XkX_k until kk is peeled). Hence every returned pair has v=Xk≠0v = X_k \ne 0.

Termination. There are at most ∣supp X∣≤K|\mathrm{supp}\, X| \le K peels, and the budget at line L4 stops the loop after KK peels. A pass with no peel ends the loop. So there are at most K+1K + 1 passes, each finite.

The flag. If success, all Zb(1,s)=0Z^{(1,s)}_b = 0; by Lemma 2 and Lemma 3, applied in each class modulo f1f_1 to the residual (at most K≤TK \le T frequencies) with the shifts 0,…,T0, \ldots, T, Y=0Y = 0, so found is the nonzero part of XX. Conversely, if Y=0Y = 0 then all aliased sums vanish and success is true.

Stopping sets. Let D∗D^* be the residual support at the end. Every stopping set D⊆supp XD \subseteq \mathrm{supp}\, X is contained in D∗D^*: otherwise consider the first peel of an element k∈Dk \in D, at bucket bb of stage ii. Before it no element of DD has been peeled, so the residual contains DD, and the class bb contains k∈Dk \in D, hence at least two elements of DD and of the residual. This contradicts Lemma 4. On the other hand, D∗D^* is itself a stopping set. If the loop ended because of the budget, KK correct peels were made, so ∣supp X∣=K|\mathrm{supp}\, X| = K and D∗=∅D^* = \emptyset. Otherwise the last pass peeled nothing, so the tables did not change during it and it examined every bucket in the final state; by Lemma 5 no class meets D∗D^* in exactly one element. So D∗D^* is the largest stopping set in supp X\mathrm{supp}\, X, and success holds if and only if it is empty, that is, if and only if supp X\mathrm{supp}\, X contains no nonempty stopping set.

Cost. Line L2 reads fif_i samples per stage and shift, F∣S∣F|S| in all, and computes each DFT of length fif_i directly with at most fi2f_i^2 multiplications and fi2f_i^2 additions, at most ∣S∣F2|S| F^2 of each. A pass examines FF buckets. Each examination does at most ∑jfj=F\sum_j f_j = F multiplications and comparisons at line L6, O(d)O(d) operations for the Chinese remainder step at line L7, and at most 3∣S∣3|S| multiplications and ∣S∣|S| subtractions at line L8, besides the powers ω−sk\omega^{-sk}: ω−k\omega^{-k} costs O(log⁡n)O(\log n) multiplications by repeated squaring, its powers for s≤Ts \le T one multiplication each, and for s=n/fjs = n/f_j they are the table entries ωfj−(k mod fj)\omega_{f_j}^{-(k \bmod f_j)}. Each of the at most KK peels does d∣S∣d|S| subtractions and 2d∣S∣2d|S| multiplications, with the same powers. With at most K+1K + 1 passes and ∣S∣≤T+1+d=K+1+d|S| \le T + 1 + d = K + 1 + d, the total is O(∣S∣F2+(K+1)F(F+d+∣S∣+log⁡n)+Kd∣S∣)=O((K+d)F(F+K+d+log⁡n))O(|S| F^2 + (K + 1) F (F + d + |S| + \log n) + K d |S|) = O((K + d) F (F + K + d + \log n)), using d≤Fd \le F. The tables hold F∣S∣=O(F(K+d))F|S| = O(F (K + d)) entries, and found at most KK. ■\blacksquare

Back to Sparse Fourier transform