Skip to content

Commit c699951

Browse files
fixed default sparsity value of omp
1 parent 6287e96 commit c699951

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "CompressedSensing"
22
uuid = "adc28fdd-7b77-41a2-89a7-a1a193b336a0"
33
authors = ["Sebastian Ament <[email protected]>"]
4-
version = "1.0.0"
4+
version = "1.0.1"
55

66
[deps]
77
Clp = "e2554f3b-3117-50c0-817c-e040a3ddf72d"

src/basispursuit.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ end
4545
const bp_candes = candes_reweighting
4646

4747
# using LinearAlgebraExtensions: LowRank
48-
# TODO: stop when w has converged, instead of maxiter
48+
# IDEA: stop when w has converged, instead of maxiter
4949
function ard_weights!(w, A, x, ε::Real, iter::Int = 8)
5050
if any(==(0), w)
5151
error("weights cannot be zero")
5252
end
53-
# nzind = x.nzind # this could speed up the weight computation
53+
# nzind = x.nzind # this could speed up the weight computation, could also drop zeros from model before reweighting ...
5454
# Ai = @view A[:, nzind]
5555
# wx = @. abs(x.nzval) / w[nzind]
5656
# K = Woodbury(ε*I(size(A, 1)), Ai, WX, Ai')
@@ -66,6 +66,7 @@ end
6666

6767
ard_function(A::AbstractMatrix, ε::Real) = (w, x) -> ard_weights!(w, A, x, ε)
6868

69+
# IDEA: generalize for general objectives via Jacobian (linearization)
6970
function ard_reweighting(A::AbstractMatrix, b::AbstractVector, ε::Real = 1e-2;
7071
maxiter::Int = 8)
7172
basispursuit_reweighting(A, b, ard_function(A, ε), maxiter = maxiter)
@@ -137,7 +138,7 @@ end
137138

138139
################################ (F)ISTA ########################################
139140
struct FISTA end
140-
# TODO: use homotopy to select appropriate λ
141+
# IDEA: use homotopy to select appropriate λ
141142

142143
# shrinkage and thresholding operator
143144
shrinkage(x::Real, α::Real) = sign(x) * max(abs(x)-α, zero(x))

src/matchingpursuit.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function omp(A::AbstractMatOrFac, b::AbstractVector, k::Int)
8686
end
8787

8888
function omp(A::AbstractMatOrFac, b::AbstractVector;
89-
max_residual = eps(eltype(A)), sparsity = size(A, 2))
89+
max_residual = eps(eltype(A)), sparsity = min(size(A)...))
9090
omp(A, b, max_residual, sparsity)
9191
end
9292

0 commit comments

Comments
 (0)