I have a tensor of rank N and bond dimension d with shape T=(d,...,d)
.
I would like to multiply with a matrix M=(D,d)
where D is not the same as d.
The resulting tensor should have shape (d,...,d,D,d,...,d)
.
While I can do this to get eg (d,...,d,D,d,d)
tensor:
np.einsum('ij, ...jkl->...ikl', M,T)
The tensor can be of quite a large rank and I need to do this several times. Therefore I want to avoid writing out each particular case as I did above as it would be impractical.
Can anyone suggest a better/more general/alternative way to do this? I would really appreciate any help. Thanks in advance.