Roots of a polynomial (complex coefficients) (by computing the eigenvalues of the companion matrix)
Purpose
This routine computes all roots of a polynomial p(z) with complex coefficients by computing the eigenvalues of the companion matrix.
p(z) = a0*z^n + a1*z^(n-1) + ... + an
Parameters
[in]
N
Degree of polynomial. (N >= 1)
[in]
A()
Array A(LA - 1) (LA >= N + 1)
Complex coefficient vector of p(z) (a0 to an).
[out]
Z()
Array Z(LZ - 1) (LZ >= N)
The obtained zeros.
[out]
Info
= 0: Successful exit.
= -1: The argument N had an illegal value. (N <= 0)
= -2: The argument A() is invalid.
= -3: The argument Z() is invalid.
= 1: Failed to converge within maximum number (30) of QR iterations on some eigenvalue of the companion matrix.