pub fn toeplitz<T>(
first_row: ArrayView<'_, T, Ix1>,
first_col: ArrayView<'_, T, Ix1>,
) -> Result<Array<T, Ix2>, &'static str>
Expand description
Create a Toeplitz matrix from first row and first column
§Arguments
first_row
- First row of the Toeplitz matrixfirst_col
- First column of the Toeplitz matrix (first element must match first row’s first element)
§Returns
A Toeplitz matrix with the specified first row and column
§Examples
use ndarray::array;
use scirs2_core::ndarray_ext::matrix::toeplitz;
let first_row = array![1, 2, 3];
let first_col = array![1, 4, 5];
let result = toeplitz(first_row.view(), first_col.view()).unwrap();
assert_eq!(result.shape(), &[3, 3]);
assert_eq!(result, array![
[1, 2, 3],
[4, 1, 2],
[5, 4, 1]
]);