[Numpy-tickets] [NumPy] #410: setmember1d problem

NumPy numpy-tickets at scipy.net
Mon Jan 1 23:20:06 CST 2007


#410: setmember1d problem
------------------------+---------------------------------------------------
 Reporter:  curiousjan  |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:          
Component:  Other       |     Version:          
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 Please see the attached scripts.
 I am simply comparing two arrays, storing items that appear in both lists.
 I do this by
 a) storing all items from list 1 that are also in list 2
 b) storing all items from list 2 that are also in list 1
 The two resulting arrays should be identical, but they are not.
 A simple fix is

 svn diff numpy/lib
 Index: numpy/lib/arraysetops.py
 ===================================================================
 --- numpy/lib/arraysetops.py    (revision 3491)
 +++ numpy/lib/arraysetops.py    (working copy)
 @@ -126,7 +126,7 @@
      zlike = nm.zeros_like
      ar = nm.concatenate( (ar1, ar2 ) )
      tt = nm.concatenate( (zlike( ar1 ), zlike( ar2 ) + 1) )
 -    perm = ar.argsort()
 +    perm = ar.argsort(kind='mergesort')
      aux = ar[perm]
      aux2 = tt[perm]
  #    flag = ediff1d( aux, 1 ) == 0

-- 
Ticket URL: <http://projects.scipy.org/scipy/numpy/ticket/410>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list