Commit 4186030c authored by Tiago Peixoto's avatar Tiago Peixoto

uncertain_blockmodel: Fix issue with clear_egroups()

parent 78e6d500
......@@ -67,7 +67,7 @@ struct Merge
_m_entries(num_vertices(_state._bg)),
_null_move(numeric_limits<size_t>::max())
{
_state._egroups.clear();
_state.clear_egroups();
if (_entropy_args.partition_dl || _entropy_args.degree_dl ||
_entropy_args.edges_dl)
......
......@@ -66,7 +66,7 @@ struct Merge
_g(_state._g),
_null_move(std::numeric_limits<size_t>::max())
{
_state._egroups.clear();
_state.clear_egroups();
gt_hash_map<int, gt_hash_map<int, std::vector<size_t>>>
block_bundles;
......
......@@ -1376,6 +1376,9 @@ class BlockState(object):
return L
def _clear_egroups(self):
self._state.clear_egroups()
def _mcmc_sweep_dispatch(self, mcmc_state):
return libinference.mcmc_sweep(mcmc_state, self._state,
_get_rng())
......
......@@ -956,6 +956,9 @@ class LayeredBlockState(OverlapBlockState, BlockState):
return L
def _clear_egroups(self):
self._state.clear_egroups()
def _mcmc_sweep_dispatch(self, mcmc_state):
if not self.overlap:
return libinference.mcmc_layered_sweep(mcmc_state, self._state,
......
......@@ -699,6 +699,10 @@ class NestedBlockState(object):
eargs = hentropy_args
self.levels[l]._couple_state(self.levels[l + 1], eargs)
def _clear_egroups(self):
for lstate in self.levels:
lstate._clear_egroups()
def _h_sweep_gen(self, **kwargs):
if not self.sampling:
......
......@@ -597,6 +597,8 @@ class OverlapBlockState(BlockState):
recs_dl=recs_dl, beta_dl=beta_dl, exact=exact,
**kwargs)
def _clear_egroups(self):
self._state.clear_egroups()
def _mcmc_sweep_dispatch(self, mcmc_state):
dS, nattempts, nmoves = \
......
......@@ -122,7 +122,10 @@ class UncertainBaseState(object):
Si = self.entropy(**dentropy_args)
try:
self.bstate._state.clear_egroups()
if self.nbstate is None:
self.bstate._clear_egroups()
else:
self.nbstate._clear_egroups()
if numpy.random.random() < r:
edges = True
dS, nattempts, nmoves = self._mcmc_sweep(mcmc_state)
......
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