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

Robert Kern robert.kern at gmail.com
Thu Apr 20 16:22:09 CDT 2006


Ryan Gutenkunst wrote:
> On Apr 20, 2006, at 5:18 PM, Robert Kern wrote:
> 
>> Ryan Gutenkunst wrote:

>>> 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.

For that matter, a plain "x[0]" seems to be about 3x faster with Numeric than numpy.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco





More information about the Numpy-discussion mailing list