I have a matrix of matrices, given in the following code. I want to flatten the array...
e1[l_] = Table[{KroneckerDelta[l, m]}, {m, 1, 2}];
σ[l_, m_, k_] = e1[l].Transpose[e1[m]];
na = 4;
Sigma[l_, m_] := TensorProduct @@ Table[ σ[l, m, k], {k, 1, na}]
Sigma[1, 1] // MatrixForm
I can do this, but if na
is very large then this method:
ArrayFlatten[ArrayFlatten[ArrayFlatten[ArrayFlatten[Sigma[1, 1]]]]] // MatrixForm
is not convenient.
Nest[ArrayFlatten, Sigma[1, 1], 3]
$\endgroup$