Finding Toeplitz matrix using SciPy

The toeplitz() function of the linalg module in scipy finds and returns a Toeplitz matrix as an ndarray. In a Toeplitz matrix the diagonal elements have constant values.

Linear Algebra Updated 27 May 2025 1 min read

Overview

  • A Toeplitz matrix is a matrix whose diagonal elements are constant. i.e, The value of the diagonal elements are equal. Toeplitz matrix is named after the mathematician Otto Toeplitz.
  • Toeplitz matrices have their applications in several scientific fields including finding solutions to differential equations and integral equations, signal processing, image processing, spline functions and queuing theory.
  • Given the first colulmn and the first row of the output matrix, the function toeplitz() from the linalg module of the scipy library returns a Toeplitz matrix as an ndarray. If the first row is not given its is taken as the conjucate of the given first column.

Example

python
# Example Python program that creates a

            # Toeplitz matrix using the scipy module

            # scipy.linalg

import scipy.linalg as sclg

firstColumn = [1, 3, 5]

            firstRow     = [1, 2, 4]

# Create a Toeplitz matrix with the given first column and

            # the first row

            toeplitzMatrix = sclg.toeplitz(firstColumn, firstRow)

print("First column:")

            print(firstColumn)

print("First row:")

            print(firstRow)

print("Toeplitz matrix:")

            print(type(toeplitzMatrix))

            print(toeplitzMatrix)

Output

Output
First column:

            [1, 3, 5]

            First row:

            [1, 2, 4]

            Toeplitz matrix:

            <class 'numpy.ndarray'>

            [[1 2 4]

             [3 1 2]

             [5 3 1]]