[Numpy-discussion] Subarray with with arbitrary index?
John J. Lee
jjl at pobox.com
Fri Aug 17 09:36:26 EDT 2001
On Thu, 16 Aug 2001, Huaiyu Zhu wrote:
> Hi,
>
> Is it possible to assign to a subarray with arbitrary index?
>
> Suppose I have three arrays
>
> a = arange(8)
> b = array([2, 3, 5])
> c = arange(3)+100
>
> I want a function f, such that calling f(a, b, c) would change a to
>
> [0 1 100 101 4 102 6 7]
f = Numeric.put
f(a, b, c)
put used to be in Python, but it's been in C since some release 17.x.x, I
think.
I have a sinking feeling that I must have missed something (no interpreter
here to check it works)...
BTW, a week ago I noticed that I had reinvented the wheel in rewriting, in
an uglier and less efficient form, Numeric.allclose (hope I got the name
right). As far as I can see, it isn't listed in the manual. Did I miss
it? All it would need is the docstring copying over.
John
More information about the NumPy-Discussion
mailing list