[Numpy-discussion] Vectorizing "dot" on the two last axis

Gael Varoquaux gael.varoquaux@normalesup....
Sat Oct 11 06:15:59 CDT 2008


On Fri, Oct 10, 2008 at 09:03:14AM -0400, Anne Archibald wrote:
> I am pretty sure that, unfortunately, there is no way to vectorize
> this without an intermediate array substantially larger than either
> the inputs or the outputs.

OK, this is what I had found.

> From a computational point of view, this isn't particularly a problem:
> the intermediate array cannot be large enough to be a problem without
> the slices along at least one axis being large enough that for loop
> overhead is pretty minor. 

OK, I here what you are saying: the loop is not costing me that much,
because anyhow the operation would be slow, and the overhead is small. I
have just grown to find that vector operations are easier to read than
loops (to a trained eye).

Thank for confirming my findings,

Gaël


More information about the Numpy-discussion mailing list