Let $m\in\mathbb{N}$. I have a matrix $A$ which is $m^2\times m^2$, which I need to enter into a computer. I am looking for a decomposition of this matrix as a function of simple matrices. I will provide the actual matrix and an example.
The matrix $A$ is such that $$ A((i-1)m + \ell,(j-1)m+k) = \delta_{ik}\delta_{jl}, $$ where $i,j,\ell,k\in\{1,\ldots,m\}$. Take $m=3$, then the matrix $A$ is given by $$ \left[ \begin{array}{ccc|ccc|ccc} 1&0&0&0&0&0&0&0&0 \\ 0&0&0&1&0&0&0&0&0 \\ 0&0&0&0&0&0&1&0&0 \\ \hline 0&1&0&0&0&0&0&0&0 \\ 0&0&0&0&1&0&0&0&0 \\ 0&0&0&0&0&0&0&1&0 \\ \hline 0&0&1&0&0&0&0&0&0 \\ 0&0&0&0&0&1&0&0&0 \\ 0&0&0&0&0&0&0&0&1 \\ \end{array} \right] $$
Example of the kind of answer I am looking for. Define $\text{vec}(\cdot)$ as the function which maps a matrix to a column vector, where the columns of the matrix are stacked underneath eachother (going from left to right). Define $B$ as $$ B((i-1)m + \ell,(j-1)m+k) = \delta_{i\ell}\delta_{jk}, $$ then $B = \text{vec}(I_m)\otimes(\text{vec}(I_m))'$, where $I_m$ is the $m\times m$ identity matrix, $\otimes$ is the Kronecker product and $'$ denotes a transpose.
Thank you in advance!
If $e_1,e_2,e_3$ are the unit vectors, then the $i,j-$Block of $A$ is given by the $3 \times 3$ matrix. $$B_{ij}= e_j (e_i)^T,$$
which has a $1$ in the $j$th row and $i$th column and $0$ everywhere else.
Then $A$ is given by
$$A=\sum_{i,j=1}^3 (e_i (e_j)^T) \otimes (B_{ij}) = \sum_{i,j=1}^3B_{ij}^T \otimes (B_{ij}) = \sum_{i,j=1}^3B_{ji} \otimes B_{ij}.$$