# How to realize the product of block matrices in MATLAB

Given $$\mathbf{A}$$ is $$L\times N$$ matrix, and $$\mathbf{Q}$$ is $$NM*M$$ matrix which can be divided into $$N$$ blocks with $$M\times M$$ size i.e., \begin{align} \mathbf{Q}=\begin{bmatrix} \mathbf{Q}_1\\ \mathbf{Q}_2\\ \vdots\\ \mathbf{Q}_N \end{bmatrix} \end{align} where $$\mathbf{Q}_n$$ is $$n$$-th bolck of $$\mathbf{Q}$$ and is $$M\times M$$ matrix.

How to perform the following product \begin{align} \begin{bmatrix} \sum_{i=1}^NA_{1i}\mathbf{Q}_{i}\\ \sum_{i=1}^NA_{2i}\mathbf{Q}_{i}\\ \vdots\\ \sum_{i=1}^NA_{Li}\mathbf{Q}_{i}\\ \end{bmatrix} \end{align} without using for, where $$A_{\ell i}$$ is $$(\ell, i)$$-th entry of $$\mathbf{A}$$ and is scalar.

The resulting matrix can be rewritten as $$\begin{bmatrix} \sum_{i=1}^NA_{1i}\mathbf{I}_M\mathbf{Q}_{i}\\ \sum_{i=1}^NA_{2i}\mathbf{I}_M\mathbf{Q}_{i}\\ \vdots\\ \sum_{i=1}^NA_{Li}\mathbf{I}_M\mathbf{Q}_{i}\\ \end{bmatrix} = \begin{bmatrix} A_{11}\mathbf{I}_M&\dots&A_{1N}\mathbf{I}_M\\ A_{21}\mathbf{I}_M&\dots&A_{2N}\mathbf{I}_M\\ \vdots&\ddots&\vdots\\ A_{L1}\mathbf{I}_M&\dots&A_{LN}\mathbf{I}_M\\ \end{bmatrix} \begin{bmatrix} \mathbf{Q}_{1}\\ \mathbf{Q}_{2}\\ \vdots\\ \mathbf{Q}_{N}\\ \end{bmatrix}= (\mathbf{A}\otimes \mathbf{I}_M)\mathbf{Q},$$ where $$\mathbf{I}_M$$ is a $$M\times M$$ identity matrix, $$\otimes$$ is the Kronecker product.
kron(a,eye(M))*q