I'm implementing several "fundamental" operations defined in arXiv:1405.7786 for matrix product states, such as the Hadamard product. Part of doing this is defining operations on the core tensors, such as the partial Kronecker product (see Definition 2.5 of the aforementioned paper, reproduced below). Define two tensors A and B, where
A∈RR1×R2×⋯×RM×I1×⋯IN
and
B∈RS1×S2×⋯×SM×I1×⋯IN
with Rm an auxiliary mode (type Link) and In a physical mode (type Site). Then the partial Kronecker product is defined as
C=A⊠
where the subtensors are given by
\mathbf{C}(:, \dots, :, i_1, \dots, i_N) = \mathbf{A}(:, \dots, :, i_1, \dots, i_N) \otimes \mathbf{B}(:, \dots, :, i_1, \dots, i_N)
If possible, I'd like to implement this in a general way, where it could be applied to any ITensor. I'm just getting hung up on how to do the indexing correctly and get the outer product that I need. Any help is greatly appreciated!