Dot Product Of Subarrays Without For Loop
when we have: array 1: A, shape (49998,3,3) array 2: B, shape (3, 49998) and i want to multiply their subarrays to get array 3: C, shape(3,49998) for which im using generator:
Solution 1:
If I am getting your code right, you want to perform 49998 dot products of a 3x3 matrix with a 3 vector, right? That is very easy to do with np.einsum
:
np.einsum('ijk,ki->ij', A, B)
Post a Comment for "Dot Product Of Subarrays Without For Loop"