[Numpy-discussion] dot operations on multidimensional arrays

Johannes Loehnert a.u.r.e.l.i.a.n at gmx.net
Tue Dec 5 14:51:06 CST 2006


> The question is then:
> 1) Is there any way to change the axis for which the product-sum is
> performed. This can of course be done by a swapaxis before and after the
> operation, but this makes the array non-contiguous, in which case the
> dot operation often makes bugs (at least in Numeric).
> 2) For complicated reasons we still use Numeric in our software package,
> and in this, "dot" behaves very strangely.

The behaviour for >2D arrays has a bug which was fixed for numpy long ago. (I 
was the one who found it. :-)) It lead exactly to the behaviour you found 
(first row is correct, rest is garbage). I do not know if it was fixed in 
Numeric, maybe updating to the latest version will help.

Otherwise, maybe the best workaround is to use a for loop and calculate dot 


More information about the Numpy-discussion mailing list