[PYTHON MATRIX-SIG] Standard Numerical Library
Sat, 10 Aug 1996 19:15:35 +0100 (BST)
On 10 Aug 1996, Janne Sinkkonen wrote:
> Is there a function returning the index of a minimum or a
> maximum? This would be nice in some ANN applications, although I don't
> know whether it is generally useful enough to be a standard part of
> the language.
I find functions like max(), min(), and sort() (fun() for short) more
limited than the corresponding argfun(), simply because the former could
always be writen as take(a,argfun(a)).
Unfortunately, the indices argument of take() used to have to be
one-dimensional, so the above would not work for a two dimensional array.
Has this changed in the new release? A version of take() such that:
take(a,argsort(a,axis),axis) = sort(a,axis)
for arrays of arbitrary shape would be very, very useful. Ideally, it
should also follow the same rules as +, *, etc when "a" or "indices" have
dimensions of length one. Even if implementing this functionality is not a
priority at this stage, making axis in take() default to -1 would allow
for it to be implemented later without breaking any code in the future.
I guess I should try to write a new version of take() in Python first,
and then see if others could use this functionality.
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: email@example.com
administrivia to: firstname.lastname@example.org