speed of numpy.power()?

2010-08-25 Thread Carlos Grohmann
Hi all, I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) I looks to me that numpy.power takes more time to run. cheers Carlos -- http://mail.python.org/mailman/listinfo/python-list

Re: speed of numpy.power()?

2010-08-25 Thread Mark Lawrence
On 25/08/2010 14:59, Carlos Grohmann wrote: Hi all, I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) I looks to me that numpy.power takes more time to run. cheers Carlos Measure it yourself using the timeit module. Cheers. Mark Lawrence. --

Re: speed of numpy.power()?

2010-08-25 Thread Hrvoje Niksic
Carlos Grohmann carlos.grohm...@gmail.com writes: I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) I looks to me that numpy.power takes more time to run. You can use math.pow, which is no slower than repeated multiplication, even for small exponents.

Re: speed of numpy.power()?

2010-08-25 Thread David Cournapeau
On Wed, Aug 25, 2010 at 10:59 PM, Carlos Grohmann carlos.grohm...@gmail.com wrote: Hi all, I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) Without more context, I would say None if x*x*x*x*... works and you are not already using numpy. The point of numpy

Re: speed of numpy.power()?

2010-08-25 Thread Carlos Grohmann
On 25 ago, 12:40, David Cournapeau courn...@gmail.com wrote: On Wed, Aug 25, 2010 at 10:59 PM, Carlos Grohmann Thanks David and Hrvoje. That was the feedback I was looking for. I am using numpy in my app but in some cases I will use math.pow(), as some tests with timeit showed that numpy.power

Re: speed of numpy.power()?

2010-08-25 Thread Robert Kern
On 8/25/10 8:59 AM, Carlos Grohmann wrote: Hi all, I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) I looks to me that numpy.power takes more time to run. You will want to ask numpy questions on the numpy mailing list: http://www.scipy.org/Mailing_Lists

Re: speed of numpy.power()?

2010-08-25 Thread Peter Pearson
On Wed, 25 Aug 2010 06:59:36 -0700 (PDT), Carlos Grohmann wrote: I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) Using the dis package under Python 2.5, I see that computing x_to_the_16 = x*x*x*x*x*x*x*x*x*x*x*x*x*x*x*x uses 15 multiplies. I hope

Re: speed of numpy.power()?

2010-08-25 Thread Dave Angel
Peter Pearson wrote: On Wed, 25 Aug 2010 06:59:36 -0700 (PDT), Carlos Grohmann wrote: I'd like to hear from you on the benefits of using numpy.power(x,y) over (x*x*x*x..) Using the dis package under Python 2.5, I see that computing x_to_the_16 =