Struct basichll::HLL [] [src]

pub struct HLL {
    // some fields omitted
}

The HLL struct stores the underlying registers of the HyperLogLog, with m many registers.

The value for m is derived from the desired error of the estimation. The error is considered to be 1.04 / sqrt(2 ^ bits). So, given a desired 1% error rate, we result in around 12 bits per register, producing an underlying M of 212 bits (i.e. 4kb).

Methods

impl HLL
[src]

fn one_hundred_twenty_eight() -> HLL

Convenience function to produce a HLL with one hundred and twenty eight registers.

fn new(error: f64) -> HLL

Create a new HLL with the desired standard error. Some examples might be:

     bits    size    error
     12      4096    0.0163
     13      8192    0.0115
     14      16384   0.0081

The error must be between 0.0 and 1.0. Beware using a stupidly small error size will grow beyond e.g. isize at less than 0.03 (if you need something that isn't an estimate probably don't use a hyperloglog).

fn insert<T: Hash>(&mut self, val: &T) -> bool

Add an element into the hyperloglog estimate. We require the type of value to be able to be hashed. Returns whether the insertion altered the hyperloglog

fn count(&self) -> f64

Return the estimated cardinality of the observed set of elements.

fn registers(&self) -> Vec<u8>

Access a copy of the underlying registers (this is mainly here just for debugging/testing... its unlikely you'll need this access typically).

fn empty() -> HLL

A completely zeroed HLL. Not particularly useful except as an identity element in Add.

fn into_vec(self) -> Vec<u8>

fn from_vec(data: Vec<u8>) -> HLL

Trait Implementations

impl PartialEq for HLL
[src]

fn eq(&self, __arg_0: &HLL) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &HLL) -> bool

This method tests for !=.

impl Clone for HLL
[src]

fn clone(&self) -> HLL

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl Eq for HLL
[src]

impl Display for HLL
[src]

fn fmt(&self, formatter: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Debug for HLL
[src]

fn fmt(&self, formatter: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'a> Add<&'a HLL> for &'a HLL
[src]

Adding together two HLLs produces a new HLL where the larger value of each register has been selected.

type Output = HLL

The resulting type after applying the + operator

fn add(self, other: &'a HLL) -> HLL

The method for the + operator