From b6634dff2cd515d9e6f95416512db893a08bde29 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 21 Apr 2011 18:06:31 -0400 Subject: adding functionality to fast_sparse_vector, getting ready for transition to it --- utils/sparse_vector.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'utils/sparse_vector.h') diff --git a/utils/sparse_vector.h b/utils/sparse_vector.h index 1bcb9502..de8c0291 100644 --- a/utils/sparse_vector.h +++ b/utils/sparse_vector.h @@ -1,6 +1,8 @@ #ifndef _SPARSE_VECTOR_H_ #define _SPARSE_VECTOR_H_ +#undef USE_FAST_SPARSE_VECTOR +#ifndef USE_FAST_SPARSE_VECTOR /* TODO: specialize for int value types, where it probably makes sense to check if adding/subtracting brings a value to 0, and remove it from the map (e.g. in a gibbs sampler). or add a separate policy argument for that. */ @@ -667,6 +669,13 @@ std::ostream &operator<<(std::ostream &out, const SparseVector &vec) return vec.operator<<(out); } +#else + +#include "fast_sparse_vector.h" +#define SparseVector FastSparseVector + +#endif + namespace B64 { void Encode(double objective, const SparseVector& v, std::ostream* out); // returns false if failed to decode -- cgit v1.2.3