summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-10-16 01:42:55 -0400
committerChris Dyer <cdyer@cab.ark.cs.cmu.edu>2012-10-16 01:42:55 -0400
commitb98f7e8de2c35937c227236ddb986df4879edb5f (patch)
treee6ebc489593c6c9a7ff08ea75c9e12e6c2c9128c
parent51b5c16c9110999ac573bd3383d7eb0e3f10fc37 (diff)
c++11 compatibility
-rw-r--r--dpmert/lo_test.cc2
-rw-r--r--training/cllh_observer.cc2
-rw-r--r--training/collapse_weights.cc2
-rw-r--r--training/mpi_batch_optimize.cc2
-rw-r--r--training/mpi_online_optimize.cc4
-rw-r--r--training/mr_optimize_reduce.cc4
6 files changed, 8 insertions, 8 deletions
diff --git a/dpmert/lo_test.cc b/dpmert/lo_test.cc
index 2daf87bb..95a08d3d 100644
--- a/dpmert/lo_test.cc
+++ b/dpmert/lo_test.cc
@@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE( TestCheckNaN) {
double x = 0;
double y = 0;
double z = x / y;
- BOOST_CHECK_EQUAL(true, isnan(z));
+ BOOST_CHECK_EQUAL(true, std::isnan(z));
}
BOOST_AUTO_TEST_CASE(TestConvexHull) {
diff --git a/training/cllh_observer.cc b/training/cllh_observer.cc
index 58232769..4ec2fa65 100644
--- a/training/cllh_observer.cc
+++ b/training/cllh_observer.cc
@@ -45,7 +45,7 @@ void ConditionalLikelihoodObserver::NotifyAlignmentForest(const SentenceMetadata
cerr << "DIFF. ERR! log_model_z < log_ref_z: " << cur_obj << " " << log_ref_z << endl;
exit(1);
}
- assert(!isnan(log_ref_z));
+ assert(!std::isnan(log_ref_z));
acc_obj += (cur_obj - log_ref_z);
trg_words += smeta.GetReference().size();
}
diff --git a/training/collapse_weights.cc b/training/collapse_weights.cc
index dc480f6c..c03eb031 100644
--- a/training/collapse_weights.cc
+++ b/training/collapse_weights.cc
@@ -95,7 +95,7 @@ int main(int argc, char** argv) {
if (line.empty()) continue;
TRule tr(line, true);
const double lp = tr.GetFeatureValues().dot(w);
- if (isinf(lp)) { continue; }
+ if (std::isinf(lp)) { continue; }
tr.scores_.clear();
cout << tr.AsString() << " ||| F_and_E=" << lp - log(tot);
diff --git a/training/mpi_batch_optimize.cc b/training/mpi_batch_optimize.cc
index 6432f4a2..2eff07e4 100644
--- a/training/mpi_batch_optimize.cc
+++ b/training/mpi_batch_optimize.cc
@@ -142,7 +142,7 @@ struct TrainingObserver : public DecoderObserver {
cerr << "DIFF. ERR! log_model_z < log_ref_z: " << cur_obj << " " << log_ref_z << endl;
exit(1);
}
- assert(!isnan(log_ref_z));
+ assert(!std::isnan(log_ref_z));
ref_exp -= cur_model_exp;
acc_grad -= ref_exp;
acc_obj += (cur_obj - log_ref_z);
diff --git a/training/mpi_online_optimize.cc b/training/mpi_online_optimize.cc
index 993627f0..d6968848 100644
--- a/training/mpi_online_optimize.cc
+++ b/training/mpi_online_optimize.cc
@@ -143,7 +143,7 @@ struct TrainingObserver : public DecoderObserver {
cerr << "DIFF. ERR! log_model_z < log_ref_z: " << cur_obj << " " << log_ref_z << endl;
exit(1);
}
- assert(!isnan(log_ref_z));
+ assert(!std::isnan(log_ref_z));
ref_exp -= cur_model_exp;
acc_grad += ref_exp;
acc_obj += (cur_obj - log_ref_z);
@@ -330,7 +330,7 @@ int main(int argc, char** argv) {
if (rank == 0) {
converged = (iter == max_iteration);
Weights::SanityCheck(lambdas);
- Weights::ShowLargestFeatures(lambdas);
+ static int cc = 0; ++cc; if (cc > 1) { Weights::ShowLargestFeatures(lambdas); }
string fname = "weights.cur.gz";
if (iter % write_weights_every_ith == 0) {
ostringstream o; o << "weights.epoch_" << (ai+1) << '.' << iter << ".gz";
diff --git a/training/mr_optimize_reduce.cc b/training/mr_optimize_reduce.cc
index 461e6b5f..d490192f 100644
--- a/training/mr_optimize_reduce.cc
+++ b/training/mr_optimize_reduce.cc
@@ -19,8 +19,8 @@ namespace po = boost::program_options;
void SanityCheck(const vector<double>& w) {
for (int i = 0; i < w.size(); ++i) {
- assert(!isnan(w[i]));
- assert(!isinf(w[i]));
+ assert(!std::isnan(w[i]));
+ assert(!std::isinf(w[i]));
}
}