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
//! Theta sketch family: cardinality estimation plus set operations (union,
//! intersection, a-not-b) and Jaccard similarity.
//!
//! ```
//! # fn main() -> Result<(), apache_datasketches::SketchError> {
//! use apache_datasketches::theta::ThetaSketchBuilder;
//!
//! let mut sketch = ThetaSketchBuilder::new().lg_k(12).build()?;
//! sketch.update_u64(42);
//! println!("estimate: {}", sketch.get_estimate());
//! # Ok(())
//! # }
//! ```
//!
//! - [`ThetaSketch`] / [`ThetaSketchBuilder`] — the updatable sketch; build
//! with `ThetaSketchBuilder::new().lg_k(..).resize_factor(..).p(..).build()`.
//! - [`CompactThetaSketch`] — an immutable, serializable snapshot produced
//! by `ThetaSketch::compact`, `ThetaUnion::get_result`, or
//! `ThetaIntersection::get_result`.
//! - [`WrappedCompactThetaSketch`] — a zero-copy, read-only view over a
//! serialized compact sketch's bytes, built with
//! `WrappedCompactThetaSketch::wrap`.
//! - [`ThetaUnion`] / [`ThetaUnionBuilder`] — merges multiple sketches.
//! - [`ThetaIntersection`] — computes the intersection of sketches fed via
//! `update`.
//! - [`ThetaAnotB`] — computes the set difference (items in `a` but not
//! `b`).
//! - [`jaccard_similarity`] / [`JaccardBounds`] — estimates the Jaccard
//! index (intersection-over-union) of two sketches.
//!
//! [`ThetaSketch`], [`CompactThetaSketch`], and [`WrappedCompactThetaSketch`]
//! can all be passed interchangeably (via the sealed [`ThetaInput`] trait)
//! to `ThetaUnion::update`, `ThetaIntersection::update`, `ThetaAnotB::compute`,
//! and [`jaccard_similarity`].
pub use ThetaAnotB;
pub use ;
pub use CompactThetaSketch;
pub use ThetaInput;
pub use ThetaIntersection;
pub use ;
pub use ThetaSketch;
pub use ;
pub use WrappedCompactThetaSketch;