Skip to content

Commit

Permalink
Modify test of neg_energy to avoid error from rounding differences
Browse files Browse the repository at this point in the history
between dot and sum(abs2, ...) on 32 bit.
  • Loading branch information
andreasnoack committed Nov 1, 2019
1 parent 734ed26 commit cfcd519
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/hamiltonian.jl
Expand Up @@ -27,7 +27,7 @@ end
r_init = randn(D)

h = Hamiltonian(UnitEuclideanMetric(D), ℓπ, ∂ℓπ∂θ)
@test -AdvancedHMC.neg_energy(h, r_init, θ_init) == dot(r_init, r_init) / 2
@test -AdvancedHMC.neg_energy(h, r_init, θ_init) == sum(abs2, r_init) / 2
@test AdvancedHMC.∂H∂r(h, r_init) == r_init

M⁻¹ = ones(D) + abs.(randn(D))
Expand Down

0 comments on commit cfcd519

Please sign in to comment.