summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-06-18 20:42:27 -0400
committerChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-06-18 20:42:27 -0400
commit6d7219c6091e4dd1b6434bc6ec0645a3282d4883 (patch)
treecf6f992779d586c1f9845e32ee4a4a3236bea548
parentb89a1d3cb72ac36c137d6ae342f48ab9b8ee6655 (diff)
fixes for non-const iterator
-rw-r--r--rst_parser/mst_train.cc2
-rw-r--r--rst_parser/rst_train.cc4
2 files changed, 3 insertions, 3 deletions
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<double>::const_iterator it = empirical.begin(); it != empirical.end(); ++it)
+ for (SparseVector<double>::iterator it = empirical.begin(); it != empirical.end(); ++it)
g[it->first] = -it->second;
double obj = -empirical.dot(weights);
vector<boost::shared_ptr<GradientWorker> > 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<double>::const_iterator it = tot_feats.begin(); it != tot_feats.end(); ++it)
+ for (SparseVector<double>::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<double> tot_m;
- for (SparseVector<prob_t>::const_iterator it = sampled_exp.begin(); it != sampled_exp.end(); ++it)
+ for (SparseVector<prob_t>::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;