scipy.linalg.companion

scipy.linalg.companion(a)

Create a companion matrix.

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

Parameters :

a : array-like, 1D

Polynomial coefficients. The length of a must be at least two, and a[0] must not be zero.

Returns :

c : ndarray

A square ndarray with shape (n-1, n-1), where n is the length of a. The first row of c is -a[1:]/a[0], and the first subdiagonal is all ones. The data type of the array is the same as the data type of 1.0*a[0].

Notes

New in version 0.8.0.

Examples

>>> companion([1, -10, 31, -30]) 
array([[ 10., -31.,  30.],
       [  1.,   0.,   0.],
       [  0.,   1.,   0.]])

Previous topic

scipy.linalg.circulant

Next topic

scipy.linalg.hadamard

This Page