[Numpy-discussion] Boolean arrays

Neil Crighton neilcrighton at gmail.com
Thu Sep 2 18:02:07 EDT 2010


> 
> Ideally, I would like in1d to always be the right answer to this problem. It 
> should be easy to put in an if statement to switch to a kern_in()-type 
function  
> in the case of large ar1 but small ar2.  I will do some timing tests and make
 a 
> patch.
> 

I uploaded a timing test and a patch to arraysetops.py here:

http://projects.scipy.org/numpy/ticket/1603

The new in1d() uses the kern_in algorithm when it's faster, and the existing 
algorithm otherwise. The speedup compared to the old in1d() for cases with very 
large ar1 and small ar2 can be up to 10x on my laptop.

If someone with commit access could take a look and and apply it if ok, that 
would be great.

Thanks,
Neil








More information about the NumPy-Discussion mailing list