[Numpy-discussion] Avoiding array-scalar arithmetic?
rng7 at cornell.edu
Thu Sep 14 17:15:15 CDT 2006
Travis Oliphant wrote:
> Ryan Gutenkunst wrote:
>> I notice that numpy_array.item() will give me the first element as a
>> normal scalar. Would it be possible for numpy_array.item(N) to return
>> the Nth element of the array as a normal scalar?
> Now this is an interesting idea. It would allow you to by-pass the
> slow-indexing as well as the array scalar computation should you desire
> it. I like it and am going to add it unless there are convincing
Thanks for the quick response, but either there's a bug, or I'm using
things wrong. It appears to work to work in the N-D case, but not 1-D. I
looked at the change you made, but my grasp of the C-API is too weak to
isolate the problem.
>>> import numpy
>>> a = numpy.array([[1.0, 2.0], [3.0, 4.0]])
>>> a = numpy.array([1.0, 2.0])
Thanks for your help,
Ryan Gutenkunst |
Cornell LASSP | "It is not the mountain
| we conquer but ourselves."
Clark 535 / (607)227-7914 | -- Sir Edmund Hillary
AIM: JepettoRNG |
More information about the Numpy-discussion