-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Implement min(max)imum_filter1d using the MINLIST algorithm #3527
Conversation
Some timings comparing with the code from #3517:
|
The code is basically a transcription of this: http://www.richardhartersworld.com/cri/2001/slidingmin.html The original algorithm was first published (AFAIK) by S.C. Douglas: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.42.2777 |
|
@jaimefrio on the mailing list you got one response, favoring a switch and a doc update. The latter is missing. Not totally sure about the former, this PR seems to say you don't think a switch is needed? |
108a54c
to
5b8f87a
Compare
I have made the code a little more compact, and fixed #3898, but performance is unchanged from the above benchmarks: a little slower for the general case than the current algorithm, but with guaranteed worst case performance that could be over an order of magnitude faster than the current one. The new algorithm is the same used in bottleneck and pandas, so it is tried and tested. I have added tests, both regression and some general ones, as there did not seem to be any at all. |
This PR implements the minimum_filter1d and maximum_filter1d functions using Richard Harter's implementation of the MINLIST algorithm. While slower (~30%) than the MINLINE algorithm currently in place for random inputs, its performance is consistent for all inputs, and is much faster for long, ordered seqeunces.
5b8f87a
to
598c922
Compare
There were no objections on the mailing list for choosing this algorithm, so I'm inclined to merge this by tomorrow. The performance trade-off seems very reasonable. |
Rebased (had merge conflict with threading change from Julian) and merged in fdddfc3. Thanks Jaime! |
The Travis build on Python 3.4 is now failing to build. See the first Travis job at #4003 and #4004. The error is
The relevant code in
The compiler doesn't like |
I think it was the rebasing with Julian's GIL release code that messed things up, as the declaration of the |
This PR implements the minimum_filter1d and maximum_filter1d functions
using Richard Harter's implementation of the MINLIST algorithm. While
slower (~30%) than the MINLINE algorithm currently in place for random
inputs, its performance is consistent for all inputs.