Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
4822ba5b
Commit
4822ba5b
authored
Dec 29, 2019
by
Tiago Peixoto
Browse files
inference: fix clabel enforcement in mcmc/multiflip_mcmc
parent
3ca7df5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph/inference/blockmodel/graph_blockmodel.hh
View file @
4822ba5b
...
...
@@ -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
;
}
...
...
src/graph/inference/blockmodel/graph_blockmodel_multiflip_mcmc.hh
View file @
4822ba5b
...
...
@@ -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
())
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment