1 #include <bf/bloom_filter/counting.h>
10 : hasher_(std::move(h)),
22 auto min = cells_.
max();
25 auto cnt = cells_.
count(i);
45 auto digests = hasher_(o);
46 std::vector<size_t> indices(digests.size());
49 assert(cells_.
size() % digests.size() == 0);
50 size_t const parts = cells_.
size() / digests.size();
51 for (
size_t i = 0; i < indices.size(); ++i)
52 indices[i] = digests[i] % parts + (i * parts);
56 for (
size_t i = 0; i < indices.size(); ++i)
57 indices[i] = digests[i] % cells_.
size();
59 std::sort(indices.begin(), indices.end());
60 indices.erase(std::unique(indices.begin(), indices.end()), indices.end());
67 auto min = cells_.
max();
68 for (
auto i : indices)
70 auto cnt = cells_.
count(i);
80 auto min = cells_.
max();
81 std::vector<size_t> positions;
82 for (
auto i : indices)
84 auto cnt = cells_.
count(i);
87 positions.push_back(i);
93 positions.push_back(i);
103 for (
auto i : indices)
113 for (
auto i : indices)
121 return cells_.
count(index);
137 hasher h1,
size_t cells1,
size_t width1,
138 hasher h2,
size_t cells2,
size_t width2)
139 : first_(std::move(h1), cells1, width1),
140 second_(std::move(h2), cells2, width2)
154 if (mins1.size() > 1)
158 auto min1 = first_.
count(mins1[0]);
164 second_.
increment(indices2, min2 > 0 ? 1 : min1);
174 auto min1 = first_.
count(mins1[0]);
175 if (mins1.size() > 1)
178 return min2 > 0 ? min2 : min1;
195 if (mins1.size() > 1)