gftool.linearprediction.companion

gftool.linearprediction.companion(a)[source]

Create a companion matrix.

Create the companion matrix [1] associated with the polynomial whose coefficients are given in a.

Parameters:
a(…, N) array_like

1-D array of polynomial coefficients. The length of a must be at least two, and a[0] must not be zero.

Returns:
(…, N-1, N-1) ndarray

The first row of c is -a[1:]/a[0], and the first sub-diagonal is all ones. The data-type of the array is the same as the data-type of 1.0*a[0].

Raises:
ValueError

If any of the following are true: a) a.size < 2; b) a[0] == 0.

Notes

Modified version of SciPy, contribute it back

References

[1]

R. A. Horn & C. R. Johnson, Matrix Analysis. Cambridge, UK: Cambridge University Press, 1999, pp. 146-7.