[PYTHON MATRIX-SIG] Default axis
Carlos Fonseca
Carlos Fonseca <fonseca@gaivota.demon.co.uk>
Mon, 12 Aug 1996 20:36:38 +0100 (BST)
On Sun, 11 Aug 1996, Jim Hugunin wrote:
> ...
> My only problem with this is the concatenation function which I
> personally think should only be implemented along axis 0, though I've
> been convinced this is too limiting. Having this default to a different
Being able to cleanly concatenate arrays along other axes would indeed be
useful. Otherwise, we'll end up transposing the concatenation of
transposed arrays sooner or later.
> Having this default to a different axis than 0 really bothers me, but
> I suppose I'll get over it.
>
> Comments are welcome - Jim
Concatenation does seem to be a special case, and there may a reason to
make it the exception. For example,
>>> a
0 1 2 3
4 5 6 7
8 9 10 11
>>> b
0 1 2 3
Since these arrays are aligned in the usual sense (a+b would work),
one would expect concatenate((a,b)) to work by default. This means
axis=0. What do others think?
Actually, the above would not work in the present implementation if
b.shape=(4,), but one would have to write concatenate((a,b[NewAxis,:])).
Should it be so or should the new axis be prepended automatically? Along
the same lines, shouldn't axes with a single element be "broadcast" as for
addition?
Carlos
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================