Skip to content

Latest commit

 

History

History
48 lines (31 loc) · 1.35 KB

vector.matrixbuilder.hankel.md

File metadata and controls

48 lines (31 loc) · 1.35 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> 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 ]