[MATRIX-SIG] reverse of take?
Johann Hibschman <firstname.lastname@example.org>
Thu, 26 Jun 1997 18:07:25 -0700 (PDT)
On Thu, 26 Jun 1997, Andrew P. Mullhaupt wrote:
> Just so. Here's how to do it in S, where z is the huge array,
> and the x values of the indices are in a vector x, similarly
> for y, and v is the vector of corresponding values to assign.
> z[cbind(x, y)] <- v
> This could easily be added to NumPy (along with a couple of other really
> useful forms of indexing). The long history of successful use of the
> highly flexible indexing in S is a 'proof of concept'.
Hmm. Would it be acceptable to define (in a separate extension module)
a function to do this, or do you feel that the built-in syntax is
I haven't done much with the NumPy internals, but I'd think that it would
be almost trivial to write a simple extension to do
multi_set(array, indices, values)
by implementing a C for-loop over the indices. Is there a hidden subtlety
that I'm missing?
Johann A. Hibschman | Grad student in Physics, working in Astronomy.
email@example.com | Probing pulsar pair production processes.
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: firstname.lastname@example.org
administrivia to: email@example.com