[Numpy-discussion] Re: Bypassing a[2].item()?

Ryan Gutenkunst rng7 at cornell.edu
Thu Apr 20 15:21:11 EDT 2006


On Apr 20, 2006, at 5:18 PM, Robert Kern wrote:
> Ryan Gutenkunst wrote:
>
>> So questions:
>> 1) I haven't followed the details of the array scalar discussions. Is 
>> it
>> anticipated that array scalar arithmetic will eventually be as fast as
>> arithmetic in native python types?
>
> More or less, if I'm not mistaken. This ticket is aimed at that:
>
>   http://projects.scipy.org/scipy/numpy/ticket/55

Good to hear.

>> 2) If not, is it possible to get a "pure" scalar directly from an 
>> array
>> in one function call?
>
> float(x[0]) seems to be faster on my PowerBook.

It's faster for me, too, but float(x[0]) is still much slower than 
using Numeric where x[0] suffices. I guess I'll just have to warn my 
users away from the new scipy until numpy 0.9.8 comes out and scalar 
math is sped up.

Cheers,
Ryan

-- 
Ryan Gutenkunst               |
Cornell Dept. of Physics      |       "It is not the mountain
                               |        we conquer but ourselves."
Clark 535 / (607)255-6068     |        -- Sir Edmund Hillary
AIM: JepettoRNG               |
          http://www.physics.cornell.edu/~rgutenkunst/





More information about the NumPy-Discussion mailing list