[Numpy-discussion] How do I use numpy to do this?

Christopher Barker Chris.Barker at noaa.gov
Fri Jun 2 18:09:27 EDT 2006


Rob Hooft wrote:
> Christopher Barker wrote:
> | Did you time them? And yours only handles integers.
> 
> Yes I did, check the attachment of my previous message for a python
> module to time the three, 

Sorry about that, I don't notice that.

 > with completely different results from yours
 > (I'm using Numeric).

I ran it and got similar results to mine. Frankly, for the size problems 
I'm dealing with, they are all about the same, except for under 
Numarray, where mine is fastest, your second, and Robert third -- by a 
wide margin!

Another reason I'm glad numpy is built on the Numeric code:

Using numarray
My way took: 0.394555 seconds
Robert's way took: 20.590545 seconds
Rob's way took: 4.802346 seconds
Number of X: 201
Number of Y: 241

Using Numeric
My way took: 0.593319 seconds
Robert's way took: 0.523235 seconds
Rob's way took: 0.579756 seconds

Robert's way has a pretty decent edge under numpy:

Using numpy
My way took: 0.686741 seconds
Robert's way took: 0.357887 seconds
Rob's way took: 0.796977 seconds

And I'm using time(), rather than clock() now, though it dint' really 
change anything. I suppose I should figure out timeit.py

Thanks for all your help on this,

-Chris

-- 
Christopher Barker, Ph.D.
Oceanographer
                                     		
NOAA/OR&R/HAZMAT         (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov




More information about the NumPy-Discussion mailing list