Last active
February 17, 2021 14:03
-
-
Save loiseaujc/acd2d4d8d7a0f03ce6613a3be85824b1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using StructuredOptimization | |
""" | |
Simple implementation of basis pursuit denoising using StructuredOptimization.jl | |
INPUT | |
----- | |
C : The measurement matrix. | |
Ψ : Basis in which x is assumed to be sparse. | |
y : Pixel measurements. | |
λ : (Optional) Sparsity knob. | |
OUTPUT | |
------ | |
x : Estimated image. | |
""" | |
function bpdn(C, Ψ, y ; λ=0.1) | |
# --> Initialize variable. | |
x = Variable(eltype(y), size(Ψ, 2)) | |
# --> Solve the compressed sensing problem. | |
@minimize ls(C * Ψ * x - y) + λ*norm(x, 1) | |
return ~x | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment