Hello,
I am wondering if there is an efficient way (other than for cycle) of solving following task:
I need to multiply e.g. two matrices and at every point in the matrix there is an array. The two matrices shall be multiplied using matrix multiplication and when the elements of these matrices are multiplied, this shall be done elementwise. So lets say such multiplication:
[[[1,1,1],[2,2,2]],
[[3,3,3],[4,4,4]]]
x
[[[1,1,1],[2,2,2]],
[[3,3,3],[4,4,4]]]
=
[[[1,1,1]*[1,1,1]+[2,2,2]*[3,3,3],[1,1,1]*[2,2,2]+[2,2,2]*[4,4,4]],
[[3,3,3]*[1,1,1]+[4,4,4]*[3,3,3]],[[3,3,3]*[2,2,2]+[4,4,4]*[4,4,4]]]
The multiplication * denotes elementwise multiplication and x denotes matrix multiplication. Dot() for arrays (numpy) or * for matrices (scipy) does not work as I need to.
Thank anybody for an idea, how to do it.