I have the following sum: $$ S = \sum_{j=1}^n \sum_{k=1}^n a_{jk} x_j^T B x_k $$ where $x_j$ is a vector of length $m$, and $B$ is an $m \times m$ positive definite matrix, and $a_{jk}$ are positive scalars. I want to rewrite this sum as a symmetric bilinear form $$ S = x^T C x $$ where $x$ is a vector of length $nm$: $$ x = \begin{pmatrix} x_1 \\ x_2 \\ \vdots \\ x_n \end{pmatrix} $$ and $C$ is an $nm \times nm$ matrix. By writing out all the terms, I found that: $$ C = \begin{pmatrix} a_{11} B & a_{12} B & \dots & a_{1n} B \\ a_{21} B & a_{22} B & \dots & a_{2n} B \\ \vdots & \vdots & \vdots & \vdots \\ a_{n1} B & a_{n2} B & \dots & a_{nn} B \end{pmatrix} $$ My question is: is there a way to express this matrix in a more elegant, compact form, using the matrix $A_{ij} = a_{ij}$ and $B$, without having to write out all the entries like above?