[SciPy-dev] ANN: arraysetops added to numpy.lib

Robert Cimrman cimrman3 at ntc.zcu.cz
Mon Jan 9 06:42:38 CST 2006

Dear developers, 'arraysetops' was just transfered from the 
scipy.sandbox to numpy.lib (with blessings of the great TEO). You can 
now try and test this module in numpy proper. It is the initial release, 
so expect the usual amount of bugs.

What is it?

1D array set operations
Set operations for 1D numeric arrays based on sort() function.

ediff1d          --  Array difference (auxiliary function).
unique1d         --  Unique elements of 1D array.
intersect1d      --  Intersection of 1D arrays with unique elements.
intersect1d_nu   --  Intersection of 1D arrays with any elements.
setxor1d         --  Set exclusive-or of 1D arrays with unique elements.
setmember1d      --  Return an array of shape of ar1 containing 1 where
                      the elements of ar1 are in ar2 and 0 otherwise.
union1d          --  Union of 1D arrays with unique elements.
setdiff1d        --  Set difference of 1D arrays with unique elements.


1. speed - e.g. unique1d() is about 30 times faster than the standard 
dictionary-based unique(); try the code below

import numpy.lib.arraysetops as aset
aset.test_unique1d_speed( plotResults = False ) # set to True if you 
have pylab

2. added functions present in other popular environments (matlab, ...) 
but missing in scipy


More information about the Scipy-dev mailing list