jax.scipy.linalg.fiedler_companion#
- jax.scipy.linalg.fiedler_companion(a)[source]#
Construct a Fiedler companion matrix.
JAX implementation of
scipy.linalg.fiedler_companion().Given polynomial coefficients \(a = [a_0, a_1, \ldots, a_{n}]\) with \(a_0 \neq 0\), this constructs a pentadiagonal matrix whose eigenvalues coincide with the roots of the polynomial. The result is similar to
companion()but with a sparser, banded structure.- Parameters:
a (ArrayLike) – array of shape
(..., N)specifying the polynomial coefficients in descending order. The last axis must have nonzero length. ForN == 1an empty(0, 0)matrix is returned along that slice.- Raises:
ValueError – if the last axis of
ahas length zero.- Returns:
A Fiedler companion matrix of shape
(..., N - 1, N - 1).- Return type:
Note
Unlike
scipy.linalg.fiedler_companion(), this function does not check at runtime thata[..., 0]is non-zero; if the leading coefficient is zero, the result will containinfornanentries.Examples
>>> a = jnp.array([1., -16., 86., -176., 105.]) >>> jax.scipy.linalg.fiedler_companion(a) Array([[ 16., -86., 1., 0.], [ 1., 0., 0., 0.], [ 0., 176., 0., -105.], [ 0., 1., 0., 0.]], dtype=float32)