Skip to content

Commit

Permalink
Use to∞ for TransformVariables
Browse files Browse the repository at this point in the history
  • Loading branch information
briochemc committed Nov 12, 2020
1 parent 07af753 commit a7551ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "AIBECS"
uuid = "ace601d6-714c-11e9-04e5-89b7fad23838"
authors = ["Benoit Pasquier <briochemc@gmail.com>"]
version = "0.7.13"
version = "0.7.14"

[deps]
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
Expand Down
5 changes: 2 additions & 3 deletions src/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,9 @@ subfun(::Type{T}, s::Symbol) where {T<:AbstractParameters} = subfun(prior(T,s))
∇²subfun(::Type{T}, s::Symbol) where {T<:AbstractParameters} = ∇²subfun(prior(T,s))
invsubfun(::Type{T}, s::Symbol) where {T<:AbstractParameters} = invsubfun(prior(T,s))
# using TransformVariables
lb_domain(d::ContinuousUnivariateDistribution) = (lb = support(d).lb; lb == -Inf ? TransformVariables.Infinity{false}() : lb)
ub_domain(d::ContinuousUnivariateDistribution) = (ub = support(d).ub; ub == Inf ? TransformVariables.Infinity{true}() : ub)
import TransformVariables: transform
transform(d::ContinuousUnivariateDistribution) = as(Real, lb_domain(d), ub_domain(d))
to∞(x) = isinf(x) ? TransformVariables.Infinity{x>0}() : x # convert Inf to ∞
transform(d::ContinuousUnivariateDistribution) = as(Real, to∞(minimum(d)), to∞(maximum(d)))
subfun(d::ContinuousUnivariateDistribution) = x -> transform(d)(x)
∇subfun(d::ContinuousUnivariateDistribution) = x -> ForwardDiff.derivative(subfun(d), x)
∇²subfun(d::ContinuousUnivariateDistribution) = x -> ForwardDiff.derivative(∇subfun(d), x)
Expand Down

2 comments on commit a7551ac

@briochemc
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 created: JuliaRegistries/General/24514

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.7.14 -m "<description of version>" a7551acbd72a0f7d2470f182b63be6795b5b5347
git push origin v0.7.14

Please sign in to comment.