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
cand the first rowr, 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 of shape
(..., N)specifying the first column.r (ArrayLike | None) – (optional) array of shape
(..., M)specifying the first row. Leading dimensions must be broadcast-compatible with those ofc. If not specified,rdefaults toconj(c).
- Returns:
A Toeplitz matrix of shape
(... N, M).- Return type:
Examples
Specifying
conly:>>> c = jnp.array([1, 2, 3]) >>> jax.scipy.linalg.toeplitz(c) Array([[1, 2, 3], [2, 1, 2], [3, 2, 1]], dtype=int32)
Specifying
candr:>>> 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,rdefaults toc.conj(), resulting in a Hermitian matrix ifc[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
For N-dimensional
cand/orr, the result is a batch of Toeplitz matrices:>>> c = jnp.array([[1, 2, 3], [4, 5, 6]]) >>> jax.scipy.linalg.toeplitz(c) Array([[[1, 2, 3], [2, 1, 2], [3, 2, 1]], [[4, 5, 6], [5, 4, 5], [6, 5, 4]]], dtype=int32)