[Numpy-discussion] help using np.einsum for stacked matrix multiplication

Eelco Hoogendoorn hoogendoorn.eelco at gmail.com
Wed Oct 29 06:19:17 EDT 2014

You need to specify your input format. Also, if your output matrix misses
the NY dimension, that implies you wish to contract (sum) over it, which
contradicts your statement that the 2x2 subblocks form the matrices to
multiply with. In general, I think it would help if you give a little more
background on your problem.

On Wed, Oct 29, 2014 at 10:39 AM, Andrew Nelson <andyfaff at gmail.com> wrote:

> Dear list,
> I have a 4D array, A, that has the shape (NX, NY, 2, 2).  I wish to
> perform matrix multiplication of the 'NY' 2x2 matrices, resulting in the
> matrix B.  B would have shape (NX, 2, 2).  I believe that np.einsum would
> be up to the task, but I'm not quite sure of the subscripts I would need to
> achieve this.
> Can anyone help, please?
> cheers,
> Andrew.
> --
> _____________________________________
> Dr. Andrew Nelson
> _____________________________________
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141029/10553f9a/attachment.html>

More information about the NumPy-Discussion mailing list