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

Latent layers: fix entropy difference computation

parent 1f80b1fb
......@@ -265,24 +265,32 @@ struct MCMC
else
{
dS = _state.remove_edge_dS(l, u, v, _entropy_args);
size_t j = 0;
for (int i = 0; i < -dm-1; ++i)
{
if (std::isinf(dS))
break;
_state.remove_edge(l, u, v);
dS += _state.remove_edge_dS(l, u, v, _entropy_args);
j++;
}
for (int i = 0; i < -dm-1; ++i)
for (size_t i = 0; i < j; ++i)
_state.add_edge(l, u, v);
}
}
else
{
dS = _state.add_edge_dS(l, u, v, _entropy_args);
size_t j = 0;
for (int i = 0; i < dm-1; ++i)
{
if (std::isinf(dS))
break;
_state.add_edge(l, u, v);
dS += _state.add_edge_dS(l, u, v, _entropy_args);
j++;
}
for (int i = 0; i < dm-1; ++i)
for (size_t i = 0; i < j; ++i)
_state.remove_edge(l, u, v);
}
......
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