- I have three sets of matrices {A_i}, {B_i}, and {C_i} with n matrices in each set
- The A_i are of dimension l x m, the B_i are of dimension m x o and the C_i are of dimension p x q
- I would like to compute the following:
Here is a concrete example for what I am after
A = np.arange(12).reshape(2,3,2)
B = np.arange(12,24).reshape(2,2,3)
C = np.arange(32).reshape(2,4,4)
result = np.zeros((12,12))
for i in range(2):
result += np.kron(A[i,:,:] @ B[i,:,:], C[i,:,:])
How can I implement this more efficiently?
Many thanks for your help!