How can I merge indices, such as converting a $4$-index list to $2$-index matrix, $C_{ijkl} \rightarrow D_{(ik); (jl)}$? This example sometimes appears in physics applications.
Here, I mean $(ik)$ as a multi-index: if $i$ runs from $1$ to $m$ and $k$ runs from $1$ to $n$, then $(ik)$ runs over $n*m$ values from $1,1$ to $n,m$. That is, $(i,k)$ is ordered going like $(1,1), (1,2)...(1,m), (2,1),(2,2)...(2,m),...(n,m)$
To clarify what I mean, here is an example input and output.
[In]: a = Table[i*j*(k + 1)*l, {i, 1, 2}, {j, 1, 2}, {k, 1, 2}, {l, 1, 2}];
FourIndtoTwoInd[a]
[Out]: {{2,4,4,8}, {3,6,6,12}, {4,8,8,16}, {6,12,12,24}}
For example, the first row has values ${2,4,4,8}$, corresponding to $i,k=(1,1)$ and $j,l = (1,1), (1,2), (2,1), (2,2)$.