Re: [Numpy-discussion] Implementing a find first style function

2013-03-28 Thread Phil Elson
I've specifically not tuned it, primarily because the get the best tuning you need to know the likelihood of finding a match. One option would be to allow users to specify a probability parameter which would chunk the array into size*probability chunks - an additional parameter could then be

Re: [Numpy-discussion] Implementing a find first style function

2013-03-27 Thread Nathaniel Smith
On Tue, Mar 26, 2013 at 9:20 AM, Phil Elson pelson@gmail.com wrote: Bump. I'd be interested to know if this is a desirable feature for numpy? (specifically the 1D find functionality rather than the any/all also discussed) If so, I'd be more than happy to submit a PR, but I don't want to

Re: [Numpy-discussion] Implementing a find first style function

2013-03-26 Thread Phil Elson
Bump. I'd be interested to know if this is a desirable feature for numpy? (specifically the 1D find functionality rather than the any/all also discussed) If so, I'd be more than happy to submit a PR, but I don't want to put in the effort if the principle isn't desirable in the core of numpy.

Re: [Numpy-discussion] Implementing a find first style function

2013-03-08 Thread Phil Elson
Interesting. I hadn't thought of those. I've implemented (very roughly without a sound logic check) and benchmarked: def my_any(a, predicate, chunk_size=2048): try: next(find(a, predicate, chunk_size)) return True except StopIteration: return False def my_all(a,

Re: [Numpy-discussion] Implementing a find first style function

2013-03-06 Thread Benjamin Root
On Tue, Mar 5, 2013 at 9:15 AM, Phil Elson pelson@gmail.com wrote: The ticket https://github.com/numpy/numpy/issues/2269 discusses the possibility of implementing a find first style function which can optimise the process of finding the first value(s) which match a predicate in a given 1D

[Numpy-discussion] Implementing a find first style function

2013-03-05 Thread Phil Elson
The ticket https://github.com/numpy/numpy/issues/2269 discusses the possibility of implementing a find first style function which can optimise the process of finding the first value(s) which match a predicate in a given 1D array. For example: a = np.sin(np.linspace(0, np.pi, 200)) print