HyperLogLog estimates.
More...
#include <hibf/sketch/hyperloglog.hpp>
HyperLogLog estimates.
Original work by Hideaki Ohno. Major changes have been applied for bugfixes, 64-bit support, improvements, etc.
- See also
- https://github.com/hideo55/cpp-HyperLogLog
◆ hyperloglog()
seqan::hibf::sketch::hyperloglog::hyperloglog |
( |
uint8_t const | num_bits = 5u | ) |
|
Default constructor.
- Parameters
-
[in] | num_bits | The bit width in [5,32]. |
Allocates 2^num_bits
bytes of memory.
- Exceptions
-
◆ add()
void seqan::hibf::sketch::hyperloglog::add |
( |
uint64_t const | value | ) |
|
Adds a value.
- Parameters
-
[in] | value | The value to add. |
◆ estimate()
double seqan::hibf::sketch::hyperloglog::estimate |
( |
| ) |
const |
Estimates cardinality value.
- Returns
- Estimated cardinality value.
◆ merge()
void seqan::hibf::sketch::hyperloglog::merge |
( |
hyperloglog const & | other | ) |
|
Merges another hyperloglog into this object.
- Parameters
-
[in] | other | The hyperloglog to be merged. |
This has the same effect as adding all values that were added to other
.
- Warning
- Merging a hyperloglog with differing
bits
is undefined behaviour. In debug mode, this is an assertion instead.
◆ merge_and_estimate()
double seqan::hibf::sketch::hyperloglog::merge_and_estimate |
( |
hyperloglog const & | other | ) |
|
Merges another hyperloglog and returns the new estimate.
- Parameters
-
[in] | other | The hyperloglog to be merged. |
- Returns
- Estimated cardinality value.
- Warning
- Merging a hyperloglog with differing
bits
is undefined behaviour. In debug mode, this is an assertion instead.
◆ data_size()
uint64_t seqan::hibf::sketch::hyperloglog::data_size |
( |
| ) |
const |
|
inline |
Returns size of the internal data.
- Returns
- Size in bytes. The returned value is equivalent to 2^
bits
.
◆ store()
void seqan::hibf::sketch::hyperloglog::store |
( |
std::ostream & | os | ) |
const |
Write the hyperloglog to a stream.
- Parameters
-
[in,out] | os | The output stream to write to. |
- Exceptions
-
◆ load()
void seqan::hibf::sketch::hyperloglog::load |
( |
std::istream & | is | ) |
|
Loads the hyperloglog from a stream.
- Parameters
-
[in] | is | The input stream where to read from. |
- Exceptions
-
The documentation for this class was generated from the following file: