[Numpy-discussion] Boolean arrays

Neil Crighton neilcrighton@gmail....
Thu Sep 2 17:02:07 CDT 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 
> in the case of large ar1 but small ar2.  I will do some timing tests and make
> patch.

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


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.


More information about the NumPy-Discussion mailing list