[PYTHON MATRIX-SIG] Functions and names

Konrad HINSEN hinsenk@ere.umontreal.ca
Mon, 26 Feb 1996 16:34:55 -0500


   One only needs slices.  The insertion functionality I suggested only
   requires one to specify the starting position.  Normally, the user
   would have to compute the slice ending position and check to see if
   the input array will fit (if not the input array could be sliced to
   fit). I was suggesting a insertion function that would handle options
   of wrap-around versus truncation versus just error signaling.  It is
   very convenient for manipulating block regions of arrays (like placing
   one image inside another image).  Perhaps a better name than "insert"
   would be "place"?

I see. That looks indeed useful; I remember having once written an
APL function to do more or less the same.

It is however not so easy to find a nice syntax for this. Right now
all operations that change array elements are assignments, and I'd
like to keep it that way. One possibility would be to allow somthing
like this:
   a = array([1,2,3,4,5,6])
   b = array([0,0])
   a[2] = b
with the result
   a == array([1,2,0,0,5,6])
I just don't like the error checking that gets lost in the process.
Maybe the alternative
   a[2::] = b
(assignment of a vector that is too short) would be a lesser evil.

-------------------------------------------------------------------------------
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. Centre-Ville     | 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
=================