Skip to content

Commit

Permalink
Add NoPenalty(::SimpleChain) method
Browse files Browse the repository at this point in the history
  • Loading branch information
chriselrod committed Sep 24, 2021
1 parent 9dee30d commit 6805eaa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/penalty.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ getchain(p::NoPenalty) = getfield(p,:chn)
NoPenalty() = NoPenalty(nothing)
apply_penalty(::NoPenalty) = Static.Zero()
apply_penalty!(_, ::NoPenalty, __) = Static.Zero()
(::NoPenalty)(chn::SimpleChain) = NoPenalty(chn)

struct L1Penalty{NN,T} <: AbstractPenalty{NN}
chn::NN
Expand All @@ -37,7 +38,6 @@ getchain(p::L1Penalty) = getfield(p,:chn)
L1Penalty::Number) = L1Penalty(nothing, λ)
L1Penalty(p::AbstractPenalty, λ) = L1Penalty(getchain(p), λ)
(p::L1Penalty)(chn::SimpleChain) = L1Penalty(chn, p.λ)
(p::L1Penalty)() = L1Penalty(chn, p.λ)

@inline function apply_penalty::L1Penalty{NN,T2}, p::AbstractVector{T3}) where {T2,T3,NN}
l = zero(T3)
Expand Down

2 comments on commit 6805eaa

@chriselrod
Copy link
Contributor 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/45448

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.1 -m "<description of version>" 6805eaae7ea568b5e87e4e4661783de3b0127500
git push origin v0.1.1

Please sign in to comment.