[Numpy-discussion] loop vectorization
Thomas K Gamble
Fri Mar 11 12:13:38 CST 2011
I have the followin loop in my code:
for i in range(0, nFrames):
data += dot(transpose(bipData[:,i,:]), bipData[:,i,:])
bipData is a 1024x258x256 double precision float array.
The loop takes all of 15 seconds to run on my computer and, with several
hundred files to process...
Is there a way to do something like:
data = sum(dot(transpose(bipData), bipData))
with dot done on the desired axis of bipData?
This might give a fair speed increase. Or perhaps a different approach I'm not
Thomas K. Gamble
Research Technologist, System/Network Administrator
Chemical Diagnostics and Engineering (C-CDE)
Los Alamos National Laboratory
"There cannot be a crisis next week. My schedule is already full."
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion