[PYTHON MATRIX-SIG] RubberIndex
Chris Chase S1A
chris.chase@jhuapl.edu
Tue, 13 Feb 1996 11:36:50 -0500
The implementation should only allow a single '...'. If multiple
rubber indexes are used then an exception should be raised. I could
change Grammar so that multiple '...' causes a syntax error at compile
time.
Think of the rubber index as justifying/aligning the index list within
the shape of the array. Indexes preceding '...' are left-justified
and succeeding indexes are right-justified.
Let P1,P2,..,PM be indexes preceding and S1,S2,..,SL be indexes
succeeding '...' in an index list. If the shape is D1,D2,D3,..,DN-1,DN
for a rank N array, P1,P2,..,PL are left-justified so they are
associated with dimensions D1,D2,..,DL. S1,S2,..,SM are
right-justified so SM -> DN, SM-1 -> DN-1, etc. Any dimension Di not
associated with one of the actual indexes is assumed to be selected
with a ":".
The rubber index is analogous to negative limits for slices. Just as
a negative slice limit (a[0:-2]) is relative to last element in the
sequence without knowing the length apriori, the rubber index '...'
allows one to specify indexes relative to the end of the shape without
knowing the rank apriori.
Any psuedo indexes (specified by NewAxis) are placed relative to the Pi,
Si indexes next to it. Even when the psuedo index is next to a rubber
index there is no ambiguity as it will be placed relative to the
actual indexes to its left or right.
Chris
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================