Commit 4822ba5b authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: fix clabel enforcement in mcmc/multiflip_mcmc

parent 3ca7df5f
......@@ -86,7 +86,7 @@ typedef mpl::vector1<std::false_type> rmap_tr;
((mrm,, vmap_t, 0)) \
((wr,, vmap_t, 0)) \
((b,, vmap_t, 0)) \
((empty_blocks, & ,std::vector<size_t>&, 0)) \
((empty_blocks, &, std::vector<size_t>&, 0)) \
((empty_pos,, vmap_t, 0)) \
((candidate_blocks, &, std::vector<size_t>&, 0)) \
((candidate_pos,, vmap_t, 0)) \
......@@ -1736,12 +1736,8 @@ public:
}
else
{
do
{
s = uniform_sample(_candidate_blocks.begin() + 1,
_candidate_blocks.end(), rng);
}
while(_bclabel[s] != _bclabel[r]);
s = uniform_sample(_candidate_blocks.begin() + 1,
_candidate_blocks.end(), rng);
}
_b[v] = s;
}
......
......@@ -182,11 +182,16 @@ struct MCMC
auto t = uniform_sample(_state._empty_blocks, rng);
auto r = _state._b[v];
_state._bclabel[t] = _state._bclabel[r];
if (_state._coupled_state != nullptr)
{
if constexpr (sample_branch)
{
_state._coupled_state->sample_branch(t, r, rng);
do
{
_state._coupled_state->sample_branch(t, r, rng);
}
while(!_state.allow_move(r, t));
}
else
{
......@@ -196,7 +201,6 @@ struct MCMC
auto& hpclabel = _state._coupled_state->get_pclabel();
hpclabel[t] = _state._pclabel[v];
}
_state._bclabel[t] = _state._bclabel[r];
if (t >= _groups.size())
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment