we have had that discussion about ... two days ago. please look up
'How to sum weighted matrices' with at least two efficient solutions.
On Fri, Mar 11, 2011 at 02:00:09PM -0500, Josh Hykes wrote:
>I think you can use tensordot here. Maybe something like the
>following:
>
>from numpy
I think you can use tensordot here. Maybe something like the following:
from numpy.random import random
import numpy as np
ni, nj, nk = 4, 5, 6
bipData = random((ni,nj,nk))
data1 = np.zeros((nk,nk))
# loop
for i in range(nj):
data1 += np.dot(np.transpose(bipData[:,i,:]), bipData[:,i,:])
#
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 t