Efficiently find row intersections of two 2-D numpy arrays

后端 未结 3 930
感情败类
感情败类 2021-01-05 16:45

I am trying to figure out an efficient way of finding row intersections of two np.arrays.

Two arrays have the same shapes, and duplicate values in each

3条回答
  •  悲哀的现实
    2021-01-05 17:33

    I can't think of a clean pure-numpy solution, but the following suggestion should speed things up, potentially dramatically:

    1. use numba. It is as simple as decorating your get_intersect1ds function with @autojit
    2. pass assume_unique = True when you call intersect1d

提交回复
热议问题