The EIGENQL function computes the eigenvalues and eigenvectors of an n by n real, symmetric array using Householder reductions and the QL method with implicit shifts. The result is an n -element vector containing the eigenvalues.
Set this keyword to sort the eigenvalues by their absolute value (their magnitude) rather than by their signed value.
Set this keyword to return eigenvalues in ascending order (smallest to largest). If not set or set to zero, eigenvalues are returned in descending order (largest to smallest). The eigenvectors are correspondingly reordered.
Set this keyword equal to a named variable that will contain the computed eigenvectors in an n by n array. The i th row of the returned array contains the i th eigenvalue. This keyword must be initialized to a non- zero value before calling EIGENQL if the eigenvectors are desired. If no variable is supplied, the array will not be computed.
Set this keyword to use the input array for internal storage and to overwrite its previous contents.
Use this keyword to specify a named variable that will contain the residuals for each eigenvalue/eigenvector ( l /x) pair. The residual is based on the definition Ax - ( l )x = 0 and is an array of the same size as A and the same type as Result. The rows of this array correspond to the residuals for each eigenvalue/eigenvector pair. This keyword must be initialized to a non- zero value before calling EIGENQL if the residuals are desired.
Define an n by n real, symmetric array:
A = [[ 5.0, 4.0, 0.0, -3.0], $
residual = 1 & evecs = 1 ; The variables that will contain the residuals and eigenvectors must be initialized as nonzero values prior to calling EIGENQL.
eigenvalues = EIGENQL(A, EIGENVECTORS = evecs, RESIDUAL = residual)
;
Compute the eigenvalues and eigenvectors.
PRINT, eigenvalues ; Print the eigenvalues/.
12.0915 6.18661 1.00000 0.721870
-0.554531 -0.554531 -0.241745 0.571446
0.342981 0.342981 -0.813186 0.321646
0.707107 -0.707107 -2.58096e-08 0.00000
0.273605 0.273605 0.529422 0.754979
The accuracy of each eigenvalue/eigenvector ( l /x) pair may be checked by printing the residual array:
The RESIDUAL array has the same dimensions as the input array and the same type as the result. The residuals are contained in the rows of the RESIDUAL array. All residual values should be floating-point zeros.