# How to construct a 'sliding matrix' using identity

I have the following problem: let consider a vector $$a=(a_1, ..., a_N)^T$$. I would like to construct a 'sliding matrix' A so that:

$$A=\begin{pmatrix} a_1 & ... & a_1 & 0 & & & ... & & & 0 \\ 0 & ... & 0 & a_2 & ... & a_2 & 0 & ... & & 0 \\ 0 & & & ... & & 0 & \ddots & & & \\ 0 & & & & ... & & 0 & a_N & ... & a_N \end{pmatrix}\in K^{N\times NM}$$

Each element of $$a$$ is repeated $$M$$ times in $$A$$, which has a size $$N\times NM$$. For the moment, I only found the means to obtain a unitary $$M$$, using a kronecker product $$I_N \otimes 1_M$$...

Thank you!

I'm not sure what exactly you're saying about your usage of the Kronecker product. In any case, your matrix can be written in the form $$D \otimes \mathbf 1^T$$, where $$D = \operatorname{diag}(a) = \pmatrix{a_1 \\ & \ddots \\ && a_n}, \quad \mathbf 1 = (1,\dots,1)^T.$$
Starting with $$I_N \otimes \vec{1}_M^T = \begin{pmatrix} 1 & ... & 1 & 0 & & & ... & & & 0 \\ 0 & ... & 0 & 1 & ... & 1 & 0 & ... & & 0 \\ 0 & & & ... & & 0 & \ddots & & & \\ 0 & & & & ... & & 0 & 1 & ... & 1 \end{pmatrix},$$ we simply need to multiply the first row by $$a_1$$, the second row by $$a_2$$, ..., and the $$N$$-th row by $$a_N$$. This can be done with a diagonal matrix multiplication on the left, i.e. $$\text{diag}(a)(I_N \otimes \vec{1}_M^T) = \begin{pmatrix} a_1 & ... & a_1 & 0 & & & ... & & & 0 \\ 0 & ... & 0 & a_2 & ... & a_2 & 0 & ... & & 0 \\ 0 & & & ... & & 0 & \ddots & & & \\ 0 & & & & ... & & 0 & a_N & ... & a_N \end{pmatrix}$$ where of course $$\text{diag}(a) = \begin{pmatrix}a_1 & & & \\ & a_2 & & \\ & & \ddots & \\ & & & a_N \end{pmatrix}$$.