Skip to content

Commit

Permalink
update setparams!!
Browse files Browse the repository at this point in the history
  • Loading branch information
sunxd3 committed Oct 22, 2024
1 parent 933efe5 commit 4b0be7f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion research/tests/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ include("../src/riemannian_hmc.jl")
include("relativistic_hmc.jl")
include("riemannian_hmc.jl")

@main function runtests(patterns...; dry::Bool = false)
Comonicon.@main function runtests(patterns...; dry::Bool = false)
retest(patterns...; dry = dry, verbose = Inf)
end
8 changes: 6 additions & 2 deletions src/abstractmcmc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,12 @@ function AbstractMCMC.getparams(state::HMCState)
return state.transition.z.θ
end

function AbstractMCMC.setparams!!(state::HMCState, θ)
return @set state.transition.z.θ = θ
function AbstractMCMC.setparams!!(state::HMCState, params)
hamiltonian = AdvancedHMC.Hamiltonian(state.metric, model)
return Setfield.@set state.transition.z = AdvancedHMC.phasepoint(
hamiltonian, params, state.transition.z.r;
ℓκ=state.transition.z.ℓκ
)
end

"""
Expand Down

0 comments on commit 4b0be7f

Please sign in to comment.