[Numpy-svn] r4631 - in branches/cleanconfig_rtm: . numpy/lib numpy/lib/tests

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Dec 22 01:58:23 EST 2007


Author: cdavid
Date: 2007-12-22 00:58:15 -0600 (Sat, 22 Dec 2007)
New Revision: 4631

Modified:
   branches/cleanconfig_rtm/
   branches/cleanconfig_rtm/numpy/lib/arraysetops.py
   branches/cleanconfig_rtm/numpy/lib/tests/test_arraysetops.py
Log:
Merged revisions 4612-4630 via svnmerge from 
http://svn.scipy.org/svn/numpy/trunk

........
  r4620 | cdavid | 2007-12-18 19:41:22 +0900 (Tue, 18 Dec 2007) | 3 lines
  
  Initialized merge tracking via "svnmerge" with revisions "1-4619" from 
  http://svn.scipy.org/svn/numpy/branches/distutils_scons_command
........
  r4624 | rc | 2007-12-20 19:30:45 +0900 (Thu, 20 Dec 2007) | 2 lines
  
  fixed setmember1d for string arrays
........
  r4626 | stefan | 2007-12-21 18:00:24 +0900 (Fri, 21 Dec 2007) | 2 lines
  
  Add test for setdiff1d on character arrays.
........



Property changes on: branches/cleanconfig_rtm
___________________________________________________________________
Name: svnmerge-integrated
   - /branches/distutils-revamp:1-2752 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /trunk:1-4611
   + /branches/cleanconfig_rtm:1-4610 /branches/distutils-revamp:1-2752 /branches/distutils_scons_command:1-4619 /branches/multicore:1-3687 /branches/numpy.scons:1-4484 /trunk:1-2871

Modified: branches/cleanconfig_rtm/numpy/lib/arraysetops.py
===================================================================
--- branches/cleanconfig_rtm/numpy/lib/arraysetops.py	2007-12-22 06:28:11 UTC (rev 4630)
+++ branches/cleanconfig_rtm/numpy/lib/arraysetops.py	2007-12-22 06:58:15 UTC (rev 4631)
@@ -201,9 +201,13 @@
       numpy.lib.arraysetops has a number of other functions for performing set
       operations on arrays.
     """
-    zlike = nm.zeros_like
+    ar1 = nm.asarray( ar1 )
+    ar2 = nm.asarray( ar2 )
     ar = nm.concatenate( (ar1, ar2 ) )
-    tt = nm.concatenate( (zlike( ar1 ), zlike( ar2 ) + 1) )
+    b1 = nm.zeros( ar1.shape, dtype = nm.int8 )
+    b2 = nm.ones( ar2.shape, dtype = nm.int8 )
+    tt = nm.concatenate( (b1, b2) )
+        
     # We need this to be a stable sort, so always use 'mergesort' here. The
     # values from the first array should always come before the values from the
     # second array.
@@ -212,7 +216,6 @@
     aux2 = tt[perm]
 #    flag = ediff1d( aux, 1 ) == 0
     flag = nm.concatenate( (aux[1:] == aux[:-1], [False] ) )
-
     ii = nm.where( flag * aux2 )[0]
     aux = perm[ii+1]
     perm[ii+1] = perm[ii]

Modified: branches/cleanconfig_rtm/numpy/lib/tests/test_arraysetops.py
===================================================================
--- branches/cleanconfig_rtm/numpy/lib/tests/test_arraysetops.py	2007-12-22 06:28:11 UTC (rev 4630)
+++ branches/cleanconfig_rtm/numpy/lib/tests/test_arraysetops.py	2007-12-22 06:58:15 UTC (rev 4631)
@@ -145,6 +145,10 @@
 
         assert_array_equal([], setdiff1d([],[]))
 
+    def check_setdiff1d_char_array(self):
+        a = numpy.array(['a','b','c'])
+        b = numpy.array(['a','b','s'])
+        assert_array_equal(setdiff1d(a,b),numpy.array(['c']))
 
     ##
     # 03.11.2005, c




More information about the Numpy-svn mailing list