Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extension for ProximalCore/-Operators adapter #75

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
VectorizationBase = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f"
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"

[weakdeps]
ProximalCore = "dc4f5ac2-75d1-4f31-931e-60435d74994b"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Expand All @@ -30,6 +33,10 @@ VectorizationBase = "0.19, 0.21"
LinearOperatorCollection = "1.0"
LinearOperators = "2.3.3"
FFTW = "1.0"
ProximalCore = "0.1"

[targets]
test = ["Test", "Random", "FFTW"]

[extensions]
RegularizedLeastSquaresProximalCore = "ProximalCore"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module RegularizedLeastSquaresProximalCore

using RegularizedLeastSquares, ProximalCore

import RegularizedLeastSquares.prox!, RegularizedLeastSquares.ProximalCoreAdapter

struct ProximalCoreAdapterImpl{T, F} <: ProximalCoreAdapter{T, F}
λ::T
op::F
end

RegularizedLeastSquares.ProximalCoreAdapter(λ::T, op::F) where {T, F} = ProximalCoreAdapterImpl(λ, op)

Check warning on line 12 in ext/RegularizedLeastSquaresProximalCore/RegularizedLeastSquaresProximalCore.jl

View check run for this annotation

Codecov / codecov/patch

ext/RegularizedLeastSquaresProximalCore/RegularizedLeastSquaresProximalCore.jl#L12

Added line #L12 was not covered by tests

function prox!(reg::ProximalCoreAdapter, x::AbstractArray{Tc}, λ::T) where {T, Tc <: Union{T, Complex{T}}}
ProximalCore.prox!(x, reg.op, x, λ)
return x

Check warning on line 16 in ext/RegularizedLeastSquaresProximalCore/RegularizedLeastSquaresProximalCore.jl

View check run for this annotation

Codecov / codecov/patch

ext/RegularizedLeastSquaresProximalCore/RegularizedLeastSquaresProximalCore.jl#L14-L16

Added lines #L14 - L16 were not covered by tests
end

end
2 changes: 2 additions & 0 deletions src/Regularization/Regularization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ include("TransformedRegularization.jl")
include("MaskedRegularization.jl")
include("PlugAndPlayRegularization.jl")

export ProximalCoreAdapter
abstract type ProximalCoreAdapter{T, F} <: AbstractParameterizedRegularization{T} where F end

function findfirst(::Type{S}, reg::AbstractRegularization) where S <: AbstractRegularization
regs = collect(reg)
Expand Down
Loading