|
Re: efficient summation: msg#00006python.numeric.general
Stephen Walton wrote: In addition, I doubt you can measure CPU time for only a 10 elementSorry, I was giving the 10 element example for clarity. I am actually using arrays with over 6e6 elements. I just discovered compress, it works wonders in my situation. The following script runs in 1 second on my 2GHz P4, winXP. The same calculation using a masked array took 18 seconds: from numarray import * from time import clock clock() Rx = ones((2500,2500))*12.5 N = zeros((2500,2500),typecode=Bool) N[:250,:]=1 trans = compress(N,Rx) temp = exp(2j*pi*(trans+trans))*exp(2j*pi*(trans)) s = sum(temp.real) print s, clock() ------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: efficient summation: 00006, Paulo J. S. Silva |
|---|---|
| Next by Date: | Re: extracting a random subset of a vector: 00006, Curzio Basso |
| Previous by Thread: | Re: efficient summationi: 00006, Stephen Walton |
| Next by Thread: | Re: efficient summation: 00006, Paulo J. S. Silva |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |