hankel

Function hankel 

Source
pub fn hankel<T>(
    first_col: ArrayView<'_, T, Ix1>,
    last_row: ArrayView<'_, T, Ix1>,
) -> Result<Array<T, Ix2>, &'static str>
where T: Clone + PartialEq + Zero,
Expand description

Create a Hankel matrix from its first column and last row

§Arguments

  • first_col - First column of the Hankel matrix
  • last_row - Last row of the Hankel matrix (first element must match last element of first_col)

§Returns

A Hankel matrix with the specified first column and last row

§Examples

use ndarray::array;
use scirs2_core::ndarray_ext::matrix::hankel;

let first_col = array![1, 2, 3];
let last_row = array![3, 4, 5];

let result = hankel(first_col.view(), last_row.view()).unwrap();
assert_eq!(result.shape(), &[3, 3]);
assert_eq!(result, array![
    [1, 2, 3],
    [2, 3, 4],
    [3, 4, 5]
]);