The EIGENVEC function computes the eigenvectors of an n-by-n real, non-symmetric array using Inverse Subspace Iteration. 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.

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

## Examples

`; 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, 'Eigenvalues: 'PRINT, evalevec = EIGENVEC(A, eval, RESIDUAL = residual); Eigenvectors are not generally unique.; Multiply each eigenvector by a complex scaling; factor to force the initial term to be real.  ; This normalization ensures a unique solution.FOR i=0,3 DO evec[*,i] *= ABS(evec[0,i])/evec[0,i]PRINT, 'Eigenvectors:'PRINT, evec, FORMAT='(4("(",f8.5,",",f8.5,") "))'PRINT, 'Residuals:'FOR i=0,3 DO print, A ## evec[*,i] - eval[i]*evec[*,i], \$    FORMAT ='(4("(",g9.2,",",g9.2,") "))'`

IDL prints:

`Eigenvalues: `
`(0.26366252,-6.1925900)(0.26366252,6.1925900)`
`(-4.9384492,0.00000000)(0.411124050.00000000)`
`% Compiled module: EIGENVEC.`
`Eigenvectors:`
`( 0.42919, 0.00000) (-0.32241, 0.41235) `
`( 0.29827, 0.54013) ( 0.23222, 0.32739) `
`( 0.42919, 0.00000) (-0.32241,-0.41235) `
`( 0.29827,-0.54013) ( 0.23222,-0.32739) `
`( 0.54966, 0.00000) ( 0.18401, 0.00000) `
`( 0.58125, 0.00000) (-0.57111, 0.00000) `
`( 0.79297, 0.00000) ( 0.50289, 0.00000) `
`(-0.04962, 0.00000) ( 0.34035, 0.00000) `
`Residuals:`
`( 3.1e-008, 2.9e-008) (-5.1e-008, 7.8e-009) `
`(-1.5e-008, 5.9e-008) (-5.5e-009, 3.9e-008) `
`( 3.1e-008,-2.9e-008) (-5.1e-008,-7.8e-009) `
`(-1.5e-008,-5.9e-008) (-5.5e-009,-3.9e-008) `
`(-1.1e-007,     0.00) ( 7.9e-009,     0.00) `
`( 2.5e-008,     0.00) (-2.4e-008,     0.00) `
`(-5.0e-008,     0.00) (-6.1e-008,     0.00) `
`( 1.5e-010,     0.00) (-4.2e-008,     0.00) `

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

Note: Different machines may produce slightly different results.

## Syntax

Result = EIGENVEC( A, Eval [, /DOUBLE] [, ITMAX=value] [, RESIDUAL=variable] )

## Return Value

This function returns a complex array with a column dimension equal to n and a row dimension equal to the number of eigenvalues.

## 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 (λ/x) pair. The residual is based on the definition Ax – λ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.

## Version History

 4 Introduced