Skip to main content

Crate zw_fast_quantile

Crate zw_fast_quantile 

Source
Expand description

Zhang Wang Fast Approximate Quantiles Algorithm in Rust

§Installation

Add this to your Cargo.toml:

[dependencies]
zw-fast-quantile = "1.0"

§Example

use zw_fast_quantile::FixedSizeEpsilonSummary;

let epsilon = 0.1;
let n = 10;
let mut s = FixedSizeEpsilonSummary::new(n, epsilon).unwrap();
for i in 1..=n {
    s.update(i);
}

let ans = s.query(0.0).unwrap();
let expected = 1;
assert!(expected == ans);
use zw_fast_quantile::UnboundEpsilonSummary;

let epsilon = 0.1;
let n = 10;
let mut s = UnboundEpsilonSummary::new(epsilon).unwrap();
for i in 1..=n {
    s.update(i);
}

let ans = s.query(0.0).unwrap();
let expected = 1;
assert!(expected == ans);

Structs§

FixedSizeEpsilonSummary
An epsilon-approximate quantile summary for a stream with a known size.
UnboundEpsilonSummary

Enums§

QuantileError
Errors that can occur when constructing or querying a quantile summary.