Numpy: Multiplying arrays of matrices

Shashwat Anand anand.shashwat at gmail.com
Wed Sep 15 13:25:11 EDT 2010


On Tue, Sep 14, 2010 at 7:54 PM, Gregory Ewing
<greg.ewing at canterbury.ac.nz>wrote:

> Suppose I have two N+2 dimensional arrays, representing
> N-d arrays of 2-d matrices. I want to perform matrix
> multiplication between corresponding matrices in these
> arrays.
>
> I had thought that dot() might do this, but it appears
> not, because e.g. applying it to two 3-d arrays gives
> a 4-d array, not another 3-d array.
>
> I'd also like to be able to find the inverse of each
> matrix in one of these arrays, but again, inv() doesn't
> do what I want -- it only works on 2-d arrays.
>
> Any thoughts on how to achieve these things using numpy
> functions?
>

Unrelated to numpy, but you can apply the basics of dynamic programming to
optimize the stuff.


> --
> Greg
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
~l0nwlf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100915/c2e58c40/attachment.html>


More information about the Python-list mailing list