CoSaMP
Inside the Identify-Merge-Estimate-Prune Loop
CoSaMP solves the same inverse problem as basis-pursuit convex optimization, recovering a sparse coefficient vector x from compressed measurements y = Φx, but it does so greedily rather than by linear programming. The starting point is a residual proxy, formed by applying the matched filter ΦT to the current residual. The entries of this proxy with the largest magnitude reveal where the signal energy most likely lives, which is the geometric insight that makes the support search reliable when the sensing matrix is well conditioned on sparse subsets.
Each iteration runs four steps in sequence. First, the algorithm identifies the 2k indices with the largest proxy magnitude. Second, it merges that set with the support of the current estimate, producing a candidate set of up to 3k indices. Third, it estimates the signal by solving an ordinary least-squares problem restricted to those columns of Φ. Fourth, it prunes the least-squares solution back to its k largest entries, fixing the new support and the new residual for the following pass. Unlike orthogonal matching pursuit, which commits to one index forever, the prune step lets CoSaMP retract a poor early decision, which is what gives it both speed and a clean theoretical guarantee.
The guarantee rests on the restricted isometry property (RIP). A matrix Φ satisfies RIP of order s with constant δs if it nearly preserves the norm of every s-sparse vector. When δ4k stays below about 0.1, CoSaMP recovers any k-sparse signal exactly in the noiseless case and recovers approximately sparse, noisy signals with an error bounded by the best k-term approximation error plus the measurement-noise norm. Random Gaussian, Bernoulli, and partial-Fourier matrices satisfy this property with high probability once the measurement count m reaches a small multiple of k·log(N/k).
Recovery Guarantee and Halting Condition
y = Φx + e, Φ ∈ ℝm×N, ‖x‖0 ≤ k
Residual proxy (per iteration):
u = ΦT(y − Φa), Ω = supp(u, 2k)
Stable recovery bound (RIP δ4k < 0.1):
‖x − a‖2 ≤ C × ( ‖x − xk‖2 + (1/√k)‖x − xk‖1 + ‖e‖2 )
Measurement count:
m ≈ C0 × k × log(N / k)
Where xk = best k-term approximation of x, a = current estimate, e = noise, C ≈ 20 and C0 are constants. Example: N = 1024, k = 20 recovers reliably with m ≈ 200 to 250 measurements.
Greedy Sparse-Recovery Algorithm Comparison
| Algorithm | Indices per iteration | Can retract? | RIP guarantee | Iterations | Cost per iteration |
|---|---|---|---|---|---|
| CoSaMP | Add 2k, prune to k | Yes | δ4k < 0.1 | Fixed (~6 to 10) | O(mN) or O(N log N) |
| Subspace Pursuit | Add k, prune to k | Yes | δ3k < 0.165 | Fixed | O(mN) |
| OMP | Add 1 | No | Weaker / non-uniform | ≥ k | O(mN) |
| Iterative Hard Thresholding | Gradient + threshold to k | Yes | δ3k < 1/√32 (≈ 0.177) | Many | O(mN) |
| Basis Pursuit (L1) | Convex solve (no greedy step) | n/a | δ2k < 0.414 | Interior point | O(N3) class |
Frequently Asked Questions
How many measurements does CoSaMP need to recover a k-sparse signal?
Recovery is guaranteed once the m×N sensing matrix satisfies RIP with δ4k < 0.1, which random Gaussian or sub-Gaussian matrices achieve with only m ≈ k·log(N/k) rows. For N = 1024 and sparsity k = 20, reliable recovery typically needs m near 200 to 250 measurements, a 4 to 5 times reduction versus collecting all N Nyquist samples. The result is stable: with approximate sparsity and noise, the error is bounded by the best k-term approximation error plus the noise norm.
How does CoSaMP differ from orthogonal matching pursuit?
OMP adds exactly one index per iteration and never removes it, so it needs at least k iterations and a single bad early pick is permanent. CoSaMP instead grabs the 2k largest residual-proxy entries, merges them with the current k-element estimate into a 3k set, solves least squares, then prunes back to the best k. The prune step lets it retract mistakes, converge in a fixed iteration count independent of k, and carry a rigorous RIP recovery proof that standard OMP lacks.
What is the computational cost of one CoSaMP iteration?
Each pass is dominated by two matrix-vector products with Φ plus a least-squares solve on 3k columns, so a dense unstructured matrix costs O(mN) per iteration. When Φ is a structured operator such as a partial FFT or random convolution, those products drop to O(N log N), which is why hardware sub-Nyquist RF receivers favor structured measurement matrices. Iteration count grows only logarithmically in SNR, so total runtime is a small multiple of a few transform evaluations.