Skip to content

Latest commit

 

History

History
64 lines (41 loc) · 999 Bytes

File metadata and controls

64 lines (41 loc) · 999 Bytes

API: KMV

Status: Unstable

Warning: This API is available and tested, but not yet integrated into the primary structured framework surfaces.

Purpose

K-minimum values cardinality estimator.

Type/Struct

  • KMV<H = DefaultXxHasher>

Constructors

fn default() -> Self
fn new(k: usize) -> Self

Insert/Update

fn insert(&mut self, item: &DataInput)
fn insert_by_hash(&mut self, hash_value: u64)

Query

fn estimate(&mut self) -> f64

Merge

fn merge(&mut self, other: &mut KMV<H>)

Serialization

fn serialize_to_bytes(&self) -> Result<Vec<u8>, RmpEncodeError>
fn deserialize_from_bytes(bytes: &[u8]) -> Result<Self, RmpDecodeError>

Examples

use asap_sketchlib::{KMV, DataInput};

let mut kmv = KMV::new(1024);
kmv.insert(&DataInput::U64(1));
let _ = kmv.estimate();

Caveats

  • Not currently part of primary framework wrappers.

Status

Unstable; retained for compatibility visibility.