-
Notifications
You must be signed in to change notification settings - Fork 1
/
FlajoletMartin.h
38 lines (27 loc) · 1.06 KB
/
FlajoletMartin.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// =============================================================================
#ifndef FLAJOLET_MARTIN_H
#define FLAJOLET_MARTIN_H
#include <string>
#include <vector>
// TODO: What was the point of using boost::scoped_array?
#include <boost/scoped_array.hpp>
// =============================================================================
class FlajoletMartin {
public:
FlajoletMartin();
double approximateCount(std::vector<std::string>& items, /*const int L,*/ const int M);
int getM() { return M; }
private:
int ls1(uint64_t n);
int ls0(uint64_t n);
uint64_t vls1(uint64_t n);
uint64_t vls0(uint64_t n);
void initialHash(std::vector<std::string>& items, boost::scoped_array<uint64_t>& b, int n);
double decodeBitString(const boost::scoped_array<uint64_t>& b);
// int L; // by using 64-bit unsigned integers, we define L = 64
int M;
static double PHI;
};
// =============================================================================
#endif // FLAJOLET_MARTIN_H
// =============================================================================