Home > @josh-brown/vector > MatrixBuilder > hankel
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;
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
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 ]