apache_datasketches/tuple/mod.rs
1//! ArrayOfDoubles Tuple sketch family: cardinality estimation where each
2//! retained key also carries a fixed-width array of `f64` values, summed on
3//! collision.
4//!
5//! ```
6//! # fn main() -> Result<(), apache_datasketches::SketchError> {
7//! use apache_datasketches::tuple::ArrayOfDoublesSketchBuilder;
8//!
9//! let mut sketch = ArrayOfDoublesSketchBuilder::new().num_values(2).build()?;
10//! sketch.update_u64(42, &[1.0, 2.5])?;
11//! println!("estimate: {}", sketch.get_estimate());
12//! # Ok(())
13//! # }
14//! ```
15//!
16//! - [`ArrayOfDoublesSketch`] / [`ArrayOfDoublesSketchBuilder`] — the
17//! updatable sketch.
18//! - [`CompactArrayOfDoublesSketch`] — an immutable, serializable snapshot
19//! produced by `ArrayOfDoublesSketch::compact` or by a set operation's
20//! result.
21//! - [`ArrayOfDoublesUnion`] / [`ArrayOfDoublesUnionBuilder`] — merges
22//! multiple sketches, summing values per index on collision.
23//! - [`ArrayOfDoublesIntersection`] — computes the intersection of sketches
24//! fed via `update`, summing values per index.
25//! - [`ArrayOfDoublesAnotB`] — computes the set difference (keys in `a` but
26//! not `b`), preserving `a`'s values.
27//! - [`array_of_doubles_jaccard_similarity`] / [`JaccardBounds`] — estimates
28//! the Jaccard index (intersection-over-union) of two sketches.
29//! - [`generic`] — Tuple sketches over a summary type you define yourself,
30//! for cases the fixed `f64`-array shape above does not cover.
31//!
32//! [`ArrayOfDoublesSketch`] and [`CompactArrayOfDoublesSketch`] can both be
33//! passed interchangeably (via the sealed [`ArrayOfDoublesInput`] trait) to
34//! every set operation in this module.
35
36mod a_not_b;
37mod builder;
38mod compact;
39pub mod generic;
40mod input;
41mod intersection;
42mod jaccard;
43mod sketch;
44mod union;
45
46pub use a_not_b::ArrayOfDoublesAnotB;
47pub use builder::{ArrayOfDoublesSketchBuilder, ResizeFactor};
48pub use compact::CompactArrayOfDoublesSketch;
49pub use input::ArrayOfDoublesInput;
50pub use intersection::ArrayOfDoublesIntersection;
51pub use jaccard::{array_of_doubles_jaccard_similarity, JaccardBounds};
52pub use sketch::ArrayOfDoublesSketch;
53pub use union::{ArrayOfDoublesUnion, ArrayOfDoublesUnionBuilder};