Skip to content
GitLab
Menu
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
afd7243a
Commit
afd7243a
authored
Feb 14, 2018
by
Tiago Peixoto
Browse files
Fix compilation problem with clang
parent
35b3bf30
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/graph/inference/blockmodel/graph_blockmodel.hh
View file @
afd7243a
...
...
@@ -2608,7 +2608,8 @@ public:
return
S
;
}
double
get_parallel_entropy
(
auto
&&
vs
,
auto
&&
skip
)
template
<
class
Vs
,
class
Skip
>
double
get_parallel_entropy
(
Vs
&&
vs
,
Skip
&&
skip
)
{
double
S
=
0
;
for
(
auto
v
:
vs
)
...
...
src/graph/inference/blockmodel/graph_blockmodel_mcmc.hh
View file @
afd7243a
...
...
@@ -117,7 +117,7 @@ struct MCMC
{
size_t
r
=
_state
.
_b
[
v
];
if
(
r
==
nr
)
return
{
0.
,
0.
}
;
return
std
::
make_tuple
(
0.
,
0.
)
;
double
dS
=
_state
.
virtual_move
(
v
,
r
,
nr
,
_entropy_args
,
_m_entries
);
...
...
@@ -130,7 +130,7 @@ struct MCMC
_m_entries
);
a
=
log
(
pb
)
-
log
(
pf
);
}
return
{
dS
,
a
}
;
return
std
::
make_tuple
(
dS
,
a
)
;
}
void
perform_move
(
size_t
v
,
size_t
nr
)
...
...
src/graph/inference/blockmodel/graph_blockmodel_partition.hh
View file @
afd7243a
...
...
@@ -141,7 +141,8 @@ public:
return
S
;
}
double
get_deg_dl_ent
(
auto
&&
rs
,
auto
&&
ks
)
template
<
class
Rs
,
class
Ks
>
double
get_deg_dl_ent
(
Rs
&&
rs
,
Ks
&&
ks
)
{
double
S
=
0
;
for
(
auto
r
:
rs
)
...
...
@@ -172,7 +173,8 @@ public:
return
S
;
}
double
get_deg_dl_uniform
(
auto
&&
rs
,
auto
&&
)
template
<
class
Rs
,
class
Ks
>
double
get_deg_dl_uniform
(
Rs
&&
rs
,
Ks
&&
)
{
double
S
=
0
;
for
(
auto
r
:
rs
)
...
...
@@ -184,7 +186,8 @@ public:
return
S
;
}
double
get_deg_dl_dist
(
auto
&&
rs
,
auto
&&
ks
)
template
<
class
Rs
,
class
Ks
>
double
get_deg_dl_dist
(
Rs
&&
rs
,
Ks
&&
ks
)
{
double
S
=
0
;
for
(
auto
r
:
rs
)
...
...
@@ -218,7 +221,8 @@ public:
return
S
;
}
double
get_deg_dl
(
int
kind
,
auto
&&
rs
,
auto
&&
ks
)
template
<
class
Rs
,
class
Ks
>
double
get_deg_dl
(
int
kind
,
Rs
&&
rs
,
Ks
&&
ks
)
{
switch
(
kind
)
{
...
...
src/graph/inference/uncertain/graph_blockmodel_uncertain_mcmc.hh
View file @
afd7243a
...
...
@@ -97,12 +97,14 @@ struct MCMC
return
node_state
(
u
,
v
);
}
bool
skip_node
(
auto
&
)
template
<
class
T
>
bool
skip_node
(
T
&
)
{
return
false
;
}
size_t
node_weight
(
auto
&
)
template
<
class
T
>
size_t
node_weight
(
T
&
)
{
return
1
;
}
...
...
@@ -136,7 +138,7 @@ struct MCMC
virtual_move_dS
(
size_t
ei
,
int
dm
)
{
if
(
dm
==
0
)
return
{
0.
,
0.
}
;
return
std
::
make_tuple
(
0.
,
0.
)
;
size_t
u
,
v
;
std
::
tie
(
u
,
v
)
=
get_edge
(
ei
);
...
...
@@ -147,7 +149,7 @@ struct MCMC
else
dS
=
_state
.
add_edge_dS
(
u
,
v
,
_entropy_args
);
return
{
dS
,
0.
}
;
return
std
::
make_tuple
(
dS
,
0.
)
;
}
void
perform_move
(
size_t
ei
,
int
dm
)
...
...
@@ -187,7 +189,8 @@ struct MCMC
return
_niter
;
}
void
step
(
auto
&
,
int
)
template
<
class
T
>
void
step
(
T
&
,
int
)
{
}
};
...
...
src/graph_tool/inference/mcmc.py
View file @
afd7243a
...
...
@@ -693,8 +693,8 @@ class TemperingState(object):
return
sweep_algo
[
1
](
self
.
states
,
algo_states
)
def
_sweep
(
self
,
algo
,
adjacent
=
True
,
**
kwargs
):
if
numpy
.
random
.
random
()
<
.
5
:
def
_sweep
(
self
,
algo
,
r
=
0.1
,
adjacent
=
True
,
**
kwargs
):
if
numpy
.
random
.
random
()
<
r
:
return
self
.
states_swap
(
adjacent
=
adjacent
,
**
kwargs
)
else
:
return
self
.
states_move
(
algo
,
**
kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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