@@ -28,8 +28,9 @@ struct GibbsPolarSlice{W<:Real} <: AbstractMultivariateSliceSampling
2828 max_proposals:: Int
2929end
3030
31- GibbsPolarSlice (w:: Real ; max_proposals:: Int = DEFAULT_MAX_PROPOSALS) =
32- GibbsPolarSlice (w, max_proposals)
31+ function GibbsPolarSlice (w:: Real ; max_proposals:: Int = DEFAULT_MAX_PROPOSALS)
32+ return GibbsPolarSlice (w, max_proposals)
33+ end
3334
3435struct GibbsPolarSliceState{T<: Transition ,R<: Real ,D<: AbstractVector }
3536 " Current [`Transition`](@ref)."
4849
4950function logdensity (target:: GibbsPolarSliceTarget , x)
5051 d = length (x)
51- (d - 1 ) * log (norm (x)) + LogDensityProblems. logdensity (target. model, x)
52+ return (d - 1 ) * log (norm (x)) + LogDensityProblems. logdensity (target. model, x)
5253end
5354
5455function AbstractMCMC. step (
5556 rng:: Random.AbstractRNG ,
5657 model:: AbstractMCMC.LogDensityModel ,
5758 sampler:: GibbsPolarSlice ;
58- initial_params = nothing ,
59+ initial_params= nothing ,
5960 kwargs... ,
6061)
6162 logdensitymodel = model. logdensity
@@ -76,7 +77,7 @@ function rand_subsphere(rng::Random.AbstractRNG, θ::AbstractVector)
7677 d = length (θ)
7778 V1 = randn (rng, eltype (θ), d)
7879 V2 = V1 - dot (θ, V1) * θ
79- V2 / max (norm (V2), eps (eltype (θ)))
80+ return V2 / max (norm (V2), eps (eltype (θ)))
8081end
8182
8283function geodesic_shrinkage (
@@ -91,7 +92,7 @@ function geodesic_shrinkage(
9192 ω_max = convert (F, 2 π) * rand (rng, F)
9293 ω_min = ω_max - convert (F, 2 π)
9394
94- for n_props = 1 : max_prop
95+ for n_props in 1 : max_prop
9596 # `Uniform` had a type instability issue:
9697 # https://github.com/JuliaStats/Distributions.jl/pull/1860
9798 # ω = rand(rng, Uniform(ω_min, ω_max))
@@ -108,7 +109,7 @@ function geodesic_shrinkage(
108109 ω_max = ω
109110 end
110111 end
111- exceeded_max_prop (max_prop)
112+ return exceeded_max_prop (max_prop)
112113end
113114
114115function radius_shrinkage (
@@ -148,7 +149,7 @@ function radius_shrinkage(
148149 end
149150 n_props_total += n_props
150151
151- for n_props = 1 : max_prop
152+ for n_props in 1 : max_prop
152153 # `Uniform` had a type instability issue:
153154 # https://github.com/JuliaStats/Distributions.jl/pull/1860
154155 # r′ = rand(rng, Uniform{F}(r_min, r_max))
@@ -165,7 +166,7 @@ function radius_shrinkage(
165166 r_max = r′
166167 end
167168 end
168- exceeded_max_prop (max_prop)
169+ return exceeded_max_prop (max_prop)
169170end
170171
171172function AbstractMCMC. step (
@@ -194,9 +195,7 @@ function AbstractMCMC.step(
194195
195196 ℓp = LogDensityProblems. logdensity (logdensitymodel, x)
196197 t = Transition (
197- x,
198- ℓp,
199- (num_radius_proposals = n_props_r, num_direction_proposals = n_props_θ),
198+ x, ℓp, (num_radius_proposals= n_props_r, num_direction_proposals= n_props_θ)
200199 )
201- t, GibbsPolarSliceState (t, θ, r)
200+ return t, GibbsPolarSliceState (t, θ, r)
202201end
0 commit comments