[SciPy-user] Dot in greater than 2D

Brian Lewis brian.lewis17@gmail....
Mon Jun 15 12:52:51 CDT 2009

How is dot defined for matrices with dimension greater than 2?  The
docstring says:

    Returns the dot product of a and b for arrays of floating point types.
    Like the generic numpy equivalent the product sum is over
    the last dimension of a and the second-to-last dimension of b.
    NB: The first argument is not conjugated.

which seemed a bit cryptic to me.  Is there any documentation on this with
an example using arrays with greater than 2 dimensions? On first read, it
seemed like only the summed dimensions needed to agree.  So,

a.shape == (5,3,2)
b.shape == (10,2,20)

but I get that the objects are not aligned.  On second read, it seemed like
maybe dot would apply itself recursively.  So maybe

a.shape == (5,3,2)
b.shape == (3,2,5)

would work since a[:,:,i] has shape (5,3) and is compatible (via dot) with
b[:,i,:] whose shape is (3,5). Not so surprisingly, the objects are also not

Apologies for my naivety.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090615/4c6460f6/attachment.html 

More information about the SciPy-user mailing list