[Numpy-discussion] optimising single value functions for array calculations
Mon Dec 1 04:37:25 CST 2008
I does not solve the slowness problem. I think I read on the list about an experimental code for fast vectorization.
מאת: email@example.com בשם Emmanuelle Gouillart
נשלח: ב 01-דצמבר-08 12:28
אל: Discussion of Numerical Python
נושא: Re: [Numpy-discussion] optimising single value functions for array calculations
numpy.vectorize(myfunc) should do what you want.
> I am developing a module which bases its calculations
> on another specialised module.
> My module uses numpy arrays a lot.
> The problem is that the other module I am building
> upon, does not work with (whole) arrays but with
> single values.
> Therefore, I am currently forces to loop over the
> a = numpy.arange(100)
> b = numpy.arange(100,200)
> for i in range(0,a.size):
> a[i] = myfunc(a[i])* b[i]
> The results come out well. But the problem is that this
> way of calculation is very ineffiecent and takes time.
> May anyone give me a hint on how I can improve my
> code without having to modify the package I am
> building upon. I do not want to change it a lot because
> I would always have to run behind the chnages in the
> other package.
> To summarise:
> How to I make a calculation function array-aware?
> Thanks in advance,
> Numpy-discussion mailing list
Numpy-discussion mailing list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 3856 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081201/a613b63d/attachment-0001.bin
More information about the Numpy-discussion