title: numpy in1d returning incorrect results?
body: <p>I have a weird issue happening with numpy's in1d function.  I have two arrays of integer values representing particle IDs say A &amp; B (IDs are unique to each particle).  Array A contains a list of all the particles, and array B contains a list of all particles that belong to a group (all particles in B are also in A).  What I'm trying to get at is the index of all grouped particles in array A, but for some reason numpy's in1d is not returning the correct results.  Here is an example:</p>
  
  <pre><code>A = all particle IDs (length of 54480)
  B = all grouped particle IDs (length of 48061)
  </code></pre>
  
  <p>A brute force search shows that all particle IDs within B do reside in A.  I can also do:</p>
  
  <pre><code>matches = np.in1d(B,A)
  print len(np.where(matches==True)[0])
  &gt;&gt; 48061
  </code></pre>
  
  <p>to verify that that all elements of B are present in A.  Now the odd part is if I do</p>
  
  <pre><code>matches = np.in1d(A,B)
  print len(np.where(matches==True)[0])
  &gt;&gt; 35590
  </code></pre>
  
  <p>I get something unexpected.  Shouldn't this return 48061 True and 6419 False?  I've uploaded <a href="https://dl.dropboxusercontent.com/u/6920345/A.txt" rel="nofollow">A.txt</a> and <a href="https://dl.dropboxusercontent.com/u/6920345/B.txt" rel="nofollow">B.txt</a> to my dropbox if anyone wants to mess with this dataset (~300K each).  Thanks in advance for any help you can provide!</p>
  
  <p>edit: I should also mention that I need the returned bool array to be unsorted so numpy's intersect is out of the question.</p>