## HANKEL Function

**generates a Hankel matrix**
**HANKEL(** *matrix***)**

where *matrix* is a numeric matrix or literal.

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*) ×*p* or *p* ×(*np*)
matrix; the value returned is the (*np*) ×(*np*) result.

The Hankel function uses the first *p* ×*p*
submatrix **A**_{1} of the argument matrix
as the blocks of the first reverse diagonal.
The second *p* ×*p* submatrix **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 **A** is (*np*) ×*p*, then the first *p* columns of
the returned matrix, **R**, will be the same as **A**.
If **A** is *p* ×(*np*), then the first
*p* rows of **R**will be the same as **A**.
The HANKEL function is especially useful in time-series
applications, where the covariance matrix of a set
of variables representing the present and past and
a set of variables representing the present and
future is often assumed to be a block Hankel matrix.
If

and if **R** is the matrix formed by the HANKEL function, then

If

and if **R** is the matrix formed by the HANKEL function, then

For example, the IML code
r=hankel({1 2 3 4 5});

results in
R 5 rows 5 cols (numeric)
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

The statement
r=hankel({1 2 ,
3 4 ,
5 6 ,
7 8});

returns the matrix
R 4 rows 4 cols (numeric)
1 2 5 6
3 4 7 8
5 6 0 0
7 8 0 0

And the statement
r=hankel({1 2 3 4 ,
5 6 7 8});

returns the result
R 4 rows 4 cols (numeric)
1 2 3 4
5 6 7 8
3 4 0 0
7 8 0 0

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.