[PYTHON MATRIX-SIG] take() in 1.0a2 (longish, sorry)

Konrad Hinsen hinsen@physik.rwth-aachen.de
Sun, 18 Aug 1996 10:10:59 +0200


   I.e., when take is given a 2 dimensional indices array, it adds yet
   another dimension to a. This should not happen if take(a,argsort(a,-1),-1) 

I hope that this intentional, since it is a very useful function
for the construction of higher-rank arrays.

   is to be equivalent to sort(a,-1). Note that, in the example above,

If sort(a,-1) is what you want, then that is what you should write.
take() is meant for different (and much more diverse) applications,
and I don't see a reason to limit its flexibility just to create
a less efficient synonym for sort().

My definition for take(), using the convenient J concepts of
frames and cells, would be: the result has the frames of the
index argument with elements picked from the value argument,
i.e. if
   b = take(a, i, axis)
then
   b[n_1,..,n_k] = a[(axis-1)*(All,), i[n_1,..,n_k], ...]
with k being the rank of i.

Konrad.

-- 
-------------------------------------------------------------------------------
Konrad Hinsen                     | E-Mail: hinsenk@ere.umontreal.ca
Departement de Chimie             | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal            | Fax:  +1-514-343-7586
C.P. 6128, succ. A                | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7             | Francais (phase experimentale)
-------------------------------------------------------------------------------

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

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