summaryrefslogtreecommitdiff
path: root/decoder/inside_outside.h
diff options
context:
space:
mode:
authorPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-05-31 13:57:24 +0200
committerPatrick Simianer <simianer@cl.uni-heidelberg.de>2012-05-31 13:57:24 +0200
commitf1ba05780db1705493d9afb562332498b93d26f1 (patch)
treefb429a657ba97f33e8140742de9bc74d9fc88e75 /decoder/inside_outside.h
parentaadabfdf37dfd451485277cb77fad02f77b361c6 (diff)
parent317d650f6cb1e24ac6f3be6f7bf9d4246a59e0e5 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'decoder/inside_outside.h')
-rw-r--r--decoder/inside_outside.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/decoder/inside_outside.h b/decoder/inside_outside.h
index dc96f1a9..bb7f9fcc 100644
--- a/decoder/inside_outside.h
+++ b/decoder/inside_outside.h
@@ -31,24 +31,24 @@ template<class WeightType, class WeightFunction>
WeightType Inside(const Hypergraph& hg,
std::vector<WeightType>* result = NULL,
const WeightFunction& weight = WeightFunction()) {
- const int num_nodes = hg.nodes_.size();
+ const unsigned num_nodes = hg.nodes_.size();
std::vector<WeightType> dummy;
std::vector<WeightType>& inside_score = result ? *result : dummy;
inside_score.clear();
inside_score.resize(num_nodes);
// std::fill(inside_score.begin(), inside_score.end(), WeightType()); // clear handles
- for (int i = 0; i < num_nodes; ++i) {
+ for (unsigned i = 0; i < num_nodes; ++i) {
WeightType* const cur_node_inside_score = &inside_score[i];
Hypergraph::EdgesVector const& in=hg.nodes_[i].in_edges_;
- const int num_in_edges = in.size();
+ const unsigned num_in_edges = in.size();
if (num_in_edges == 0) {
*cur_node_inside_score = WeightType(1); //FIXME: why not call weight(edge) instead?
continue;
}
- for (int j = 0; j < num_in_edges; ++j) {
+ for (unsigned j = 0; j < num_in_edges; ++j) {
const Hypergraph::Edge& edge = hg.edges_[in[j]];
WeightType score = weight(edge);
- for (int k = 0; k < edge.tail_nodes_.size(); ++k) {
+ for (unsigned k = 0; k < edge.tail_nodes_.size(); ++k) {
const int tail_node_index = edge.tail_nodes_[k];
score *= inside_score[tail_node_index];
}
@@ -67,7 +67,7 @@ void Outside(const Hypergraph& hg,
) {
assert(result);
const int num_nodes = hg.nodes_.size();
- assert(inside_score.size() == num_nodes);
+ assert(static_cast<int>(inside_score.size()) == num_nodes);
std::vector<WeightType>& outside_score = *result;
outside_score.clear();
outside_score.resize(num_nodes);