Your question is hard to understand because it contains extraneous information and contains typos. If I understand correctly, you just need an effective way to perform a dial operation on the lines of a 2D array (in this case, the intersection of the lines K and f(K) ).
You can do this with numpy.in1d if you create a structured array.
code:
if it is K :
In [50]: k Out[50]: array([[6, 6], [3, 7], [7, 5], [7, 3], [1, 3], [1, 5], [7, 6], [3, 8], [6, 1], [6, 0]])
and this is f(K) (for this example, I subtract 1 from the first column and add 1 to the second):
In [51]: k2 Out[51]: array([[5, 7], [2, 8], [6, 6], [6, 4], [0, 4], [0, 6], [6, 7], [2, 9], [5, 2], [5, 1]])
you can find all lines in K also found in f(K) by doing something like the following:
In [55]: k[np.in1d(k.view(dtype='i,i').reshape(k.shape[0]),k2.view(dtype='i,i'). reshape(k2.shape[0]))] Out[55]: array([[6, 6]])
view and reshape create flat structured views so that each row is displayed as one element in in1d . in1d creates a logical index K matching elements, which is used to display the index K and returns a filtered array.