@@ -19,11 +19,11 @@ function AbstractMCMC.setparams!!(
1919end
2020
2121function rand_uniform_sphere_orthogonal_subspace (
22- rng:: Random.AbstractRNG , subspace_vector:: AbstractVector
23- )
22+ rng:: Random.AbstractRNG , subspace_vector:: AbstractVector{T}
23+ ) where {T <: Real }
2424 z = subspace_vector
2525 d = length (subspace_vector)
26- v = randn (rng, d)
26+ v = randn (rng, T, d)
2727 v_proj = dot (z, v) / sum (abs2, z) * z
2828 v_orth = v - v_proj
2929 return v_orth / norm (v_orth)
@@ -34,9 +34,9 @@ function stereographic_projection(z::AbstractVector)
3434 return z[1 : d] ./ (1 - z[d + 1 ])
3535end
3636
37- function stereographic_inverse_projection (x:: AbstractVector )
37+ function stereographic_inverse_projection (x:: AbstractVector{T} ) where {T <: Real }
3838 d = length (x)
39- z = zeros (d + 1 )
39+ z = zeros (T, d + 1 )
4040 x_norm2 = sum (abs2, x)
4141 z[1 : d] = 2 * x / (x_norm2 + 1 )
4242 z[d + 1 ] = (x_norm2 - 1 ) / (x_norm2 + 1 )
@@ -79,7 +79,7 @@ function AbstractMCMC.step(
7979 ℓp_sphere = logdensity_sphere (ℓp, x)
8080 ℓw = ℓp_sphere - Random. randexp (rng, eltype (x))
8181
82- θ = convert (eltype (x), 2 π)* rand (rng)
82+ θ = convert (eltype (x), 2 π) * rand (rng)
8383 θ_max = θ
8484 θ_min = θ - convert (eltype (x), 2 π)
8585
@@ -107,7 +107,7 @@ function AbstractMCMC.step(
107107 θ_max = θ
108108 end
109109
110- θ = (θ_max - θ_min)* rand (rng)
110+ θ = (θ_max - θ_min) * rand (rng)
111111 end
112112 t = Transition (x, ℓp, (num_proposals= props,))
113113 return t, t
0 commit comments