[][src]Struct c2_histograms::standard::StandardHistogram

pub struct StandardHistogram { /* fields omitted */ }

StandardHistogram is a naive implementation of a histogram with no optimizations. It has optimal performance since it stores an exact count for exact labels, but it can take an arbitrary amount of space. It uses a library HashMap to store label-frequency pairs, and can be instantiated with one using the create_standard_histogram function. StandardHistogram is associated with NullParams.

Example

To create, pass a HashMap to the constructor function:

let mut data = HashMap::new();
data.insert(1, 40);
data.insert(3, 15);
data.insert(50, 1);

let histogram :StandardHistogram = create_standard_histogram(data);

Implementations

impl StandardHistogram[src]

pub fn to_compact(&self, cp: &CompactParams) -> Option<CompactHistogram>[src]

If possible, creates a CompactHistogram of this histogram.

Example

use c2_histograms::c2::{CompactHistogram, new_compact_params, CompactParams};

let histogram : StandardHistogram = create_standard_histogram(data);
let cp : CompactParams = new_compact_params(3.5, 8, 8).unwrap();

let compact_histogram : CompactHistogram = histogram.to_compact(&cp).unwrap();

pub fn to_compressed(
    &self,
    cp: &CompressedParams
) -> Option<CompressedHistogram>
[src]

If possible, creates a CompressedHistogram of this histogram.

Example

use c2_histograms::c2::{CompressedHistogram, new_compressed_params, CompressedParams};

let histogram : StandardHistogram = create_standard_histogram(data);
let cp : CompressedParams = new_compressed_params(1.5, 255).unwrap();

let compact_histogram : CompressedHistogram = histogram.to_compressed(&cp).unwrap();

pub fn to_c2(&self, c2p: &C2Params) -> Option<C2Histogram>[src]

If possible, creates a C2Histogram of this histogram

Example

use c2_histograms::c2::{CompactHistogram, new_compact_params, CompactParams, new_c2_params, C2Params, C2Histogram};
use c2_histograms::c2::{CompressedHistogram, new_compressed_params, CompressedParams};

let histogram : StandardHistogram = create_standard_histogram(data);

let cp1 : CompactParams = new_compact_params(3.5, 8, 8).unwrap();
let cp2 : CompressedParams = new_compressed_params(1.5, 255).unwrap();

let cp : C2Params = new_c2_params(cp1, cp2);

let compact_histogram : C2Histogram = histogram.to_c2(&cp).unwrap();

Trait Implementations

impl Histogram<NullParams, usize, usize> for StandardHistogram[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.