I get about 60% of the original execution times for about any size of stack.
On 15 July 2010 14:09, Charles R Harris <charlesr.har...@gmail.com> wrote: > > > On Thu, Jul 15, 2010 at 12:00 PM, Emmanuel Bengio <beng...@gmail.com>wrote: > >> Ok I get it. Thanks! >> >> Numpy syntax that works for me: >> numpy.sum(a[:,:,:,numpy.newaxis]*b[:,numpy.newaxis,:,:],axis=-2) >> >> > The leading "..." gives the same thing, but iterates over all the leading > indicies in case you want multidimensional arrays of matrices ;) You can > also use the sum method which might be a bit more economical: > > (a[:,:,:,numpy.newaxis]*b[:,numpy.newaxis,:,:]).sum(axis=-2) > > How do the execution times compare? > > <snip> > > Chuck > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > -- Emmanuel
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion