jax.scipy.linalg.toeplitz

Contents

jax.scipy.linalg.toeplitz#

jax.scipy.linalg.toeplitz(c, r=None)[source]#

Construct a Toeplitz matrix

JAX implementation of scipy.linalg.toeplitz().

A Toeplitz matrix has equal diagonals: \(A_{ij} = k_{i - j}\) for \(0 \le i < n\) and \(0 \le j < n\). This function specifies the diagonals via the first column c and the first row r, such that for row i and column j:

\[\begin{split}A_{ij} = \begin{cases} c_{i - j} & i \ge j \\ r_{j - i} & i < j \end{cases}\end{split}\]

Notice this implies that \(r_0\) is ignored.

Parameters:
  • c (ArrayLike) – array specifying the first column. Will be flattened if not 1-dimensional.

  • r (ArrayLike | None) – (optional) array specifying the first row. If not specified, defaults to conj(c). Will be flattened if not 1-dimensional.

Returns:

toeplitz matrix of shape (c.size, r.size).

Return type:

Array

Examples

Specifying c only:

>>> c = jnp.array([1, 2, 3])
>>> jax.scipy.linalg.toeplitz(c)
Array([[1, 2, 3],
       [2, 1, 2],
       [3, 2, 1]], dtype=int32)

Specifying c and r:

>>> r = jnp.array([-1, -2, -3])
>>> jax.scipy.linalg.toeplitz(c, r)  # Note r[0] is ignored
Array([[ 1, -2, -3],
       [ 2,  1, -2],
       [ 3,  2,  1]], dtype=int32)

If specifying only complex-valued c, r defaults to c.conj(), resulting in a Hermitian matrix if c[0].imag == 0:

>>> c = jnp.array([1, 2+1j, 1+2j])
>>> M = jax.scipy.linalg.toeplitz(c)
>>> M
Array([[1.+0.j, 2.-1.j, 1.-2.j],
       [2.+1.j, 1.+0.j, 2.-1.j],
       [1.+2.j, 2.+1.j, 1.+0.j]], dtype=complex64)
>>> print("M is Hermitian:", jnp.all(M == M.conj().T))
M is Hermitian: True