From 4f9933d668d247ea5831c3f2af0b996a94da28f7 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 10 Mar 2011 01:58:30 -0500 Subject: remove dependency on SRILM --- utils/sparse_vector.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'utils/sparse_vector.h') diff --git a/utils/sparse_vector.h b/utils/sparse_vector.h index f76fc14c..1bcb9502 100644 --- a/utils/sparse_vector.h +++ b/utils/sparse_vector.h @@ -201,6 +201,11 @@ public: return found==values_.end() || !found->second; } + void remove_zeros() { + typename MapType::iterator it = values_.begin(); + for (; it != values_.end(); ++it) + if (!it->second) values_.erase(it); + } T get(int index) const { typename MapType::const_iterator found = values_.find(index); -- cgit v1.2.3