summaryrefslogtreecommitdiff
path: root/utils/sparse_vector.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2011-04-21 18:06:31 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2011-04-21 18:06:31 -0400
commit5061409a26050b9a4724b50b30d66d3c3a583951 (patch)
treebe91d2c2f5c99814643befb2890f71551ba10fc5 /utils/sparse_vector.h
parentc224922dc04a2fa8467e2a8b20f42e3f0006e676 (diff)
adding functionality to fast_sparse_vector, getting ready for transition to it
Diffstat (limited to 'utils/sparse_vector.h')
-rw-r--r--utils/sparse_vector.h9
1 files changed, 9 insertions, 0 deletions
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<T> &vec)
return vec.operator<<(out);
}
+#else
+
+#include "fast_sparse_vector.h"
+#define SparseVector FastSparseVector
+
+#endif
+
namespace B64 {
void Encode(double objective, const SparseVector<double>& v, std::ostream* out);
// returns false if failed to decode