Skip to content

Commit 5e06e4e

Browse files
committed
fix type instability
1 parent c6151fa commit 5e06e4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/multivariate/stereographic.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ function AbstractMCMC.step(
7979
ℓp_sphere = logdensity_sphere(ℓp, x)
8080
ℓw = ℓp_sphere - Random.randexp(rng, eltype(x))
8181

82-
θ = rand(rng, Uniform(0, 2π))
82+
θ = convert(eltype(x), 2π)*rand(rng)
8383
θ_max = θ
84-
θ_min = θ - 2π
84+
θ_min = θ - convert(eltype(x), 2π)
8585

8686
props = 0
8787
while true
@@ -107,7 +107,7 @@ function AbstractMCMC.step(
107107
θ_max = θ
108108
end
109109

110-
θ = rand(rng, Uniform(θ_min, θ_max))
110+
θ = (θ_max - θ_min)*rand(rng)
111111
end
112112
t = Transition(x, ℓp, (num_proposals=props,))
113113
return t, t

0 commit comments

Comments
 (0)