pub struct Histogram<A: Ord> { /* private fields */ }
Expand description

Histogram data structure.

Implementations

Returns a new instance of Histogram given a Grid.

Adds a single observation to the histogram.

Panics if dimensions do not match: self.ndim() != observation.len().

Example:
use ndarray::array;
use ndarray_stats::histogram::{Edges, Bins, Histogram, Grid};
use noisy_float::types::n64;

let edges = Edges::from(vec![n64(-1.), n64(0.), n64(1.)]);
let bins = Bins::new(edges);
let square_grid = Grid::from(vec![bins.clone(), bins.clone()]);
let mut histogram = Histogram::new(square_grid);

let observation = array![n64(0.5), n64(0.6)];

histogram.add_observation(&observation)?;

let histogram_matrix = histogram.counts();
let expected = array![
    [0, 0],
    [0, 1],
];
assert_eq!(histogram_matrix, expected.into_dyn());

Returns the number of dimensions of the space the histogram is covering.

Borrows a view on the histogram counts matrix.

Borrows an immutable reference to the histogram grid.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.