[Numpy-discussion] optimising single value functions for array calculations

Timmie timmichelsen@gmx-topmail...
Mon Dec 1 07:38:23 CST 2008


Hi,
>
thanks for all your answers. I will certainly test it.
 
> numpy.vectorize(myfunc) should do what you want.

Just to add a better example based on a recent
discussion here on this list [1]:

myfunc(x):
    res = math.sin(x)
    
    return res

a = numpy.arange(1,20)


=> myfunc(a) will not work.
=> myfunc need to have a possibility to pass single
values to math.sin either through interation
(see my inital email) or through other options.


(I know that numpy has a array aware sinus but
wanted to use it as an example here.)

My orriginal problem evolves from here timeseries
computing [2].

Well, I will test and report back further.

Thanks again and until soon,
Timmie

[1]: http://thread.gmane.org/gmane.comp.python.numeric.general/26417/focus=26418
[2]: http://thread.gmane.org/gmane.comp.python.scientific.user/18253



More information about the Numpy-discussion mailing list