Re: [Numpy-discussion] A better median function?

2009-08-25 Thread Chad Netzer
I've made some progress on this, building the tools for a faster median(). I was able to fairly easily make both nth_element() and partial_sort() types of functions by modifying numpy's quicksort, however I wasn't that happy with their API from a python/numpy point of view. My current plan of

Re: [Numpy-discussion] A better median function?

2009-08-25 Thread Sturla Molden
Chad Netzer skrev: My current plan of attack is to deliver a partition() function that basically returns an array such that elements less than the pivot(s) come first, then the pivot(s), then the elements greater than the pivot(s). I'm actually trying to write a fast median replacement

Re: [Numpy-discussion] A better median function?

2009-08-22 Thread Chad Netzer
The good news is that it was trivial to adapt numpy/core/src/_sortmodule.c.src:quicksort() to do a quickselect(). When I'm back home I'll follow up with discussion on how (if it all) to expose this to numpy.median() or numpy in general. -Chad ___

[Numpy-discussion] A better median function?

2009-08-21 Thread Mike Ressler
I presented this during a lightning talk at the scipy conference yesterday, so again, at the risk of painting myself as a flaming idiot: - Wanted: A Better/Faster median() Function numpy implementation uses simple sorting algorithm: Sort all the data using the .sort() method

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread David Goldsmith
, 8/21/09, Mike Ressler mike.ress...@alum.mit.edu wrote: From: Mike Ressler mike.ress...@alum.mit.edu Subject: [Numpy-discussion] A better median function? To: Discussion of Numerical Python numpy-discussion@scipy.org Date: Friday, August 21, 2009, 8:47 AM I presented this during a lightning

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread David Goldsmith
Ouch, didn't check my to address first, sorry!!! DG --- On Fri, 8/21/09, David Goldsmith d_l_goldsm...@yahoo.com wrote: From: David Goldsmith d_l_goldsm...@yahoo.com Subject: Re: [Numpy-discussion] A better median function? To: Discussion of Numerical Python numpy-discussion@scipy.org Date

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Chad Netzer
On Fri, Aug 21, 2009 at 8:47 AM, Mike Resslermike.ress...@alum.mit.edu wrote: I presented this during a lightning talk at the scipy conference yesterday, so again, at the risk of painting myself as a flaming idiot: - Wanted: A Better/Faster median() Function numpy

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Matthew Brett
Hi, Nicolas Devillard discusses several algorithms at http://ndevilla.free.fr/median/median/index.html Thanks for this. A loud 'yes' from the back of the internet too. I contacted Nicolas Devillard a year or so ago to ask him if we could include his code in Scipy, and he said 'yes'. I can

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Mike Ressler
Hi, On Fri, Aug 21, 2009 at 11:33 AM, Matthew Brettmatthew.br...@gmail.com wrote: Nicolas investigated algorithms that find the lower (or upper) median value.  The lower median is the median iff there are an odd number of entries in our list, or the lower of the central values in the sort,

Re: [Numpy-discussion] A better median function?

2009-08-21 Thread Matthew Brett
On Fri, Aug 21, 2009 at 11:33 AM, Matthew Brettmatthew.br...@gmail.com wrote: Nicolas investigated algorithms that find the lower (or upper) median value.  The lower median is the median iff there are an odd number of entries in our list, or the lower of the central values in the sort, when