[Numpy-discussion] expensive tensordot
Paul Northug
pnorthug@gmail....
Tue Jun 15 13:15:58 CDT 2010
I have a computation bounded by one step and I have always wondered
how to make it fast enough to be useable. I suspect that I have to use
an approximation, but I was hoping someone would spot a major
inefficiency in my implementation.
The calculation is a kind of outer product of two sets of time series:
for n,p in np.ndindex(self.P, self.P):
self.A[:,n,:,p] += np.tensordot(a[:,:,n:n+self.T],
a[:,:,p:p+self.T],
([0,2], [0,2]))
The sizes for all indices are on the order of 100 with the exception
that a.size[0] == 10. One inefficiency is that A is symmetric in (n,p)
but this is only a factor of 2.
Thanks,
Pål
More information about the NumPy-Discussion
mailing list