[Matrix-SIG] [PSA MEMBERS] Numeric Python Set function

Paul F. Dubois Paul F. Dubois" <dubois1@llnl.gov
Fri, 5 Jun 1998 08:51:05 -0700

Since it is nice to have a positive answer to a question, I want to make
sure Zane's answer reaches the matrix-sig. Please excuse if you already saw

Is this function, or others in arrayfns, something we should move into NumPy
proper? I think array_set does sound like an important function.

-----Original Message-----
From: Zane Motteler <zcm@llnl.gov>
To: Michel Sanner <sanner@scripps.edu>
Cc: psa-members@python.org <psa-members@python.org>
Date: Friday, June 05, 1998 7:23 AM
Subject: Re: [PSA MEMBERS] Numeric Python Set function

>You wrote:
>>I was wondering if there is something like a "set" function in
>>Numeric Python that would allow to set values in an array given
>>an array of indices and an array of values. (somehow the same
>>operation as take() but to set values).
>Not in numeric python. However, when I was writing the PyGist
>graphics interface, I found the need for such a function.
>I wrote a module called 'arrayfnsmodule' which contains a
>function array_set which takes three arguments: the first
>is a one-dimensional array, the second is a one-dimensional
>array of valid subscripts into the first, and the third
>is either a scalar or an array of the same length as the
>second argument, to be assigned to the specified places in
>the first array.
>This module and all others for which we are responsible at LLNL
>can be found at our anonymous ftp site, ftp-icf.llnl.gov,
>at /ftp/pub/python/LLNLPython1.tgz. If you gunzip and untar
>this file, the source is found in
>You can build a shared object for this module (and others in
>the Graphics subdirectory) by moving Makefile.pre.in from
>Python-1.5.1/Misc to Graphics, and then typing 'python makethis.py'.
>Hope this helps.
>                      Zane C. Motteler, Ph. D.
>Computer Scientist             | Professor Emeritus of
>Lawrence Livermore National    |    Computer Science and Engineering
>   Laboratory                  | California Polytechnic
>P. O. Box 808, L-038           |    State University
>Livermore, CA 94551-9900       | San Luis Obispo, CA 93407
>925/423-2143, FAX 925/423-9208 | zmottel@phoenix.csc.calpoly.edu
>(For FedEx, UPS, etc. use street address 7000 East Avenue, zip 94550)
>PSA-MEMBERS  --  Python Software Activity Members
>send messages to: psa-members@python.org
>administrivia to: psa-members-request@python.org