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
commitb6634dff2cd515d9e6f95416512db893a08bde29 (patch)
tree02730df750245ef3d101deb469d0e10109b7d6f5 /utils/sparse_vector.h
parent282bc08647eb6856f798da0c64dd67530e02842a (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