Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::HyperLogLog Class Reference

#include <duckdb.hpp>

Public Member Functions

void InsertElement (hash_t h)
 Algorithm 1.
 
void Update (const idx_t &i, const uint8_t &z)
 
uint8_t GetRegister (const idx_t &i) const
 
idx_t Count () const
 
void Merge (const HyperLogLog &other)
 Algorithm 2.
 
void Update (Vector &input, Vector &hashes, idx_t count)
 Add data to this HLL.
 
unique_ptr< HyperLogLogCopy () const
 Get copy of the HLL.
 
void Serialize (Serializer &serializer) const
 
void ExtractCounts (uint32_t *c) const
 Algorithm 4.
 

Static Public Member Functions

static double GetErrorRate ()
 
static unique_ptr< HyperLogLogDeserialize (Deserializer &deserializer)
 
static int64_t EstimateCardinality (uint32_t *c)
 Algorithm 6.
 

Static Public Attributes

static constexpr idx_t P = 6
 
static constexpr idx_t Q = 64 - P
 
static constexpr idx_t M = 1 << P
 
static constexpr double ALPHA = 0.721347520444481703680
 

Private Attributes

uint8_t k [M]
 

Detailed Description

Algorithms from "New cardinality estimation algorithms for HyperLogLog sketches" Otmar Ertl, arXiv:1702.01284

Constructor & Destructor Documentation

◆ HyperLogLog()

duckdb::HyperLogLog::HyperLogLog ( )
inline
48243 {
48244 memset(k, 0, sizeof(k));
48245 }

Member Function Documentation

◆ GetErrorRate()

static double duckdb::HyperLogLog::GetErrorRate ( )
inlinestatic
48238 {
48239 return std::sqrt(PI / 2.0) / sqrt(M);
48240 }
void sqrt(InputArray src, OutputArray dst)

◆ InsertElement()

void duckdb::HyperLogLog::InsertElement ( hash_t  h)
inline

Algorithm 1.

48248 {
48249 const auto i = h & ((1 << P) - 1);
48250 h >>= P;
48251 h |= hash_t(1) << Q;
48252 const uint8_t z = UnsafeNumericCast<uint8_t>(CountZeros<hash_t>::Trailing(h) + 1);
48253 Update(i, z);
48254 }
z
::uint8_t uint8_t
uint64_t hash_t
The type used for hashes.
Definition duckdb.hpp:243

◆ Update()

void duckdb::HyperLogLog::Update ( const idx_t i,
const uint8_t z 
)
inline
48256 {
48257 k[i] = MaxValue<uint8_t>(k[i], z);
48258 }

◆ GetRegister()

uint8_t duckdb::HyperLogLog::GetRegister ( const idx_t i) const
inline
48260 {
48261 return k[i];
48262 }

The documentation for this class was generated from the following file: