Commit 93d7eec3 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: Remove ddS from MCMC loop

parent 9466363f
......@@ -104,7 +104,7 @@ struct MCMC
return s;
}
std::tuple<double, double, double>
std::tuple<double, double>
virtual_move_dS(size_t v, size_t nr)
{
size_t r = _state._b[v];
......@@ -119,7 +119,7 @@ struct MCMC
_m_entries);
a = log(pb) - log(pf);
}
return make_tuple(dS, a, dS);
return {dS, a};
}
void perform_move(size_t v, size_t nr)
......
......@@ -129,7 +129,7 @@ struct MCMC
return s;
}
std::tuple<double, double, double>
std::tuple<double, double>
virtual_move_dS(size_t i, size_t nr)
{
double dS = 0;
......@@ -161,7 +161,7 @@ struct MCMC
for (auto v : _bundles[i])
_state.move_vertex(v, r);
return std::make_tuple(dS, a, dS);
return {dS, a};
}
void perform_move(size_t i, size_t nr)
......
......@@ -85,14 +85,14 @@ auto mcmc_sweep(MCMCState state, RNG& rng)
if (s == r)
continue;
double dS, mP, rdS;
std::tie(dS, mP, rdS) = state.virtual_move_dS(v, s);
double dS, mP;
std::tie(dS, mP) = state.virtual_move_dS(v, s);
if (metropolis_accept(dS, mP, beta, rng))
{
state.perform_move(v, s);
nmoves += state.node_weight(v);
S += rdS;
S += dS;
}
if (state._verbose)
......@@ -148,8 +148,8 @@ auto mcmc_sweep_parallel(MCMCState state, RNG& rng_)
if (s == r)
return;
double dS, mP, rdS;
std::tie(dS, mP, rdS) = state.virtual_move_dS(v, s);
double dS, mP;
std::tie(dS, mP) = state.virtual_move_dS(v, s);
if (metropolis_accept(dS, mP, beta, rng))
{
......@@ -174,7 +174,7 @@ auto mcmc_sweep_parallel(MCMCState state, RNG& rng_)
state.perform_move(v, s);
nmoves++;
S += get<2>(ddS);
S += get<0>(ddS);
}
}
}
......
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