Skip to content

Commit 1b38ca6

Browse files
Tor FjeldeTor Fjelde
authored andcommitted
formatted according to blue
1 parent 5815a9b commit 1b38ca6

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/RobustAdaptiveMetropolis.jl

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,11 @@ struct RobustAdaptiveMetropolisState{T1,L,A,T2,T3}
114114
end
115115

116116
AbstractMCMC.getparams(state::RobustAdaptiveMetropolisState) = state.x
117-
AbstractMCMC.setparams!!(state::RobustAdaptiveMetropolisState, x) =
118-
RobustAdaptiveMetropolisState(
119-
x,
120-
state.logprob,
121-
state.S,
122-
state.logα,
123-
state.η,
124-
state.iteration,
125-
state.isaccept,
117+
function AbstractMCMC.setparams!!(state::RobustAdaptiveMetropolisState, x)
118+
return RobustAdaptiveMetropolisState(
119+
x, state.logprob, state.S, state.logα, state.η, state.iteration, state.isaccept
126120
)
121+
end
127122

128123
function ram_step_inner(
129124
rng::Random.AbstractRNG,
@@ -181,7 +176,7 @@ function AbstractMCMC.step(
181176
rng::Random.AbstractRNG,
182177
model::AbstractMCMC.LogDensityModel,
183178
sampler::RobustAdaptiveMetropolis;
184-
initial_params = nothing,
179+
initial_params=nothing,
185180
kwargs...,
186181
)
187182
# This is the initial state.
@@ -262,9 +257,7 @@ function AbstractMCMC.step_warmup(
262257
S_new, η = ram_adapt(sampler, state, logα, U)
263258
# Check that `S_new` has eigenvalues in the desired range.
264259
if !valid_eigenvalues(
265-
S_new,
266-
sampler.eigenvalue_lower_bound,
267-
sampler.eigenvalue_upper_bound,
260+
S_new, sampler.eigenvalue_lower_bound, sampler.eigenvalue_upper_bound
268261
)
269262
# In this case, we just keep the old `S` (p. 13 in Vihola, 2012).
270263
S_new = state.S

0 commit comments

Comments
 (0)