Language Reference


HANKEL Function

HANKEL (matrix);

The HANKEL function generates a Hankel matrix from a vector or a block Hankel matrix from a matrix. A block Hankel matrix has the property that all matrices on the reverse diagonals are the same. The argument matrix is an $(np) \times p$ or $p \times (np)$ matrix; the value returned is the $(np) \times (np)$ result.

The Hankel function uses the first $p \times p$ submatrix $\mb{A}_1$ of the argument matrix as the blocks of the first reverse diagonal. The second $p \times p$ submatrix $\mb{A}_2$ of the argument matrix forms the second reverse diagonal. The remaining reverse diagonals are formed accordingly. After the values in the argument matrix have all been placed, the rest of the matrix is filled in with 0. If $\mb{A}$ is $(np) \times p$, then the first p columns of the returned matrix, $\mb{R}$, are the same as $\mb{A}$. If $\mb{A}$ is $p \times (np)$, then the first p rows of $\mb{R}$ are the same as $\mb{A}$.

The HANKEL function is especially useful in time series applications that involve a set of variables that represent the present and past and a set of variables that represent the present and future. In this situation, the covariance matrix between the sets of variables is often assumed to be a block Hankel matrix. If

\[  \mb{A} = \left[ \mb{A}_1|\mb{A}_2|\mb{A}_3|\cdots |\mb{A}_ n \right]  \]

and if $\mb{R}$ is the matrix formed by the HANKEL function, then

\[  \mb{R} = \left[ \begin{array}{ccccccccc} \mb{A}_1 &  | &  \mb{A}_2 &  | &  \mb{A}_3 &  | &  \cdots &  | &  \mb{A}_ n \\ \mb{A}_2 &  | &  \mb{A}_3 &  | &  \mb{A}_4 &  | &  \cdots &  | &  \mb{0} \\ \mb{A}_3 &  | &  \mb{A}_4 &  | &  \mb{A}_5 &  | &  \cdots &  | &  \mb{0} \\ \vdots & & & & & & & & \\ \mb{A}_ n &  | &  \mb{0} &  | &  \mb{0} &  | &  \cdots &  | &  \mb{0} \end{array} \right] ~   \]

If

\[  \mb{A} = \left[ \begin{array}{c} \mb{A}_1 \\ \mb{A}_2 \\ \vdots \\ \mb{A}_ n \\ \end{array} \right]  \]

and if $\mb{R}$ is the matrix formed by the HANKEL function, then

\[  \mb{R} = \left[ \begin{array}{ccccccccc} \mb{A}_1 &  | &  \mb{A}_2 &  | &  \mb{A}_3 &  | &  \cdots &  | &  \mb{A}_ n \\ \mb{A}_2 &  | &  \mb{A}_3 &  | &  \mb{A}_4 &  | &  \cdots &  | &  \mb{0} \\ \vdots \\ \mb{A}_ n &  | &  \mb{0} &  | &  \mb{0} &  | &  \cdots &  | &  \mb{0} \\ \end{array} \right] ~   \]

For example, the following statements produce Hankel matrices, as shown in FigureĀ 24.153:

r1 = hankel({1 2 3 4 5});
r2 = hankel({1 2 ,
             3 4 ,
             5 6 ,
             7 8});
r3 = hankel({1 2 3 4 ,
             5 6 7 8});
print r1, r2, r3;

Figure 24.153: Hankel Matrices

r1
1 2 3 4 5
2 3 4 5 0
3 4 5 0 0
4 5 0 0 0
5 0 0 0 0

r2
1 2 5 6
3 4 7 8
5 6 0 0
7 8 0 0

r3
1 2 3 4
5 6 7 8
3 4 0 0
7 8 0 0