Skip to content

Commit 5866269

Browse files
authored
Merge pull request #56 from bthorne93/hmc_step_gradients
Add gradient optional arg to hmc_step
2 parents b1444c4 + 7f03831 commit 5866269

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/sampling.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,12 @@ end
386386
@pack! state = ϕ°, ΔH, accept
387387
end
388388

389-
function hmc_step(U::Function, x, Λ; symp_kwargs, progress, always_accept)
389+
function hmc_step(U::Function, x, Λ, δUδx=x->gradient(U, x)[1]; symp_kwargs, progress, always_accept)
390390
local ΔH, accept
391391
for kwargs in symp_kwargs
392392
p = simulate(Λ)
393393
(ΔH, xtest) = symplectic_integrate(
394-
x, p, Λ, U;
394+
x, p, Λ, U, δUδx;
395395
progress = (progress==:verbose),
396396
kwargs...
397397
)

0 commit comments

Comments
 (0)