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

Aaron Watters aaron@cs.rutgers.edu
Fri, 05 Jun 1998 12:26:07 -0400


"Inverse of take" reprise.

I can't tell you how often I need this functionality.
Somebody once told me they were working on it.
Any luck?  -- Aaron Watters

Zane Motteler wrote:

> Michel,
>
> 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
> LLNLDistribution/Graphics/Arrayfcns/Src.
> 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
>
> -----------------------------------------------------------------
>                       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
> zcm@llnl.gov
> (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
> _______________