I need to compute many inner products for vectors stored in numpy arrays.
Namely, in mathematical terms,
Vi = Σk Ai,k Bi,k
and
Ci,j = Σk Ai,k Di,j,k
I can of course use a loop, but I am wondering whether I could make use of a higher level operator like dot
or matmul
in a clever way that I haven't thought of. What is bugging me is that np.cross
does accept arrays of vector to perform on, but dot
and inner
don't do what I want.