cupy.intersect1d#
- cupy.intersect1d(arr1, arr2, assume_unique=False, return_indices=False)[source]#
Find the intersection of two arrays. Returns the sorted, unique values that are in both of the input arrays.
- Parameters:
arr1 (cupy.ndarray) – Input arrays. Arrays will be flattened if they are not in 1D.
arr2 (cupy.ndarray) – Input arrays. Arrays will be flattened if they are not in 1D.
assume_unique (bool) – By default, False. If set True, the input arrays will be assumed to be unique, which speeds up the calculation. If set True, but the arrays are not unique, incorrect results and out-of-bounds indices could result.
return_indices (bool) – By default, False. If True, the indices which correspond to the intersection of the two arrays are returned.
- Returns:
intersect1d (cupy.ndarray) – Sorted 1D array of common and unique elements.
comm1 (cupy.ndarray) – The indices of the first occurrences of the common values in arr1. Only provided if return_indices is True.
comm2 (cupy.ndarray) – The indices of the first occurrences of the common values in arr2. Only provided if return_indices is True.
See also