circulant — SciPy v1.15.2 Manual (original) (raw)
scipy.linalg.
scipy.linalg.circulant(c)[source]#
Construct a circulant matrix.
Parameters:
c(…, N,) array_like
The first column(s) of the matrix. Multidimensional arrays are treated as a batch: each slice along the last axis is the first column of an output matrix.
Returns:
A(…, N, N) ndarray
A circulant matrix whose first column is given by c. For batch input, each slice of shape (N, N)
along the last two dimensions of the output corresponds with a slice of shape (N,)
along the last dimension of the input.
Notes
Added in version 0.8.0.
Examples
from scipy.linalg import circulant circulant([1, 2, 3]) array([[1, 3, 2], [2, 1, 3], [3, 2, 1]])
circulant([[1, 2, 3], [4, 5, 6]]) array([[[1, 3, 2], [2, 1, 3], [3, 2, 1]], [[4, 6, 5], [5, 4, 6], [6, 5, 4]]])