Skip to content

Commit

Permalink
Add ChangesOfVariables support
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjradcliffe committed May 4, 2024
1 parent a7f9cdd commit 223327d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions ext/LogExpFunctionsChangesOfVariablesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,24 @@ function ChangesOfVariables.with_logabsdet_jacobian(::typeof(logcosh), x::Real)
return y, log1mexp(a) - z
end

function ChangesOfVariables.with_logabsdet_jacobian(::typeof(loglogistic), x::Real)
y = loglogistic(x)
return y, y - x
end

function ChangesOfVariables.with_logabsdet_jacobian(::typeof(log1mlogistic), x::Real)
y = log1mlogistic(x)
return y, x + y
end

function ChangesOfVariables.with_logabsdet_jacobian(::typeof(logitexp), x::Real)
y = logitexp(x)
return y, y - x
end

function ChangesOfVariables.with_logabsdet_jacobian(::typeof(logit1mexp), x::Real)
y = logit1mexp(x)
return y, -y - x
end

end # module

0 comments on commit 223327d

Please sign in to comment.