Skip to content

Commit

Permalink
add missing gradient
Browse files Browse the repository at this point in the history
  • Loading branch information
lostella committed Feb 9, 2022
1 parent c810931 commit 986c3d7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ProximalCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ end

struct Zero end

(f::Zero)(x) = real(eltype(x))(0)
(::Zero)(x) = real(eltype(x))(0)

function gradient!(y, f::Zero, x)
y .= eltype(x)(0)
return f(x)
end

function prox!(y, ::Zero, x, gamma)
y .= x
Expand All @@ -92,7 +97,7 @@ is_generalized_quadratic(::Type{Zero}) = true

struct IndZero end

function (f::IndZero)(x)
function (::IndZero)(x)
R = real(eltype(x))
if iszero(x)
return R(Inf)
Expand Down

2 comments on commit 986c3d7

@lostella
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/54031

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.0 -m "<description of version>" 986c3d79b1cc79fc8feb8662c6974dbe616974fa
git push origin v0.1.0

Please sign in to comment.