What is a Hankel matrix?
A Hankel matrix is a square matrix in which all the elements in ascending skew-diagonals from left to right are the same. For example, the matrix A given below is a Hankel matrix.
If we look at the matrix A carefully, we will see that all the elements in the ascending skew diagonals from left to right are the same and they are a, b, c, d, e, f, and g, respectively.
How to create a Hankel matrix using Python?
We can use the following Python code to create a Hankel matrix.
from scipy.linalg import hankel row = [1, 2, 3, 4] column = [1, 5, 6, 7] A = hankel(c=column, r=row) print("The Hankel Matrix A: \n", A)
Here, the variables row and column specify the elements of the first row and the first column of the Hankel matrix, respectively. The output of the mentioned program will be:
The Hankel Matrix A: [[1 5 6 7] [5 6 7 2] [6 7 2 3] [7 2 3 4]]






0 Comments