From 1c0b252dfa0169eef0a4bdb7442d433b2bf8c1c7 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sun, 29 Apr 2012 17:19:18 +0200 Subject: reverted changes in upstream --- utils/dict.h | 2 +- utils/fast_sparse_vector.h | 5 ++--- utils/sampler.h | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'utils') diff --git a/utils/dict.h b/utils/dict.h index a3400868..595e4f9f 100644 --- a/utils/dict.h +++ b/utils/dict.h @@ -73,7 +73,7 @@ class Dict { inline const std::string& Convert(const WordID& id) const { if (id == 0) return b0_; assert(id <= (int)words_.size()); - //if (id < 0 || id > (int)words_.size()) return b0_; + if (id < 0 || id > (int)words_.size()) return b0_; return words_[id-1]; } diff --git a/utils/fast_sparse_vector.h b/utils/fast_sparse_vector.h index 2c49948c..af832950 100644 --- a/utils/fast_sparse_vector.h +++ b/utils/fast_sparse_vector.h @@ -196,7 +196,7 @@ class FastSparseVector { else return local_size_; } - size_t size_nonzero() const { + size_t num_nonzero() const { size_t sz = 0; const_iterator it = this->begin(); for (; it != this->end(); ++it) { @@ -229,12 +229,11 @@ class FastSparseVector { return *this; } template - inline FastSparseVector& plus_eq_v_times_s(const FastSparseVector& other, const O scalar) { + inline void plus_eq_v_times_s(const FastSparseVector& other, const O scalar) { const typename FastSparseVector::const_iterator end = other.end(); for (typename FastSparseVector::const_iterator it = other.begin(); it != end; ++it) { get_or_create_bin(it->first) += it->second * scalar; } - return *this; } inline FastSparseVector& operator-=(const FastSparseVector& other) { const typename FastSparseVector::const_iterator end = other.end(); diff --git a/utils/sampler.h b/utils/sampler.h index bdbc01b0..22c873d4 100644 --- a/utils/sampler.h +++ b/utils/sampler.h @@ -32,7 +32,7 @@ struct RandomNumberGenerator { std::cerr << "Warning: could not read from /dev/urandom. Seeding from clock" << std::endl; seed = std::time(NULL); } - //std::cerr << "Seeding random number sequence to " << seed << std::endl; + std::cerr << "Seeding random number sequence to " << seed << std::endl; return seed; } -- cgit v1.2.3