1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! # ddsketchy
//!
//! A Rust implementation of the [DDSketch] quantile sketch algorithm.
//!
//! DDSketch is a fast, fully-mergeable quantile sketch with **relative-error
//! guarantees**: every quantile estimate is within a user-chosen multiplicative
//! factor `alpha` of the true value. This makes it well-suited to latency
//! distributions and other data that spans many orders of magnitude, where
//! absolute-error sketches behave poorly. Sketches are cheap to merge, making
//! them a natural fit for distributed aggregation.
//!
//! [DDSketch]: https://arxiv.org/pdf/1908.10693.pdf
//!
//! # Quick start
//!
//! ```
//! use ddsketchy::DDSketch;
//!
//! let mut sketch = DDSketch::new(0.01).expect("valid alpha");
//! for v in [1.0, 2.0, 3.0, 4.0, 5.0] {
//! sketch.add(v);
//! }
//!
//! // Quantiles are accurate to within `alpha` (1%) relative error.
//! let median = sketch.quantile(0.5).unwrap();
//! assert!((median - 3.0).abs() <= 3.0 * 0.01);
//! assert_eq!(sketch.count(), 5);
//! ```
//!
//! # Features
//!
//! - `serde` — enables `Serialize` / `Deserialize` for [`DDSketch`].
//! - `python` — enables PyO3 bindings (used by the Python wheel build).
//!
//! # More examples
//!
//! See the [`examples/`] directory in the repository for runnable examples,
//! including serialization round-trips and the code snippets shown in the
//! README.
//!
//! [`examples/`]: https://github.com/pmcgleenon/ddsketchy/tree/main/examples
pub use ;