harold.haroldcompanion¶
-
harold.
haroldcompanion
(somearray)¶ Takes a 1D numpy array or list and returns the companion matrix of the monic polynomial of somearray. Hence
[0.5,1,2]
will be first converted to[1,2,4]
.Examples
>>> haroldcompanion([2,4,6]) array([[ 0., 1.], [-3., -2.]]) >>> haroldcompanion([1,3]) array([[-3.]]) >>> haroldcompanion([1]) array([], dtype=float64)