Exercises
ch17-ex01
Easy(AMP Implementation and the Onsager Effect)
(a) Implement AMP with soft thresholding for , , i.i.d. Gaussian , Bernoulli-Gaussian reflectivity with , .
(b) Plot NMSE vs. iteration for 50 iterations.
(c) Remove the Onsager correction and plot the resulting ISTA convergence alongside AMP.
(d) Quantify the NMSE gap at convergence.
Initialize with , .
The average derivative for soft thresholding is the fraction of active components.
Implementation
The AMP iteration is: , .
Result
AMP converges to NMSE in 15 iterations. ISTA converges to NMSE in 40 iterations β a 10 dB gap demonstrating the power of the Onsager correction.
ch17-ex02
Easy(State Evolution Verification)
(a) Implement the AMP state evolution recursion with numerical integration.
(b) Run AMP for and compare empirical MSE with SE.
(c) Repeat for . At what does the empirical MSE match SE to within 5%?
Evaluate the expectation by sampling and .
SE implementation
Sample draws of . For each , compute the denoiser output and average the squared error.
Convergence
For , SE matches to within 10%. For , the match is within 3%. SE is essentially exact for .
ch17-ex03
Easy(AMP Divergence on Structured Matrices)
(a) Generate three sensing matrices with , : (i) i.i.d. Gaussian, (ii) partial DCT, (iii) Kronecker with Gaussian factors.
(b) Run AMP with soft thresholding on each. Plot NMSE vs. iteration.
(c) Which matrices cause divergence?
(d) Compare the eigenvalue distributions of for each.
The Marchenko-Pastur distribution describes eigenvalues of i.i.d. Gaussian matrices.
Results
(i) Gaussian: converges to NMSE . (ii) Partial DCT: oscillates and diverges. (iii) Kronecker: diverges after 5 iterations. The eigenvalue spread of (ii) and (iii) far exceeds the Marchenko-Pastur prediction.
ch17-ex04
Easy(Basic OAMP Implementation)
(a) Implement OAMP with soft thresholding for , , i.i.d. Gaussian .
(b) Compare OAMP and AMP on this Gaussian matrix. Verify they achieve the same NMSE.
(c) Replace with a partial DCT matrix. Run both algorithms. Verify AMP diverges while OAMP converges.
(d) Report the SVD computation time for the matrix.
Compute the SVD once and reuse singular values in the LMMSE step.
Gaussian matrix
Both AMP and OAMP converge to NMSE (within numerical precision), confirming they are equivalent for i.i.d. Gaussian matrices.
Partial DCT
AMP diverges; OAMP converges to NMSE in 20 iterations. The SVD takes 10 ms for .
ch17-ex05
Easy(Verifying the Orthogonality Condition)
(a) Run OAMP on a partial DCT matrix with , . At each iteration, compute .
(b) Plot vs. iteration. Verify it stays near zero.
(c) Repeat for AMP (with and without Onsager) on the same matrix.
The orthogonality condition is the property that distinguishes OAMP from AMP for structured matrices.
Orthogonality verification
For OAMP, at all iterations. For AMP with Onsager on the DCT matrix, grows to (correlation, not decorrelation). For ISTA (no Onsager), β.
ch17-ex06
Medium(OAMP State Evolution)
(a) Implement the two-step OAMP state evolution: (from singular values) and .
(b) Run OAMP with BG-MMSE denoiser for , , , on a Kronecker partial-DFT matrix.
(c) Compare empirical MSE with SE prediction at each iteration.
(d) Plot the SE fixed-point NMSE vs. for .
The LMMSE MSE depends on the singular values via .
SE accuracy
SE tracks empirical NMSE within 0.5 dB for . The fixed-point NMSE decreases monotonically with (more measurements improve reconstruction).
ch17-ex07
Medium(BG-MMSE Denoiser Derivation and Implementation)
(a) Derive the Bayes-optimal denoiser for the Bernoulli-Gaussian prior .
(b) Implement the denoiser and verify on synthetic data.
(c) Compute the divergence analytically.
(d) Compare OAMP with BG-MMSE vs. soft thresholding at , , .
(e) Repeat with Bernoulli-Rademacher prior.
The posterior mean is a weighted average of 0 (inactive) and the Gaussian posterior mean (active).
Derivation
, where is the posterior activity probability.
Comparison
BG-MMSE outperforms soft thresholding by 3 dB at .
ch17-ex08
Medium(Kronecker LMMSE Speedup)
(a) Implement the naive OAMP LMMSE step (forming and inverting).
(b) Implement the Kronecker-factored LMMSE step.
(c) Verify both produce the same output (up to numerical precision).
(d) Benchmark both for . Plot wall-clock time vs. .
(e) At what does the Kronecker version become 100x faster?
Use the Kronecker SVD: .
Verification
The outputs agree to machine precision ( relative error).
Speedup
The 100x speedup is achieved at (). At the speedup exceeds .
ch17-ex09
Medium(Hutchinson Trace Estimator)
(a) Implement the Hutchinson estimator for the divergence of soft thresholding (where the true divergence is known).
(b) Plot estimation error vs. perturbation size for .
(c) For a black-box denoiser (use a small MLP), estimate the divergence with 1, 3, 5, 10 probe vectors. Plot the variance of the estimate vs. number of probes.
(d) Run OAMP with Hutchinson divergence estimation and compare with analytical divergence.
Use for optimal bias-variance tradeoff.
Optimal $h$
For , the optimal . For , numerical cancellation dominates.
Probe vectors
A single probe vector gives relative error for . For , use 3β5 probes.
ch17-ex10
Medium(Sparsity Mismatch Analysis)
(a) Generate a BG signal with . Run OAMP with BG-MMSE denoiser assuming .
(b) Plot converged NMSE vs. .
(c) Run mismatched state evolution and verify it predicts the empirical NMSE.
(d) Explain why underestimating is more harmful than overestimating.
The mismatched SE uses the true prior in the expectation but the assumed denoiser.
Asymmetry
Underestimating causes the denoiser to zero out true scatterers (false negatives), which is irreversible. Overestimating preserves noise components (false positives), which the LMMSE step partially corrects.
ch17-ex11
Medium(Complex-Valued OAMP)
(a) Extend the OAMP algorithm to complex-valued signals and measurements.
(b) Derive the complex BG-MMSE denoiser for .
(c) Implement and test on a complex Kronecker sensing matrix with , .
(d) Compare with the real-valued case (same dimensions and SNR).
For complex Gaussian noise, the LMMSE formula is the same as the real case with per complex dimension.
Complex denoiser
The complex BG-MMSE denoiser has the same structure as the real case but with and in place of and . The divergence uses the Wirtinger derivative.
Performance
Complex OAMP achieves comparable NMSE to the real case at the same effective SNR (per complex component).
ch17-ex12
Medium(Comparison of Denoisers in OAMP)
(a) Implement OAMP with three denoisers: soft thresholding, BG-MMSE, and a small DnCNN (3-layer CNN).
(b) Train the DnCNN on 1000 BG images at various noise levels.
(c) Run all three on the same Kronecker sensing problem with , , , .
(d) Plot NMSE vs. iteration for all three.
(e) Repeat with an extended-target scene (piecewise constant).
Train the DnCNN with noise levels to cover the range of values.
BG scene
BG-MMSE and DnCNN achieve similar NMSE (); soft thresholding is 3 dB worse.
Extended target
DnCNN outperforms BG-MMSE by 4 dB because the extended target violates the BG prior.
ch17-ex13
Hard(Damped AMP vs OAMP)
(a) Implement damped AMP with damping parameter on a Kronecker partial-DFT matrix with , .
(b) For each , find the converged NMSE (if it converges).
(c) Compare the best damped-AMP result with OAMP.
(d) Explain why damping cannot match OAMP's performance even when it stabilizes convergence.
Damping replaces .
Damped AMP results
Best damped AMP (): NMSE . OAMP: NMSE . Damping stabilizes but loses the Gaussian-channel equivalence β the denoiser receives biased input.
ch17-ex14
Hard(OAMP Phase Transition)
(a) For OAMP with BG-MMSE denoiser and Kronecker partial-DFT , compute the SE-predicted phase transition in the plane.
(b) Define success as NMSE after 50 SE iterations. Plot the boundary.
(c) Compare with the AMP phase transition for i.i.d. Gaussian at the same grid.
(d) How much does the Kronecker structure degrade the phase transition compared to i.i.d. Gaussian?
The OAMP phase transition depends on the singular value distribution of , not just .
Phase transition comparison
The Kronecker partial-DFT phase transition is shifted rightward by β compared to i.i.d. Gaussian. The degradation is due to the non-uniform singular value distribution: some directions are poorly measured.
ch17-ex15
Hard(Variance Mismatch Analysis)
(a) Generate a BG signal with . Run OAMP with BG-MMSE assuming .
(b) Plot NMSE vs. .
(c) Compare the sensitivity to variance mismatch with sparsity mismatch (Exercise 10).
(d) For a scene with unknown statistics, propose a strategy that is robust to both types of mismatch.
Variance mismatch affects the shrinkage factor in the BG-MMSE denoiser.
Sensitivity comparison
A 10x variance mismatch causes 6 dB degradation. A 3x sparsity mismatch causes 4 dB degradation. Variance mismatch is slightly more harmful.
Robust strategy
Use EM-OAMP to learn both and from the data, or use a learned denoiser that does not assume a parametric prior.
ch17-ex16
Hard(Near-Field Kronecker Approximation Error)
(a) For a near-field UPA geometry (, aperture ), compute the exact sensing matrix and its best Kronecker approximation .
(b) Compute the relative approximation error .
(c) Run OAMP with the exact SVD and with the Kronecker-approximate SVD. How much NMSE does the approximation cost?
(d) At what distance does the Kronecker approximation become acceptable (< 1 dB NMSE penalty)?
The Kronecker approximation is equivalent to the best rank-1 approximation of the matricized sensing operator.
Near-field error
At , the Kronecker approximation error is 8%, causing 2 dB NMSE degradation. At , the error drops to and the NMSE penalty is .
ch17-ex17
Hard(OAMP with Learned Denoiser)
(a) Train a noise-level-conditional DnCNN on 5000 BG scenes with at noise levels .
(b) Plug the trained DnCNN into OAMP using the Hutchinson divergence estimator.
(c) Compare with BG-MMSE OAMP on: (i) BG scenes, (ii) piecewise- constant scenes, (iii) smooth Gaussian-process scenes.
(d) Plot NMSE vs. iteration for all three scene types.
(e) Discuss when the learned denoiser helps and when BG-MMSE is sufficient.
Feed as a second input channel to the DnCNN.
Results
(i) BG: DnCNN BG-MMSE (). (ii) Piecewise constant: DnCNN , BG-MMSE . (iii) GP: DnCNN , BG-MMSE . The learned denoiser excels on non-BG scenes.
ch17-ex18
Challenge(Large-Scale Kronecker OAMP with GPU Acceleration)
(a) Implement Kronecker-factored OAMP on GPU (PyTorch or CuPy) for ().
(b) Benchmark against CPU implementation. Report speedup.
(c) Profile memory usage. What is the memory bottleneck?
(d) Run OAMP for 30 iterations at , , . Report wall-clock time and final NMSE.
(e) Push to (). Does it still fit in GPU memory?
Use batched matrix multiplication for the Kronecker LMMSE step.
GPU speedup
GPU provides 20x speedup over CPU for . For (), the singular value arrays and intermediate matrices require 4 GB; it fits on an A100 (40 GB) but not on consumer GPUs.
ch17-ex19
Challenge(EM-OAMP for Unknown Prior Parameters)
(a) Implement EM-OAMP: alternate OAMP iterations with M-step updates of and .
(b) Initialize with deliberately wrong parameters (, ) and track the parameter estimates across EM iterations.
(c) Does EM-OAMP converge to the true parameters?
(d) Compare the final NMSE with oracle OAMP (true parameters known) and mismatched OAMP (fixed wrong parameters).
(e) Test robustness: repeat with non-BG scenes. Does EM-OAMP still find useful parameters?
The M-step update for : where is the posterior activity probability.
EM convergence
EM-OAMP converges to within 5% of the true parameters in 5β8 outer iterations. Final NMSE is within 0.5 dB of the oracle. For non-BG scenes, EM finds an effective BG approximation that outperforms random guessing but underperforms a learned denoiser.
ch17-ex20
Challenge(Full RF Imaging Pipeline: From Measurements to Image)
(a) Set up a complete RF imaging scenario: 8-element ULA Tx, 8-element ULA Rx, 64 OFDM subcarriers, 2D scene with voxels.
(b) Construct the Kronecker-structured sensing matrix from the array geometry and subcarrier frequencies.
(c) Generate a realistic scene with 5 point scatterers and a reflecting wall. Compute noiseless and noisy measurements.
(d) Reconstruct using: (i) backpropagation, (ii) LASSO via FISTA, (iii) OAMP with BG-MMSE, (iv) OAMP with a simple trained denoiser.
(e) Compare all methods in NMSE, visual quality, and computation time. Which is best and why?
The sensing matrix factors are partial DFT matrices weighted by the array steering vectors.
Pipeline
Construct (frequency range) and (array angle). Apply OAMP with Kronecker factorization.
Results
Backpropagation: (severe sidelobes). FISTA: (slow, 500 iterations). OAMP BG-MMSE: (20 iterations). OAMP + denoiser: (best for the wall). OAMP methods are fastest after SVD preprocessing.