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.

This routine is written in the IDL language. Its source code can be found in the file eigenql.pro in the lib subdirectory of the IDL distribution.

**Note: **If you are working with complex inputs, use the LA_EIGENQL function instead.

## Examples

; Define an n-by-n real, symmetric array:

A = [[ 5.0, 4.0, 0.0, -3.0], $

[ 4.0, 5.0, 0.0, -3.0], $

[ 0.0, 0.0, 5.0, -3.0], $

[-3.0, -3.0, -3.0, 5.0]]

; Compute the eigenvalues and eigenvectors:

eigenvalues = EIGENQL(A, EIGENVECTORS = evecs, $

RESIDUAL = residual)

;Print the eigenvalues and eigenvectors:

PRINT, 'Eigenvalues: '

PRINT, eigenvalues

PRINT, 'Eigenvectors: '

PRINT, evecs

IDL prints:

Eigenvalues:

12.0915 6.18662 1.00000 0.721870

Eigenvectors:

-0.554531 -0.554531 -0.241745 0.571446

-0.342981 -0.342981 0.813186 -0.321646

0.707107 -0.707107 -6.13503e-008-6.46503e-008

0.273605 0.273605 0.529422 0.754979

The accuracy of each eigenvalue/eigenvector (λ/*x*) pair may be checked by printing the residual array:

`PRINT, residual`

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.

## Syntax

*Result* = EIGENQL( *A* [, /ABSOLUTE] [, /ASCENDING] [, /DOUBLE] [, EIGENVECTORS=*variable*] [, /OVERWRITE | , RESIDUAL=*variable*] )

## Return Value

This function returns an *n*-element vector containing the eigenvalues.

## Arguments

### A

An *n*-by-*n* symmetric single- or double-precision floating-point array.

## Keywords

### ABSOLUTE

Set this keyword to sort the eigenvalues by their absolute value (their magnitude) rather than by their signed value.

### ASCENDING

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.

### DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

### EIGENVECTORS

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 eigenvector corresponding to the *i*^{th} eigenvalue. If no variable is supplied, the array will not be computed.

### OVERWRITE

Set this keyword to use the input array for internal storage and to overwrite its previous contents.

### RESIDUAL

Use this keyword to specify a named variable that will contain the residuals for each eigenvalue/eigenvector (λ/*x*) pair. The residual is based on the definition A*x* – (λ)*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.

**Note: **If the OVERWRITE keyword is set, the RESIDUAL keyword has no effect.

## Version History

5.0 |
Introduced |

## See Also

## Notes

This page has no user notes yet. Be the first one!