Module utils

Source
Expand description

§Utils

This module provides utility functions used by the HyperLogLog algorithm implementation.

The functions provided are:

  • ceil(numerator: usize, denominator: usize) -> usize: Calculates the integer ceil of the division of numerator by denominator.

  • word_from_registers<const NUMBER_OF_BITS_PER_REGISTER: usize>(registers: &[u32]) -> u32: Converts an array of HLL registers into a single 32-bit word.

Functions§

ceil
Calculates the integer ceil of the division of numerator by denominator.
get_alpha
Computes the alpha constant for the given number of registers.
linear_counting_threshold
Returns an empirically determined threshold to decide on the use of linear counting.
precompute_linear_counting
Precomputes small corrections for HyperLogLog algorithm.