@@ -14,7 +14,6 @@ function paramnames(::AbstractTransformedMeasure) end
1414
1515function parent (:: AbstractTransformedMeasure ) end
1616
17-
1817export PushforwardMeasure
1918
2019"""
3534gettransform (ν:: PushforwardMeasure ) = ν. f
3635parent (ν:: PushforwardMeasure ) = ν. origin
3736
38-
3937function Pretty. tile (ν:: PushforwardMeasure )
4038 Pretty. list_layout (Pretty. tile .([ν. f, ν. inv_f, ν. origin]); prefix = :PushforwardMeasure )
4139end
4240
43-
44- @inline function logdensity_def (ν:: PushforwardMeasure{FF,IF,M,<:WithVolCorr} , y) where {FF,IF,M}
41+ @inline function logdensity_def (
42+ ν:: PushforwardMeasure{FF,IF,M,<:WithVolCorr} ,
43+ y,
44+ ) where {FF,IF,M}
4545 x_orig, inv_ladj = with_logabsdet_jacobian (ν. inv_f, y)
4646 logd_orig = logdensity_def (ν. origin, x_orig)
4747 logd = float (logd_orig + inv_ladj)
5353 # Return constant -Inf to prevent problems with ForwardDiff:
5454 (isfinite (logd_orig) && (inv_ladj == - Inf )),
5555 neginf,
56- logd
56+ logd,
5757 )
5858end
5959
60- @inline function logdensity_def (ν:: PushforwardMeasure{FF,IF,M,<:NoVolCorr} , y) where {FF,IF,M}
60+ @inline function logdensity_def (
61+ ν:: PushforwardMeasure{FF,IF,M,<:NoVolCorr} ,
62+ y,
63+ ) where {FF,IF,M}
6164 x_orig = to_origin (ν, y)
6265 return logdensity_def (ν. origin, x_orig)
6366end
6467
65-
6668insupport (ν:: PushforwardMeasure , y) = insupport (transport_origin (ν), to_origin (ν, y))
6769
6870testvalue (ν:: PushforwardMeasure ) = from_origin (ν, testvalue (transport_origin (ν)))
@@ -71,30 +73,27 @@ testvalue(ν::PushforwardMeasure) = from_origin(ν, testvalue(transport_origin(
7173 PushforwardMeasure (ν. f, ν. inv_f, basemeasure (transport_origin (ν)), NoVolCorr ())
7274end
7375
74-
75- _pushfwd_dof (:: Type{MU} , :: Type , dof) where MU = NoDOF {MU} ()
76- _pushfwd_dof (:: Type{MU} , :: Type{<:Tuple{Any,Real}} , dof) where MU = dof
76+ _pushfwd_dof (:: Type{MU} , :: Type , dof) where {MU} = NoDOF {MU} ()
77+ _pushfwd_dof (:: Type{MU} , :: Type{<:Tuple{Any,Real}} , dof) where {MU} = dof
7778
7879# Assume that DOF are preserved if with_logabsdet_jacobian is functional:
7980@inline function getdof (ν:: MU ) where {MU<: PushforwardMeasure }
8081 T = Core. Compiler. return_type (testvalue, Tuple{typeof (ν. origin)})
81- R = Core. Compiler. return_type (with_logabsdet_jacobian, Tuple{typeof (ν. f), T})
82+ R = Core. Compiler. return_type (with_logabsdet_jacobian, Tuple{typeof (ν. f),T})
8283 _pushfwd_dof (MU, R, getdof (ν. origin))
8384end
8485
8586# Bypass `checked_arg`, would require potentially costly transformation:
8687@inline checked_arg (:: PushforwardMeasure , x) = x
8788
88-
8989@inline transport_origin (ν:: PushforwardMeasure ) = ν. origin
9090@inline from_origin (ν:: PushforwardMeasure , x) = ν. f (x)
9191@inline to_origin (ν:: PushforwardMeasure , y) = ν. inv_f (y)
9292
93- function Base. rand (rng:: AbstractRNG , :: Type{T} , ν:: PushforwardMeasure ) where T
93+ function Base. rand (rng:: AbstractRNG , :: Type{T} , ν:: PushforwardMeasure ) where {T}
9494 return from_origin (ν, rand (rng, T, transport_origin (ν)))
9595end
9696
97-
9897export pushfwd
9998
10099"""
0 commit comments