diff options
author | Chris Dyer <cdyer@cs.cmu.edu> | 2012-05-27 23:25:16 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cs.cmu.edu> | 2012-05-27 23:25:16 -0400 |
commit | 104aad02a868c1fc6320276d9b3b9b0e1f41f457 (patch) | |
tree | 7bd9e092ed2d008024ae2834b3582c86c5394f7a /training/kbest_repository.cc | |
parent | fc936db02d42cc3978a4cc2017efe7a15c78855d (diff) |
fix mapper to use common candidate set code
Diffstat (limited to 'training/kbest_repository.cc')
-rw-r--r-- | training/kbest_repository.cc | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/training/kbest_repository.cc b/training/kbest_repository.cc deleted file mode 100644 index 145b40a2..00000000 --- a/training/kbest_repository.cc +++ /dev/null @@ -1,37 +0,0 @@ -#include "kbest_repository.h" - -#include <boost/functional/hash.hpp> - -using namespace std; - -struct ApproxVectorHasher { - static const size_t MASK = 0xFFFFFFFFull; - union UType { - double f; // leave as double - size_t i; - }; - static inline double round(const double x) { - UType t; - t.f = x; - size_t r = t.i & MASK; - if ((r << 1) > MASK) - t.i += MASK - r + 1; - else - t.i &= (1ull - MASK); - return t.f; - } - size_t operator()(const SparseVector<double>& x) const { - size_t h = 0x573915839; - for (SparseVector<double>::const_iterator it = x.begin(); it != x.end(); ++it) { - UType t; - t.f = it->second; - if (t.f) { - size_t z = (t.i >> 32); - boost::hash_combine(h, it->first); - boost::hash_combine(h, z); - } - } - return h; - } -}; - |