Skip to content

Commit

Permalink
modifs to be compatible with RegularizedOptimization.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanemac committed Dec 19, 2024
1 parent c15b02d commit 0f7c083
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/libproxtv.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function PN_LPp(y, lambda, x, info, n, p, ws, positive, ctx, callback)
)::Int32
end


# overloaded PN_LPp function with less inputs
function PN_LPp(y, lambda, x, p, objGap)
n = length(y) # works for nD signals
Expand Down
18 changes: 15 additions & 3 deletions src/proxtv_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ mutable struct AlgorithmContextCallback
shift::AbstractVector{Float64}
s_k_unshifted::Vector{Float64}
dualGap::Float64
prox_stats # for total number of iterations in ir2n, ir2 and prox.
end
function AlgorithmContextCallback(;hk=0.0, mk = x -> x, κξ = 0.0, shift = zeros(0), s_k_unshifted = zeros(0), dualGap = 0.0)
AlgorithmContextCallback(hk, mk, κξ, shift, s_k_unshifted, dualGap)
function AlgorithmContextCallback(;hk=0.0, mk = x -> x, κξ = 0.0, shift = zeros(0), s_k_unshifted = zeros(0), dualGap = 0.0, prox_stats = [0.0, [], []])
AlgorithmContextCallback(hk, mk, κξ, shift, s_k_unshifted, dualGap, prox_stats)
end


Expand Down Expand Up @@ -79,6 +80,9 @@ function prox!(

freeWorkspace(ws)

# add the number of iterations in prox to the context object
push!(context.prox_stats[3], info[1])

return y
end

Expand Down Expand Up @@ -222,6 +226,9 @@ function prox!(

freeWorkspace(ws)

# add the number of iterations in prox to the context object
push!(context.prox_stats[3], info[1])

return y
end

Expand Down Expand Up @@ -302,6 +309,9 @@ function prox!(

freeWorkspace(ws)

# add the number of iterations in prox to the context object
push!(context.prox_stats[3], info[1])

return y
end

Expand Down Expand Up @@ -431,6 +441,9 @@ function prox!(y::AbstractArray, ψ::ShiftedNormTVp, q::AbstractArray, ν::Real,

freeWorkspace(ws)

# add the number of iterations in prox to the context object
push!(context.prox_stats[3], info[1])

return y
end

Expand Down Expand Up @@ -483,7 +496,6 @@ function prox!(y, ψ::Union{InexactShiftedProximableFunction, ShiftedProximableF
return prox!(y, ψ, q, ν)
elseif ψ isa InexactShiftedProximableFunction
# Call to inexact prox!()
println("Inexact prox!() called")
return prox!(y, ψ, q, ν, ctx_ptr, callback)

else
Expand Down

0 comments on commit 0f7c083

Please sign in to comment.