>  Docs Center  >  IDL Reference  >  Advanced Math and Stats  >  IMSL_EIG

IMSL_EIG

IMSL_EIG

The IMSL_EIG function 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.

This routine requires an IDL Advanced Math and Stats license. For more information, contact your sales or technical support representative.

If A is a real, general matrix, the IMSL_EIG function 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, the IMSL_EIG function 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 the keyword SYMMETRIC is used, the IMSL_EIG function 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 the keyword SYMMETRIC is used, the IMSL_EIG function 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 the IMSL_EIG function 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).

Examples


Example 1

This example computes the eigenvalues of a real 3-by-3 matrix.

RM, a, 3, 3
; Define the matrix.
row 0: 8 -1 -5
row 1: -4 4 -2
row 2: 18 -5 -7
eigval = IMSL_EIG(a)
 
; Call IMSL_EIG to compute the eigenvalues.
PM, eigval, Title = 'Eigenvalues of A'
 
; Output the results.
Eigenvalues of A
  ( 2.00000, 4.00001)
  ( 2.00000, -4.00001)
  ( 1.00000, 0.00000)

Example 2

This example is a variation of the first example. It computes the eigenvectors as well as the eigenvalues.

RM, a, 3, 3
; Define the 3-by-3 matrix.
row 0: 8 -1 -5
row 1: -4 4 -2
row 2: 18 -5 -7
eigval = IMSL_EIG(a, Vectors = eigvec)
 
; Call IMSL_EIG using keyword Vectors to specify named
; variable into which the eigenvectors are stored.
PM, eigval, Title = 'Eigenvalues of A'
 
; Output the eigenvalues.
Eigenvalues of A
  ( 2.00000, 4.00000)
  ( 2.00000, -4.00000)
  ( 1.00001, 0.00000)
PM, eigvec, Title = 'Eigenvectors of A'
 
; Output the eigenvectors.
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

This example computes Eigenvalues of a complex matrix.

RM, a, 4, 4, /Complex
 
; Define a complex matrix.
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)
eigval = IMSL_EIG(a)
 
; Call IMSL_EIG to compute the eigenvalues.
PM, eigval, Title = 'Eigenvalues of A'
 
; Output the results.
Eigenvalues of A
  ( 4.00000, 8.00000)
  ( 3.00000, 7.00000)
  ( 2.00000, 6.00000)
  ( 1.00000, 5.00000)

Errors


Warnings

MATH_SLOW_CONVERGENCE_GEN: Iteration for an eigenvalue did not converge after # iterations.

Syntax


Result = IMSL_EIG(A [, /DOUBLE] [, /LOWER_LIMIT] [, NUMBER=value] [, SYMMETRIC=value] [, /UPPER_LIMIT] [, VECTORS=variable])

Return Value


A one-dimensional matrix containing the complex eigenvalues of the matrix.

Arguments


A

Two-dimensional matrix containing the data.

Keywords


DOUBLE (optional)

If present and nonzero, double precision is used.

LOWER_LIMIT (optional)

Forces the IMSL_EIG function to return the eigenvalues and, optionally, eigenvectors that lie in the interval within the lower limit LOWER_LIMIT and upper limit UPPER_LIMIT. If LOWER_LIMIT is specified, the keywords UPPER_LIMIT and SYMMETRIC must also be specified. Default: (LOWER_LIMIT, UPPER_LIMIT) = (-infinity, +infinity)

NUMBER (optional)

Number of eigenvalues and eigenvectors in the range (LOWER_LIMIT, UPPER_LIMIT). This keyword is only available if also using the keyword SYMMETRIC.

SYMMETRIC (optional)

If present and nonzero, a is assumed to be symmetric in the real case and Hermitian in the complex case. Using SYMMETRIC triggers the use of a more appropriate algorithm for symmetric and Hermitian matrices.

UPPER_LIMIT (optional)

Forces the IMSL_EIG function to return the eigenvalues and, optionally, eigenvectors that lie in the interval within the lower limit LOWER_LIMIT and upper limit UPPER_LIMIT. If UPPER_LIMIT is specified, SYMMETRIC and LOWER_LIMIT must also be specified. Default: (LOWER_LIMIT, UPPER_LIMIT) = (-infinity, +infinity)

VECTORS (optional)

The named variable into which the two-dimensional array containing the eigenvectors of the matrix a is stored.

Version History


6.4

Introduced

See Also


IMSL_EIGSYMGEN, IMSL_GENEIG



© 2019 Harris Geospatial Solutions, Inc. |  Legal
My Account    |    Store    |    Contact Us