I am looking for a function that could replace matrices composed of scalar matrices subparts with matrices where those subparts are replaced with numbers.
That is,
$$\left( \begin{array}{cccc} 1 & 0 & 2 & 0 \\ 0 & 1 & 0 & 2 \\ 3 & 0 & 4 & 0 \\ 0 & 3 & 0 & 4 \\ \end{array} \right)\to \left( \begin{array}{cc} 1 & 2 \\ 3 & 4 \\ \end{array} \right)$$
That is, an operation inverse to KroneckerProduct[A, IdentityMatrix[n]]
(which replaces numbers with scalar matrices of order n
).
The function should look for the best replacement possible, that is the result should be a matrix of minimal possible order.
How to realise this?