Вы находитесь на странице: 1из 3

Eigenvalues and (Optionally) Eigenvectors of Ax = lx

Real General Problem Ax = lx

All eigenvalues EVLRG


All eigenvalues and eigenvectors EVCRG
Performance index EPIRG
Complex General Problem Ax = lx

All eigenvalues EVLCG


All eigenvalues and eigenvectors EVCCG
Performance index EPICG

--------------------------------------------

EVCRG/DEVCRG (Single/Double precision)

Compute all of the eigenvalues and eigenvectors of a real matrix.


Usage
CALL EVCRG (N, A, LDA, EVAL, EVEC, LDEVEC)
Arguments
N � Order of the matrix. (Input)
A � Floating-point array containing the matrix. (Input)
LDA � Leading dimension of A exactly as specified in the dimension statement of the
calling program. (Input)
EVAL � Complex array of size N containing the eigenvalues of A in decreasing order
of magnitude. (Output)
EVEC � Complex array containing the matrix of eigenvectors. (Output)
The J-th eigenvector, corresponding to EVAL(J), is stored in the J-th column. Each
vector is normalized to have Euclidean length equal to the value one.
LDEVEC � Leading dimension of EVEC exactly as specified in the dimension statement
of the calling program. (Input)
Comments
1. Automatic workspace usage is
EVCRG 2N * (N + 1) + 8N units, or
DEVCRG 4N * (N + 1) + 13N + N
Workspace may be explicitly provided, if desired, by use of E8CRG/DE8CRG. The
reference is:
CALL E8CRG (N, A, LDA, EVAL, EVEC, LDEVEC, ACOPY,
ECOPY WK,IWK)
The additional arguments are as follows:
ACOPY � Floating-point work array of size N by N. The arrays A and ACOPY may be the
same, in which case the first N2 elements of A will be destroyed. The array ACOPY
can have its working row dimension increased from N to a larger value. An optional
usage is required. See Item 3 below for further details.
ECOPY � Floating-point work array of default size N by N + 1. The working, leading
dimension of ECOPY is the same as that for ACOPY. To increase this value, an
optional usage is required. See Item 3 below for further details.
WK � Floating-point work array of size 6N.
IWK � Integer work array of size N.
2. Informational error
Type Code
4 1 The iteration for the eigenvalues failed to converge. No eigenvalues or
eigenvectors are computed.
3. Integer Options with Utilities Options Manager
1 This option uses eight values to solve memory bank conflict (access
inefficiency) problems. In routine E8CRG, the internal or working leading
dimensions of ACOPY and ECOPY are both increased by IVAL(3) when N is a multiple of
IVAL(4). The values IVAL(3) and IVAL(4) are temporarily replaced by IVAL(1) and
IVAL(2), respectively, in routine EVCRG. Additional memory allocation and option
value restoration are automatically done in EVCRG. There is no requirement that
users change existing applications that use EVCRG or E8CRG. Default values for the
option are IVAL(*) = 1, 16, 0, 1, 1, 16, 0, 1. Items 5-8 in IVAL(*) are for the
generalized eigenvalue problem and are not used in EVCRG.
Algorithm
Routine EVCRG computes the eigenvalues and eigenvectors of a real matrix. The
matrix is first balanced. Orthogonal similarity transformations are used to reduce
the balanced matrix to a real upper Hessenberg matrix. The implicit double-shifted
QR algorithm is used to compute the eigenvalues and eigenvectors of this Hessenberg
matrix. The eigenvectors are normalized such that each has Euclidean length of
value one. The largest component is real and positive.
The balancing routine is based on the EISPACK routine BALANC. The reduction routine
is based on the EISPACK routines ORTHES and ORTRAN. The QR algorithm routine is
based on the EISPACK routine HQR2. See Smith et al. (1976) for the EISPACK
routines. Further details, some timing data, and credits are given in Hanson et al.
(1990).
Example
In this example, a DATA statement is used to set A to a matrix given by Gregory and
Karney (1969, page 82). The eigenvalues and eigenvectors of this real matrix are
computed and printed. The performance index is also computed and printed. This
serves as a check on the computations. For more details, see IMSL routine EPIRG.

C Declare variables
INTEGER LDA, LDEVEC, N
PARAMETER (N=3, LDA=N, LDEVEC=N)

INTEGER NOUT
REAL PI
COMPLEX EVAL(N), EVEC(LDEVEC,N)

REAL A(LDA,N)
EXTERNAL EVCRG, UMACH, WRCRN, EPIRG
REAL EPIRG
C Define values of A:
C
C A = ( 8.0 -1.0 -5.0 )
C ( -4.0 4.0 -2.0 )
C ( 18.0 -5.0 -7.0 )
C
DATA A/8.0, -4.0, 18.0, -1.0, 4.0, -5.0, -5.0, -2.0, -7.0/
C
C Find eigenvalues and vectors of A
CALL EVCRG (N, A, LDA, EVAL, EVEC, LDEVEC)
C Compute performance index
PI = EPIRG(N,N,A,LDA,EVAL,EVEC,LDEVEC)
C Print results
CALL UMACH (2, NOUT)
CALL WRCRN ('EVAL', 1, N, EVAL, 1, 0)
CALL WRCRN ('EVEC', N, N, EVEC, LDEVEC, 0)
WRITE (NOUT,'(/,A,F6.3)') ' Performance index = ', PI
END

Output

EVAL
1 2 3
( 2.000, 4.000) ( 2.000,-4.000) ( 1.000, 0.000)

EVEC
1 2 3
1 ( 0.3162, 0.3162) ( 0.3162,-0.3162) ( 0.4082, 0.0000)
2 ( 0.0000, 0.6325) ( 0.0000,-0.6325) ( 0.8165, 0.0000)
3 ( 0.6325, 0.0000) ( 0.6325, 0.0000) ( 0.4082, 0.0000)

Performance index = 0.037

Вам также может понравиться