I have an a numpy ndarray 3x3 matrix that looks like this
a = ([[ uu, uv, uw],
[ uv, vv, vw],
[ uw, vw, ww]])
Each component is itself a 2D array of size (N,M), so the a matrix has a (3,3,N,M) shape.
How could I perform a matrix multiplication of a*a in a pythonic way?
Using a@a throws the following error (for N=1218 and M=540):
ValueError: shapes (3,3,1218,540) and (3,3,1218,540) not aligned: 540 (dim 3) != 1218 (dim 2)
I want to be able to perform this operation as if the elements of a where just scalar values where a@a does not throw an error related to its shapes since it is a simple 3x3 matrix multiplication.
Thanks.