-
Notifications
You must be signed in to change notification settings - Fork 0
/
myxshead.h
77 lines (63 loc) · 1.04 KB
/
myxshead.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using namespace SZaru;
#include <vector>
class PTopEstimator {
public:
~PTopEstimator()
{
delete t;
}
PTopEstimator(uint32_t numTops)
{
t = SZaru::TopEstimator<double>::Create(numTops);
}
void
add_elem(const std::string& elm)
{
t->AddElem(elm);
}
void
add_weighted_elem(const std::string& elem, double weight)
{
t->AddWeightedElem(elem, weight);
}
void
estimate(std::vector< SZaru::TopEstimator<double>::Elem >& v)
{
t->Estimate(v);
}
uint64_t
tot_elems()
{
return t->TotElems();
}
private:
SZaru::TopEstimator<double> *t;
};
class PQuantileEstimator {
public:
~PQuantileEstimator()
{
delete q;
}
PQuantileEstimator(uint32_t numQuantiles)
{
q = SZaru::QuantileEstimator<double>::Create(numQuantiles);
}
void
add_elem(const double& elm)
{
q->AddElem(elm);
}
uint64_t
tot_elems()
{
return q->TotElems();
}
void
estimate(std::vector< double >& output)
{
q->Estimate(output);
}
private:
SZaru::QuantileEstimator<double> *q;
};