The HQR function returns all eigenvalues of an upper Hessenberg array. Using the output produced by the ELMHES function, this function finds all eigenvalues of the original real, nonsymmetric array. The result is an n -element complex vector.
HQR is based on the routine
hqr
described in section 11.6 of
Numerical Recipes in C: The Art of Scientific Computing
(Second Edition), published by Cambridge University Press, and is used by permission.
To compute the eigenvalues of a real, non-symmetric unbalanced array, first define the array A :
A = [[ 1.0, 2.0, 0.0, 0.0, 0.0], $
[ 3.0, 4.0, 50.0, 0.0, 0.0], $
[-4.0, 5.0, -60.0, 7.0, 0.0], $
[-5.0, 6.0, -70.0, 8.0, -9.0]]
hes = ELMHES(A) ; Compute the upper Hessenberg form of the array.
evals = HQR(hes) ; Compute the eigenvalues.
Sort the eigenvalues into ascending order based on their real components:
evals = evals(SORT(FLOAT(evals)))
PRINT, evals ; Print the result.
( -9.00000, 0.00000)( 2.00000, -1.73205)