[Numpy-discussion] New functions.
Benjamin Root
ben.root at ou.edu
Tue May 31 21:48:54 EDT 2011
On Tue, May 31, 2011 at 8:26 PM, Charles R Harris <charlesr.harris at gmail.com
> wrote:
>
>
> On Tue, May 31, 2011 at 7:18 PM, Warren Weckesser <
> warren.weckesser at enthought.com> wrote:
>
>>
>>
>> On Tue, May 31, 2011 at 8:08 PM, Charles R Harris <
>> charlesr.harris at gmail.com> wrote:
>>
>>> Hi All,
>>>
>>> I've been contemplating new functions that could be added to numpy and
>>> thought I'd run them by folks to see if there is any interest.
>>>
>>> 1) Modified sort/argsort functions that return the maximum k values.
>>> This is easy to do with heapsort and almost as easy with mergesort.
>>>
>>>
>>
>> While you're at, how about a function that finds both the max and min in
>> one pass? (Mentioned previously in this thread:
>> http://mail.scipy.org/pipermail/numpy-discussion/2010-June/051072.html)
>>
>>
> What should it be called? minmax?
>
That's what it is called in IDL. Don't know of any other tool that does
anything similar.
>
> This also brings suggests a function that returns both mean and standard
> deviation, something that could also be implemented using a more stable
> algorithm than the current one.
>
Yeah, it does. An implementation I did once for a project of mine in Matlab
was to have a function that took an index that indicated that I wanted
first/second/third/etc - order moments and it used that to figure out that
it needed to save the sum, sum of squares, sum of cubes, etc. in order to
calculate the mean, std, kurtosis, and so on. Just a suggestion on how to
implement a useful function for stats. Of course, there are all sorts of
issues with summation here, but my arrays were small enough to not worry in
that project.
Ben Root
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110531/e4621019/attachment.html>
More information about the NumPy-Discussion
mailing list