Say I have: a = np.array([[2, 4],               [6, 8]])     b = np.array([[1, 3],               [1, 5]])  I want to get to: c = np.array([[20,32],               [28, 44]])  where
Solution 1:
You can use np.dot -
b.dot(a).T
Alternatively, using np.einsum (for the kicks maybe) -
np.einsum('ij,ki->jk',a,b)
 
Post a Comment for "Replace Looping-over-axes With Broadcasting"