## TRIQL

The TRIQL procedure uses the QL algorithm with implicit shifts to determine the eigenvalues and eigenvectors of a real, symmetric, tridiagonal array. The routine TRIRED can be used to reduce a real, symmetric array to the tridiagonal form suitable for input to this procedure.

TRIQL is based on the routine `tqli` described in section 11.3 of Numerical Recipes in C: The Art of Scientific Computing (Second Edition), published by Cambridge University Press, and is used by permission.

 Note
If you are working with complex inputs, instead use the LA_TRIQL procedure.

### Syntax

TRIQL, D, E, A [, /DOUBLE]

### Arguments

#### D

On input, this argument should be an n-element vector containing the diagonal elements of the array being analyzed. On output, D contains the eigenvalues.

#### E

An n-element vector containing the off-diagonal elements of the array. E0 is arbitrary. On output, this parameter is destroyed.

#### A

A named variable that returns the n eigenvectors. If the eigenvectors of a tridiagonal array are desired, A should be input as an identity array. If the eigenvectors of an array that has been reduced by TRIRED are desired, A is input as the array Q output by TRIRED.

### Keywords

#### DOUBLE

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

### Examples

To compute eigenvalues and eigenvectors of a real, symmetric, tridiagonal array, begin with an array A representing a symmetric array:

```; Create the array A:
A = [[ 3.0,  1.0, -4.0], \$
[ 1.0,  3.0, -4.0], \$
[-4.0, -4.0,  8.0]]

; Compute the tridiagonal form of A:
TRIRED, A, D, E

; Compute the eigenvalues (returned in vector D) and the
; eigenvectors (returned in the rows of the array A):
TRIQL, D, E, A

; Print eigenvalues:
PRINT, 'Eigenvalues:'
PRINT, D

; Print eigenvectors:
PRINT, 'Eigenvectors:'
PRINT, A
```

IDL prints:

```Eigenvalues:
2.00000  4.76837e-7  12.0000

Eigenvectors:
0.707107  -0.707107   0.00000
-0.577350  -0.577350  -0.577350
-0.408248  -0.408248   0.816497
```

The exact eigenvalues are:

```  [2.0, 0.0, 12.0]
```

The exact eigenvectors are:

``` [ 1.0/sqrt(2.0), -1.0/sqrt(2.0), 0.0/sqrt(2.0)],
[-1.0/sqrt(3.0), -1.0/sqrt(3.0), -1.0/sqrt(3.0)],
[-1.0/sqrt(6.0), -1.0/sqrt(6.0), 2.0/sqrt(6.0)]
```

Introduced: 4.0