title: Get intersecting (common) indexes across two 2D (or 3D) numpy arrays
body: <p>I have data from two different catalogs, I want to use the coordinates to match those two catalogs. The data I have is <code>x1,y1,z1,a1,b1,c1,etc</code> (about half million elements) from catalog 1, and <code>x2,y2,z2,a2,e2,m2,n2,etc</code> (about million elements) from catalog 2. What I am trying to do is first to construct a 2D array which contains (x,y) coordinates, if necessary I will extend to (x,y,z), and compare the 2D arrays to find the same elements.  </p>
  
  <pre><code>co1 = np.vstack((x1,y1)).T
  co2 = np.vstack((x2,y2)).T
  
  idx1 = np.in1d(co1,co2)   # not working for 2D arrays
  idx2 = np.in1d(co2,co1)
  
  np.savetxt('combined_data.txt',np.c_[x1[idx1],y1[idx1],a1[idx1],e2[idx2],n2[idx2]],fmt='%1.4f   %1.4f   %1.4f   %1.4f   %1.4f')
  </code></pre>
  
  <p>For example, I have the following dataset:</p>
  
  <pre><code>x1 = np.array([1,2,3,4,5])
  y1 = np.array([5,4,3,2,1])
  x2 = np.array([1,4,6,2,6,4,8,9,3])
  y2 = np.array([5,1,5,3,6,2,8,3,3])
  
  (1,5), (3,3), (4,2) are the common coordinates between the two catalogs. Therefore,
  
  idx1 = [Ture, False, True, True, False], idx2 = [True, False, False, False, False, True, False, False, True]. 
  </code></pre>
  
  <p>But the problem is that <code>np.in1d</code> is a 1D routine, it can not be applied to 2D or 3D arrays. Anyone knows some numpy routines to accomplish this task? </p>