Skip to main content

intersect1d

Function intersect1d 

Source
pub fn intersect1d<T: Element>(a: &Array<T>, b: &Array<T>) -> Array<T>
Expand description

Sorted values present in both arrays, like np.intersect1d(a, b).

Inputs are flattened; the result is 1-d, sorted and without duplicates. NaN is never in the intersection (NaN != NaN). return_indices is not supported.

use rustnum as np;
let a = np::array![1, 3, 4, 3];
let b = np::array![3, 1, 2, 1];
assert_eq!(np::intersect1d(&a, &b).to_vec(), vec![1, 3]);