From b89da66b5bc922148cb4ec2b30cc751c827c9f64 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Mon, 18 Jun 2012 20:42:27 -0400 Subject: fixes for non-const iterator --- rst_parser/mst_train.cc | 2 +- rst_parser/rst_train.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'rst_parser') diff --git a/rst_parser/mst_train.cc b/rst_parser/mst_train.cc index 6332693e..a78df600 100644 --- a/rst_parser/mst_train.cc +++ b/rst_parser/mst_train.cc @@ -176,7 +176,7 @@ int main(int argc, char** argv) { for (int iter = 0; iter < iterations; ++iter) { cerr << "ITERATION " << iter << " " << flush; fill(g.begin(), g.end(), 0.0); - for (SparseVector::const_iterator it = empirical.begin(); it != empirical.end(); ++it) + for (SparseVector::iterator it = empirical.begin(); it != empirical.end(); ++it) g[it->first] = -it->second; double obj = -empirical.dot(weights); vector > jobs; diff --git a/rst_parser/rst_train.cc b/rst_parser/rst_train.cc index 9b730f3d..a8b8dd84 100644 --- a/rst_parser/rst_train.cc +++ b/rst_parser/rst_train.cc @@ -126,12 +126,12 @@ int main(int argc, char** argv) { u.logeq(tot_feats.dot(weights)); prob_t w = u / q; zhat += w; - for (SparseVector::const_iterator it = tot_feats.begin(); it != tot_feats.end(); ++it) + for (SparseVector::iterator it = tot_feats.begin(); it != tot_feats.end(); ++it) sampled_exp.add_value(it->first, w * prob_t(it->second)); } sampled_exp /= zhat; SparseVector tot_m; - for (SparseVector::const_iterator it = sampled_exp.begin(); it != sampled_exp.end(); ++it) + for (SparseVector::iterator it = sampled_exp.begin(); it != sampled_exp.end(); ++it) tot_m.add_value(it->first, it->second.as_float()); //cerr << "DIFF: " << (tot_m - corpus[i].features) << endl; const double eta = 0.03; -- cgit v1.2.3