summaryrefslogtreecommitdiff
path: root/decoder/inside_outside.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-05-23 18:02:48 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-05-23 18:02:48 -0400
commitd60dda793ce24818becf6dfb140579899a5e121b (patch)
treec75da9045295be3768a13f21f5fe09907229cf05 /decoder/inside_outside.h
parent57339faa0074d35783213b03f921ee7ad13f9481 (diff)
more bjam stuff, more cleanup
Diffstat (limited to 'decoder/inside_outside.h')
-rw-r--r--decoder/inside_outside.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/decoder/inside_outside.h b/decoder/inside_outside.h
index dc96f1a9..2ded328d 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];
}