Function information::hist::hist2d
source · [−]pub fn hist2d(
arr_a: &Array1<usize>,
arr_b: &Array1<usize>,
nbins_a: usize,
nbins_b: usize
) -> Result<Array2<usize>>
Expand description
Calculates the event intersection between two integer arrays of equal size
Usage
use ndarray::array;
use information::hist2d;
let arr_a = array![0, 1, 1, 1, 2, 2];
let arr_b = array![1, 0, 0, 1, 2, 3];
let expected = array![
[0, 1, 0, 0],
[2, 1, 0, 0],
[0, 0, 1, 1]
];
let hist = hist2d(&arr_a, &arr_b, 3, 4).unwrap();
assert_eq!(hist.shape(), &[3, 4]);
assert_eq!(hist, expected);