2
$\begingroup$

Transforming a matrix by copying each element up to a certain given length ($k$) and then starting on the next row with the second element, and row after that with the third, etc. So each row is shifted by one more. For example:

$$\begin{bmatrix}1\\2\\3\\4\\5\end{bmatrix} \rightarrow \begin{bmatrix}1 & 2 & 3\\2 & 3 & 4\\3 & 4 & 5\end{bmatrix} $$

With a parameter $k=3$ or

$$\begin{bmatrix}1\\2\\3\\4\\5\end{bmatrix} \rightarrow \begin{bmatrix}1 & 2 & 3 & 4\\2 & 3 & 4 & 5\end{bmatrix} $$

With a parameter $k=4$.

$\endgroup$
3
  • 1
    $\begingroup$ If such operation is useful, it certainly has a name. And conversely. $\endgroup$
    – user65203
    Dec 1, 2018 at 21:05
  • 1
    $\begingroup$ Thinking to a fixed length window (length = 3 or 2 in your example) : you are sliding this window on the message "1 2 3 4 5" and you gather the results in a new matrix : thus it has something common with discrete convolution but I don't see any "closed form" matrix expression that can render this operation... $\endgroup$
    – Jean Marie
    Dec 1, 2018 at 22:15
  • 1
    $\begingroup$ I would call the 1st operation Hankelization. $\endgroup$ Dec 2, 2018 at 8:01

1 Answer 1

1
$\begingroup$

The operation looks a little too particular to me to have a (well known) name.

The resulting matrix is like a Toeplitz matrix (except that it's constant along the anti-diagonals), could be regarded as some sort of "toeplitzation" (ugh)...

For example, the second example in Matlab/Octave:

>> fliplr(toeplitz([4,5],[4,3,2,1]))
ans =

   1   2   3   4
   2   3   4   5
$\endgroup$
2
  • 1
    $\begingroup$ Thanks! This opened up some good things for me to look into. From Toeplitz I found Hankel which seems like I can use to do at least something close to what I need. $\endgroup$ Dec 1, 2018 at 21:43
  • 1
    $\begingroup$ If you are looking for ways to do this in Python, you may also be interested in vstack. $\endgroup$ Dec 2, 2018 at 7:56

You must log in to answer this question.

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