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
//! This library contains tools for <b>simulating</b> space efficient histograms. //! For the purposes of this library, a histogram is a map from labels to //! frequencies, both of which must be numerical. //! //! We provide is a standard histogram implementation ([`StandardHistogram`]) which //! stores label-frequency pairs at face value using a HashMap. //! //! Furthermore, we provide three additional histogram implementations that use either //! strictly less memory than [`StandardHistogram`] or use a fixed amount of memory. The //! optimizations are done across two dimensions, the label storage (referred to as "compaction") //! and the frequency storage (referred to as "compression"). //! Hence the name "C-Squared Histograms". The three implementations are as follows: //! - [`CompressedHistogram`] - This implementation uses strictly less space than a [`StandardHistogram`] //! by approximating the frequencies //! - [`CompactHistogram`] - This implementation consumes a fixed amount of space depending on a few //! precision parameters. It saves space by approximating labels. //! - [`C2Histogram`] - This implementation also utilizes a fixed amount of space, usually much less //! than a CompactHistogram. It approximates both labels and frequencies. //! //! Each of these implementations is parameterized such that the trade-off between precision and //! memory performance is directly controlled by the user. //! //! To construct a [`StandardHistogram`], use the function [`create_standard_histogram`]. Then, //! the other histograms can be derived from that standard histogram using the conversion functions //! [`to_compact`], [`to_compressed`], or [`to_c2`]. //! //! //! [`CompactHistogram`]: c2/struct.CompactHistogram.html //! [`StandardHistogram`]: standard/struct.StandardHistogram.html //! [`create_standard_histogram`]: standard/fn.create_standard_histogram.html //! [`to_compact`]: standard/struct.StandardHistogram.html#method.to_compact //! [`to_compressed`]: standard/struct.StandardHistogram.html#method.to_compressed //! [`to_c2`]: standard/struct.StandardHistogram.html#method.to_c2 //! [`C2Histogram`]: c2/struct.C2Histogram.html //! [`CompressedHistogram`]: c2/struct.CompressedHistogram.html /// General trait definitions and [`StandardHistogram`] implementation /// /// [`StandardHistogram`]: struct.StandardHistogram.html pub mod standard; /// Space saving histogram implementations pub mod c2;