Andrew Nelson writes: > > 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.
Sorry, I'm a little unclear on what is supposed to be multiplied with what. You've got (NX x NY) 2x2 matricies, how do you end up with NX 2x2 matricies? Perhaps if you show the code using loops with `np.dot` it will be clearer how to translate to using `np.einsum` -Dave _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion