Skip to content

Commit

Permalink
fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tinatorabi committed Jun 17, 2024
1 parent 421e2f7 commit 5b110db
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ version = "0.1.0-dev"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
Expand All @@ -22,6 +21,7 @@ Printf = "1.9, 1.10"
QRupdate = "1.0"
Random = "1.9, 1.10"
SparseArrays = "1.9, 1.10"
Logging = "1.11"
julia = "1.9, 1.10"

[extras]
Expand Down
28 changes: 21 additions & 7 deletions src/bpdn.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
function asp_bpdn(A, b, lambda; kwargs...)

"""
asp_bpdn(A,B) solves the basis pursuit problem.

(BP) minimize_x ||x||_1 subject to Ax = B.

AS_BPDN(A,B,LAM) solves the basis pursuit denoise problem
@doc raw"""
```julia
asp_bpdn(A,B)```
solves the basis pursuit problem.
(BPDN) minimize_x 1/2 ||Ax - B||_2^2 + LAM ||x||_1.
(BP)
```math
\min_x \|x \|_1
```
subject to
```math
Ax = B.
```
```julia
asp_bpdn(A,B,λ)
```
solves the basis pursuit denoise problem
(BPDN)
```math
\min_x \frac{1}{2} \|Ax - B\|_2^2 + λ \|x\|_1
```
"""
function asp_bpdn(A, b, lambda; kwargs...)
n = size(A, 2)
bl = -ones(n)
bu = +ones(n)
Expand Down
29 changes: 19 additions & 10 deletions src/omp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,25 @@ end

Base.lastindex(t::OMPTracer) = lastindex(t.active)

@doc raw"""
```julia
asp_omp(A,B)```
Orthogonal matching pursuit for sparse
```math
Ax=b
```
Applies the orthogonal matching pursuit (OMP) algorithm to
estimate a sparse solution of the underdetermined system `Ax=b`.
(BP)
```math
\min_x \|x\|_1
```
subject to
```math
Ax = b.
```
"""
function asp_omp(
A::Union{AbstractMatrix, AbstractLinearOperator},
b::Vector,
Expand All @@ -33,16 +52,6 @@ function asp_omp(
pivTol::Real = 1e-12,
actMax::Real = Inf)

"""
Orthogonal matching pursuit for sparse Ax=b
asp_omp applies the orthogonal matching pursuit (OMP) algorithm to
estimate a sparse solution of the underdetermined system Ax=b.
(BP) minimize_x ||x||_1 subject to Ax = b.
asp_omp(A, b, λ) solves the basis pursuit problem.
"""
# Start the clock and size up the problem.
time0 = time()

Expand Down

0 comments on commit 5b110db

Please sign in to comment.