[Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

Christopher Barker Chris.Barker@noaa....
Wed Jan 2 11:32:51 CST 2008


Robert Kern wrote:
> Bruce Sherwood wrote:
>> There is also the question of 
>> whether it would pay for numpy to make what is probably an exceedingly 
>> fast check and do much faster calculations of sqrt(scalar) and other 
>> such mathematical functions.
> 
> There is no question that it would pay. It takes time and effort to implement,
> though.

There is a question of whether it would pay enough to be worth the time 
and effort. For most use (at least most of my use), I'm either working 
with a small number of scalars, and performance is a non-issue, or I"m 
working with arrays of data, and then I need the numpy versions. So I 
really don't see the point of optimizing for scalar arguments.

IIUC, the issue at hand involved not a desire for a faster sqrt(scalar), 
but rather an interaction with C++ code that didn't efficiently deal 
with numpy scalars -- that's a totally different issue, one that may 
have been solved by using math.sqrt() to avoid the numpy scalar, but not 
one that would that provides an argument for cluttering up numpy with 
this sort of special casing.

-Chris






-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov


More information about the Numpy-discussion mailing list