bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / linalg / _special_matrices / fiedler_companion
function
scipy.linalg._special_matrices:fiedler_companion
source: build-install/usr/lib/python3.14/site-packages/scipy/linalg/_special_matrices.py:1024
Signature
def fiedler_companion(a)Summary
Returns a Fiedler companion matrix.
Extended Summary
Given a polynomial coefficient array a, this function forms a pentadiagonal matrix with a special structure whose eigenvalues coincides with the roots of a.
Array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details.
The documentation is written assuming array arguments are of specified "core" shapes. However, array argument(s) of this function may have additional "batch" dimensions prepended to the core shape. In this case, the array is treated as a batch of lower-dimensional slices; see linalg_batch for details. The NEP 5 signature of this function is (i)->(i-1,i-1).
Parameters
a: (..., N) array_like1-D array of polynomial coefficients in descending order with a nonzero leading coefficient. For
N < 2, an empty array is returned. N-dimensional arrays are treated as a batch: each slice along the last axis is a 1-D array of polynomial coefficients.
Returns
c: (..., N-1, N-1) ndarrayResulting companion matrix. For batch input, each slice of shape
(N-1, N-1)along the last two dimensions of the output corresponds with a slice of shape(N,)along the last dimension of the input.
Notes
Similar to companion, each leading coefficient along the last axis of the input should be nonzero. If the leading coefficient is not 1, other coefficients are rescaled before the array generation. To avoid numerical issues, it is best to provide a monic polynomial.
Examples
import numpy as np from scipy.linalg import fiedler_companion, eigvals p = np.poly(np.arange(1, 9, 2)) # [1., -16., 86., -176., 105.] fc = fiedler_companion(p) fc eigvals(fc)✓
array([7.+0.j, 5.+0.j, 3.+0.j, 1.+0.j])
See also
Aliases
scipy.linalg.fiedler_companion