
John is right:
a=Numeric.arange(8) b=Numeric.array([2,3,5]) c=Numeric.arange(3)+100 Numeric.put(a,b,c) print a [ 0 1 100 101 4 102 6 7]
Thanks for pointing out that I had left allclose out of the Numeric part of the manual. I did it in the MA part and then forgot. I'm fixing it now. BTW: There are changenotes at source forge that are sometimes ahead of the manual. -----Original Message----- From: numpy-discussion-admin@lists.sourceforge.net [mailto:numpy-discussion-admin@lists.sourceforge.net]On Behalf Of John J. Lee Sent: Friday, August 17, 2001 6:36 AM To: Huaiyu Zhu Cc: numpy-discussion@lists.sourceforge.net Subject: Re: [Numpy-discussion] Subarray with with arbitrary index? 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 _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net http://lists.sourceforge.net/lists/listinfo/numpy-discussion