summaryrefslogtreecommitdiffstats
path: root/include/shard
diff options
context:
space:
mode:
Diffstat (limited to 'include/shard')
-rw-r--r--include/shard/Alias.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/include/shard/Alias.h b/include/shard/Alias.h
index b6b16c5..a4a7d02 100644
--- a/include/shard/Alias.h
+++ b/include/shard/Alias.h
@@ -19,7 +19,7 @@
#include "psu-ds/PriorityQueue.h"
#include "util/Cursor.h"
-#include "psu-ds/psudb::Alias.h"
+#include "psu-ds/Alias.h"
#include "psu-ds/BloomFilter.h"
#include "util/bf_config.h"
@@ -207,7 +207,13 @@ public:
return 0;
}
-private:
+ W get_total_weight() {
+ return m_total_weight;
+ }
+
+ size_t get_weighted_sample(gsl_rng *rng) const {
+ return m_alias->get(rng);
+ }
size_t get_lower_bound(const K& key) const {
size_t min = 0;
@@ -227,6 +233,8 @@ private:
return min;
}
+private:
+
void build_alias_structure(std::vector<W> &weights) {
// normalize the weights vector
@@ -249,3 +257,4 @@ private:
size_t m_alloc_size;
BloomFilter<R> *m_bf;
};
+}