Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getparams and setparams!! following AbstractMCMC v5.5 and v5.6 #378

Merged
merged 18 commits into from
Oct 31, 2024
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)
sunxd3 marked this conversation as resolved.
Show resolved Hide resolved
return Setfield.@set state.transition.z = AdvancedHMC.phasepoint(
hamiltonian, params, state.transition.z.r;
ℓκ=state.transition.z.ℓκ
)
end

"""
Expand Down
Loading