1
$\begingroup$

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.

$\endgroup$

1 Answer 1

1
$\begingroup$

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.

Hence the Matlab code would be like this:

kron(a,eye(M))*q
$\endgroup$
1
  • $\begingroup$ Many thanks! It is very helpful for me. $\endgroup$
    – Qiuyun.Zou
    Sep 1, 2021 at 1:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .