Skip to content

Commit

Permalink
no mormalise
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeRZP committed Feb 21, 2024
1 parent 19b4810 commit d6f0644
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/sampler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ function Random_unit_vector(rng::AbstractRNG, x::AbstractVector{T}; _normalize =
u = similar(x)
randn!(rng, u)
if _normalize
u_norm = sqrt.(sum(u.^2))
u ./= u_norm
u ./= norm(u)
end
return u
end
Expand All @@ -75,7 +74,7 @@ function Partially_refresh_momentum(rng::AbstractRNG, nu::T, u::AbstractVector{T
d = length(u)
z = nu .* Random_unit_vector(rng, u; _normalize = false)
uu = u .+ z
return normalize(uu)
return uu ./ norm(uu)
end

function Update_momentum(d::Int, eff_eps::T, g::AbstractVector{T}, u::AbstractVector{T}) where {T}
Expand All @@ -89,7 +88,7 @@ function Update_momentum(d::Int, eff_eps::T, g::AbstractVector{T}, u::AbstractVe
zeta = exp(-delta)
uu = e .* ((1 - zeta) * (1 + zeta + ue * (1 - zeta))) + (2 * zeta) .* u
delta_r = delta - log(2) + log(1 + ue + (1 - ue) * zeta^2)
return normalize(uu), delta_r
return uu ./ norm(uu), delta_r
end

struct MCHMCState{T}
Expand Down

0 comments on commit d6f0644

Please sign in to comment.