Skip to content

Latest commit

 

History

History
92 lines (49 loc) · 1.54 KB

File metadata and controls

92 lines (49 loc) · 1.54 KB

Home > @josh-brown/vector > MatrixBuilder > hankel

MatrixBuilder.hankel() method

Constructs a Hankel matrix from the specified first column and last row. A Hankel matrix has constant anti-diagonals. If lastRow is not given, then a vector with the last entry of the first row in the first entry and zero elsewhere is assumed. The last entry of the first column must equal the first entry of the last row.

Signature:

hankel(firstColumn: Vector<S>, lastRow?: Vector<S>): M;

Parameters

Parameter

Type

Description

firstColumn

Vector<S>

The first column of the Hankel matrix

lastRow

Vector<S>

(Optional) The last row of the Hankel matrix

Returns:

M

Example

const hankel = matrixBuilder.hankel(vectorBuilder.fromArray([2, 4, 6, 8]));

// [ 2 4 6 8 ]
// [ 4 6 8 0 ]
// [ 6 8 0 0 ]
// [ 8 0 0 0 ]

const hankelWithSpecifiedRow = matrixBuilder.hankel(
  vectorBuilder.fromArray([1, 2, 3, 4]),
  vectorBuilder.fromArray([4, 9, 9])
);

// [ 1 2 3 ]
// [ 2 3 4 ]
// [ 3 4 9 ]
// [ 4 9 9 ]