Commit fe8b6724 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: Reset m_entries and skip no-op virtual move

parent 536b3c3b
......@@ -1344,7 +1344,10 @@ public:
assert(size_t(_b[v]) == r || r == null_group);
if (r == nr)
{
m_entries.set_move(r, nr, num_vertices(_bg));
return 0;
}
if (r != null_group && nr != null_group && !allow_move(r, nr))
return std::numeric_limits<double>::infinity();
......
......@@ -115,6 +115,9 @@ struct MCMC
virtual_move_dS(size_t v, size_t nr)
{
size_t r = _state._b[v];
if (r == nr)
return {0., 0.};
double dS = _state.virtual_move(v, r, nr, _entropy_args,
_m_entries);
double a = 0;
......@@ -126,7 +129,7 @@ struct MCMC
_m_entries);
a = log(pb) - log(pf);
}
return std::make_tuple(dS, a);
return {dS, a};
}
void perform_move(size_t v, size_t nr)
......
......@@ -468,7 +468,11 @@ struct Layers
MEntries& m_entries)
{
if (s == r)
{
m_entries.set_move(r, s, num_vertices(BaseState::_bg));
return 0;
}
// assert(check_layers());
double dS = 0;
......
......@@ -597,7 +597,10 @@ public:
MEntries& m_entries)
{
if (r == nr)
{
m_entries.set_move(r, nr, num_vertices(_bg));
return 0;
}
if (!allow_move(r, nr))
return std::numeric_limits<double>::infinity();
......
Supports Markdown
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