I started learning numpy and I\'m trying to do a kind of strange matrix multiplication between a 2-dimensional and a 3-dimensional matrices. I have a function that does what
You can use np.einsum -
np.einsum('ij,ijk->ik',array1,array2)
Or with np.matmul or @ operator on Python 3.x -
np.matmul
@
Python 3.x
np.matmul(array1[:,None,:],array2)[:,0] (array1[:,None,:] @ array2)[:,0]