[PYTHON MATRIX-SIG] Standard Numerical Library

Carlos Fonseca fonseca@gaivota.demon.co.uk
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.

Carlos Fonseca


=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================