pub fn histogram(
data: &[FloatType],
bins: usize,
) -> Result<(Vec<usize>, Vec<FloatType>)>Expand description
How many of data fall in each of bins equal bins from its least to
its greatest, and the bins’ edges: music21’s histogram. A value on an
edge counts in the bin below it.
use music21_rs::audiosearch::histogram;
let (counts, edges) = histogram(&[1.0, 2.0, 2.0, 3.0, 5.0], 4)?;
assert_eq!(counts, [3, 1, 0, 1]);
assert_eq!(edges, [1.0, 2.0, 3.0, 4.0, 5.0]);§Errors
No data, or no bins.