IMSL Mathematics Reference Guide > Eigensystem Analysis > EIG Function (PV-WAVE Advantage)
  

EIG Function (PV-WAVE Advantage)
Computes the eigenexpansion of a real or complex matrix A. If the matrix is known to be symmetric or Hermitian, a keyword can be used to trigger more efficient algorithms.
Usage
result = EIG(a)
Input Parameters
a—Two-dimensional matrix containing the data.
Returned Value
result—A one-dimensional matrix containing the complex eigenvalues of the matrix.
Input Keywords
Double—If present and nonzero, double precision is used.
Symmetric—If present and nonzero, a is assumed to be symmetric in the real case and Hermitian in the complex case. Using keyword Symmetric triggers the use of a more appropriate algorithm for symmetric and Hermitian matrices.
Lower_Limit—Used with the keywords Upper_Limit and Symmetric to force the function EIG to return the eigenvalues and optionally, eigenvectors that lie in the interval with lower limit Lower_Limit and upper limit Upper_Limit. This keyword can be used only in those cases when Symmetric and Upper_Limit also are specified. Default: (Lower_Limit, Upper_Limit) = (–infinity, +infinity)
Upper_Limit—Used with the keywords Lower_Limit and Symmetric to force the function EIG to return the eigenvalues and optionally, eigenvectors that lie in the interval with lower limit Lower_Limit and upper limit Upper_Limit. This keyword can be used only in those cases when Symmetric and Lower_Limit also are specified. Default: (Lower_Limit, Upper_Limit) = (–infinity, +infinity)
Output Keywords
Vectors—Specifies the named variable into which the two-dimensional array containing the eigenvectors of the matrix a is stored.
Number—Number of eigenvalues and eigenvectors in the range (Lower_LimitUpper_Limit). This keyword is only available if the keyword Symmetric also is used. To use this keyword, Number and Symmetric must be used.
Discussion
If A is a real, general matrix, function EIG computes the eigenvalues of A by a two-phase process. The matrix is reduced to upper Hessenberg form by elementary orthogonal or Gauss similarity transformations. Then, the eigenvalues are computed using a QR or combined LR-QR algorithm (Golub and Van Loan 1989, pp. 373–382, and Watkins and Elsner 1990). The combined LR‑QR algorithm is based on an implementation by Jeff Haag and David Watkins. Eigenvectors are then calculated as required. When eigenvectors are computed, the QR algorithm is used to compute the eigenexpansion. When only eigenvalues are required, the combined LR-QR algorithm is used.
If A is a complex, general matrix, function EIG computes the eigenvalues of A by a two-phase process. The matrix is reduced to upper Hessenberg form by elementary Gauss transformations. Then, the eigenvalues are computed using an explicitly shifted LR algorithm. Eigenvectors are calculated during the iterations for the eigenvalues (Martin and Wilkinson 1971).
If A is a real, symmetric matrix and keyword Symmetric is used, function EIG computes the eigenvalues of A by a two-phase process. The matrix is reduced to tridiagonal form by elementary orthogonal similarity transformations. Then, the eigenvalues are computed using a rational QR or bisection algorithm. Eigenvectors are calculated as required (see Parlett 1980, pp. 169–173).
If A is a complex, Hermitian matrix and keyword Symmetric is used, function EIG computes the eigenvalues of A by a two-phase process. The matrix is reduced to tridiagonal form by elementary orthogonal similarity transformations. Then, the eigenvalues are computed using a rational QR or bisection algorithm. Eigenvectors are calculated as required.
If keyword Symmetric is used, it is possible to force function EIG to return the eigenvalues and optionally, eigenvectors that lie in a specified interval. The interval is defined using keywords Lower_Limit and Upper_Limit. The Number keyword is provided to return the number of elements of the returned array that contain valid eigenvalues. The first Number elements of the returned array contain the computed eigenvalues, and all remaining elements contain NaN (Not a Number).
Example 1
In this example, the eigenvalues of a real 3-by-3 matrix are computed.
; Define the matrix.
RM, a, 3, 3
row 0:  8  -1  -5
row 1: -4   4  -2
row 2: 18  -5  -7
; Call EIG to compute the eigenvalues.
eigval = EIG(a)
; Output the results.
PM, eigval, Title = 'Eigenvalues of A'
; PV-WAVE prints the following:
; Eigenvalues of A
; ( 2.00000,  4.00001)
; ( 2.00000, -4.00001)
; ( 1.00000,  0.00000)
Example 2: Computing Eigenvectors
This example is a variation of the first example. Here, the eigenvectors are computed as well as the eigenvalues.
; Define the 3-by-3 matrix.
RM, a, 3, 3
row 0:  8 -1 -5
row 1: -4  4 -2
row 2: 18 -5 -7
; Call EIG using keyword Vectors to specify named variable into
; which the eigenvectors are stored.
eigval = EIG(a, Vectors = eigvec)
; Output the eigenvalues.
PM, eigval, Title = 'Eigenvalues of A'
; PV-WAVE prints the following:
; Eigenvalues of A
; ( 2.00000,  4.00000)
; ( 2.00000, -4.00000)
; ( 1.00001,  0.00000)
PM, eigvec, Title = 'Eigenvectors of A'
; Output the eigenvectors.
; PV-WAVE prints the following:
; Eigenvectors of A
; ( 0.316228, 0.316228)( 0.316228, -0.316228)
; ( 0.408248, 0.00000)
; ( 2.08616e-07, 0.632455)( 2.08616e-07, -0.632455)
; ( 0.816497, 0.00000)
; ( 0.632456, 0.00000)( 0.632456, 0.00000)
; ( 0.408247, 0.00000)
Example 3: Computing Eigenvalues of a Complex Matrix
; Define a complex matrix.
RM, a, 4, 4, /Complex
row 0: (5, 9) (5,  5) (-6, -6) (-7, -7)
row 1: (3, 3) (6, 10) (-5, -5) (-6, -6)
row 2: (2, 2) (3,  3) (-1,  3) (-5, -5)
row 3: (1, 1) (2,  2) (-3, -3) ( 0,  4)
; Call EIG to compute the eigenvalues.
eigval = EIG(a)
; Output the results.
PM, eigval, Title = 'Eigenvalues of A'
; PV-WAVE prints the following:
; Eigenvalues of A
; ( 4.00000, 8.00000)
; ( 3.00000, 7.00000)
; ( 2.00000, 6.00000)
; ( 1.00000, 5.00000)
Warning Errors
MATH_SLOW_CONVERGENCE_GEN—Iteration for an eigenvalue did not converge after # iterations.

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.