## EIGENVEC

The EIGENVEC function computes the eigenvectors of an n by n real, non-symmetric array using Inverse Subspace Iteration. The result is a complex array with a column dimension equal to n and a row dimension equal to the number of eigenvalues. Use ELMHES and HQR to find the eigenvalues of an n by n real, nonsymmetric array.

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

### Calling Sequence

Result = EIGENVEC( A, Eval )

### Arguments

#### A

An n by n nonsymmetric, single- or double-precision floating-point array.

#### EVAL

An n -element complex vector of eigenvalues.

### Keywords

#### DOUBLE

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

#### ITMAX

The maximum number of iterations allowed in the computation of each eigenvector. The default value is 4.

#### RESIDUAL

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 A x - l x = 0 and is an array of the same size and type as that returned by the function. The rows of this array correspond to the residuals for each eigenvalue/eigenvector pair.

NOTE: This keyword must be initialized to a non-zero value before calling EIGENVEC if the residuals are desired.

### Example

Define an n by n real, nonsymmetric array.

A = [[1.0, -2.0, -4.0,  1.0], \$

[0.0, -2.0,  3.0,  4.0], \$

[2.0, -6.0, -1.0,  4.0], \$

[3.0, -3.0,  1.0, -2.0]]

Compute the eigenvalues of A using double-precision complex arithmetic and print the result:

eval = HQR(ELMHES(A), /DOUBLE)

PRINT, eval

IDL prints:

(  0.26366255, -6.1925899)(  0.26366255, 6.1925899)

(  -4.9384492,  0.0000000)(  0.41112406, 0.0000000)

Compute the eigenvectors of A. The eigenvectors are returned in the rows of the resulting array.

residual = 1 ; Note that the RESIDUAL array must be initialized to a nonzero value.

evec = EIGENVEC(A, eval, RESIDUAL = residual)

Print the eigenvectors.

PRINT, evec[*,0], evec[*,1], evec[*,2], evec[*,3]

IDL prints:

( 0.0076733129,  -0.42912489)(  0.40651652,  0.32973069)

(   0.54537624,  -0.28856257)(  0.33149359, -0.22632585)

(  -0.42145884, -0.081113711)(  0.23867007,  0.46584824)

(  -0.39497143,   0.47402647)( -0.28990600,  0.27760747)

(  -0.54965842,    0.0000000)( -0.18401243,   0.0000000)

(  -0.58124548,    0.0000000)(  0.57111192,   0.0000000)

(   0.79297048,    0.0000000)(  0.50289130,   0.0000000)

( -0.049618509,    0.0000000)(  0.34034720,   0.0000000)

You can check the accuracy of each eigenvalue/eigenvector ( l / x ) pair by printing the residual array. All residual values should be floating-point zeros.