Learn R Programming

fastmatrix (version 0.6)

hankel: Form a symmetric Hankel matrix

Description

Forms a symmetric Hankel matrix of order \(n\) from the values in vector \(\bold{x}\) and optionally the vector \(\bold{y}\).

Usage

hankel(x, y = NULL)

Value

A symmetric Hankel matrix of order \(n\).

Arguments

x

the first column to form the Hankel matrix.

y

the last column of the Hankel matrix. If y is not provided only its first \(n\) skew diagonals are formed and the remaining elements are zeros. Otherwise, it is assumed that \(x_n = y_1\), and the first entry of vector y is discarded.

Examples

Run this code
x <- 1:4
y <- c(4,6,8,10)

# H4
hankel(x)

# H({1,2,3,4},{4,6,8,10})
hankel(x, y)

Run the code above in your browser using DataLab