toeplitz_2d#

hypercoil.functional.matrix.toeplitz_2d(c: Tensor, r: Tensor | None = None, shape: Tuple[int, int] | None = None, fill_value: float = 0) Tensor[source]#

Construct a 2D Toeplitz matrix from a column and row vector.

Based on the second method posted by @mattjj and evaluated by @blakehechtman here: google/jax#1646 Apparently this method underperforms on TPU. But given that TPUs are only available for Google, this is probably not a big deal.

Our method is more flexible in that it admits Toeplitz matrices without circulant structure. Our API is also closer to that of the scipy toeplitz function. We also support a fill value for the matrix. See toeplitz() for complete API documentation.

Note

Use the toeplitz() function for an API that supports any number of leading dimensions.