The LA_EIGENVEC function uses the QR algorithm to compute all or some of the eigenvectors *v* ≠ 0 of an *n*-by-*n* real nonsymmetric or complex non-Hermitian array *A*, for the eigenproblem *Av* = λ*v*. The routine can also compute the left eigenvectors *u* ≠ 0, which satisfy *u ^{H}*

*A*= λ

*u*.

^{H}**Note: **The left and right eigenvectors returned by LA_EIGENVEC are normalized to norm 1. Unlike the LA_EIGENPROBLEM, they are not rotated to have largest component real. Therefore, you may notice slight differences in results between LA_EIGENVEC and LA_EIGENPROBLEM.

LA_EIGENVEC is based on the following LAPACK routines:

Output Type |
Eigenvectors |
Condition Numbers |
Undo Balancing |

Float |
strevc |
strsna |
sgebak |

Double |
dtrevc |
dtrsna |
dgebak |

Complex |
ctrevc |
ctrsna |
cgebak |

Double complex |
ztrevc |
ztrsna |
zgebak |

## Examples

Compute the eigenvalues and selected eigenvectors of a random array using the following program:

`; Create a random array:`

`n = 10`

`seed = 12321`

`array = RANDOMN(seed, n, n)`

`; Reduce to upper Hessenberg and compute Q:`

`H = LA_ELMHES(array, q, $`

PERMUTE_RESULT = permute, SCALE_RESULT = scale)

`; Compute eigenvalues, T, and QZ arrays:`

`eigenvalues = LA_HQR(h, q, PERMUTE_RESULT = permute)`

`; Compute eigenvectors corresponding to`

`; the first 3 eigenvalues.`

select = [1, 1, 1, REPLICATE(0, n - 3)]

`eigenvectors = LA_EIGENVEC(H, Q, $`

EIGENINDEX = eigenindex, $

PERMUTE_RESULT = permute, SCALE_RESULT = scale, $

SELECT = select)

PRINT, 'LA_EIGENVEC eigenvalues:'

`PRINT, eigenvalues[eigenindex]`

When this program is compiled and run, IDL prints:

LA_EIGENVEC eigenvalues:

3.10497, 0.000000)( -1.54790, 2.32300)( -1.54790, -2.32300)

## Syntax

*Result *= LA_EIGENVEC( *T*, *QZ* [, BALANCE=*value*] [, /DOUBLE] [, EIGENINDEX=*variable*] [, LEFT_EIGENVECTORS=*variable*] [, PERMUTE_RESULT=[*ilo*, *ihi*]] [, SCALE_RESULT=*vector*] [, RCOND_VALUE=*variable*] [, RCOND_VECTOR=*variable*] [, SELECT=*vector*])

## Return Value

The result is a complex array containing the eigenvectors as a set of row vectors.

## Arguments

### T

The upper quasi-triangular array containing the Schur form, created by LA_HQR.

### QZ

The array of Schur vectors, created by LA_HQR.

## Keywords

### BALANCE

If balancing was applied in the call to LA_ELMHES, then set this keyword to the same value that was used, in order to apply the backward balancing transform to the eigenvectors. If BALANCE is not specified, then the default is BALANCE = 1.

**Note: **If BALANCE is not zero, then both PERMUTE_RESULT and SCALE_RESULT must be supplied.

### DOUBLE

Set this keyword to use double-precision for computations and to return a double-precision (real or complex) result. Set DOUBLE = 0 to use single-precision for computations and to return a single-precision (real or complex) result. The default is /DOUBLE if *T *is double precision, otherwise the default is DOUBLE = 0.

### EIGENINDEX

If keyword SELECT is used, then set this keyword to a named variable in which the indices of the eigenvalues that correspond to the selected eigenvectors will be returned. If the SELECT keyword is not used then EIGENINDEX will be set to LINDGEN(*n*).

**Tip: **This keyword is most useful for real input arrays when the SELECT keyword is present. In this case, a value of SELECT[*j*] equal to 1 may produce two eigenvectors if the eigenvalue is part of a complex-conjugate pair.

### LEFT_EIGENVECTORS

Set this keyword to a named variable in which the left eigenvectors will be returned as a set of row vectors. If this variable is omitted then left eigenvectors will not be computed unless the RCOND_VALUE keyword is present.

### PERMUTE_RESULT

Set this keyword to a two-element vector containing the [*ilo*, *ihi*] permutation results from the LA_ELMHES procedure. This keyword must be present if BALANCE = 1 or BALANCE = 2.

### RCOND_VALUE

Set this keyword to a named variable in which the reciprocal condition numbers for the eigenvalues will be returned as an *n*-element vector. If RCOND_VALUE is present then left and right eigenvectors must be computed.

### RCOND_VECTOR

Set this keyword to a named variable in which the reciprocal condition numbers for the eigenvectors will be returned as an *n*-element vector.

### SCALE_RESULT

Set this keyword to an n-element vector containing the permute and scale balancing results from the LA_ELMHES procedure. This keyword must be present if BALANCE is not zero.

### SELECT

Set this keyword to an *n*-element vector of zeroes or ones that indicates which eigenvectors to compute. There are two cases:

- The original array was real: If the
*j*-th eigenvalue (as created by LA_HQR) is real, then if SELECT[*j*] is set to 1, then the*j*-th eigenvector will be computed. If the*j*-th and (*j*+1) eigenvalues form a complex-conjugate pair, then if either SELECT[*j*] or SELECT[*j*+1] is set to 1, then the complex-conjugate pair of*j*-th and (*j*+1) eigenvectors will be computed. - The original array was complex: If SELECT[
*j*] is set to 1, then the*j*-th eigenvector will be computed.

If SELECT is omitted then all eigenvectors are returned.

## Version History

5.6 |
Introduced |

## Resources and References

For details see Anderson et al., *LAPACK Users' Guide*, 3rd ed., SIAM, 1999.