Computes all of the eigenvalues and eigenvectors of a real upper Hessenberg matrix.
A — Real upper Hessenberg matrix of order N. (Input)
EVAL — Complex vector of length N containing the eigenvalues in decreasing order of magnitude. (Output)
EVEC — Complex
matrix of order N.
(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.
N — Order of the
matrix A.
(Input)
Default: N = size
(A,2).
LDA — Leading
dimension of A
exactly as specified in the dimension statement in the calling
program. (Input)
Default: LDA = size
(A,1).
LDEVEC — Leading
dimension of EVEC exactly as
specified in the dimension statement in the calling program.
(Input)
Default: LDEVEC = size
(EVEC,1).
Generic: CALL EVCRH (A, EVAL, EVEC [,…])
Specific: The specific interface names are S_EVCRH and D_EVCRH.
Single: CALL EVCRH (N, A, LDA, EVAL, EVEC, LDEVEC)
Double: The double precision name is DEVCRH.
Routine EVCRH computes the eigenvalues and eigenvectors of a real upper Hessenberg matrix by using the QR algorithm. The QR algorithm routine is based on the EISPACK routine HQR2; see Smith et al. (1976).
1. Workspace may be explicitly provided, if desired, by use of E6CRH/DE6CRH. The reference is:
CALL E6CRH (N, A, LDA, EVAL, EVEC, LDEVEC, ACOPY, ECOPY, RWK, IWK)
The additional arguments are as follows:
ACOPY — Real N by N work matrix.
ECOPY — Real N by N work matrix.
RWK — Real array of length 3N.
IWK — Integer array of length N.
2. Informational error
Type Code
4 1 The iteration for the eigenvalues failed to converge.
In this example, a DATA statement is used to set A to a Hessenberg matrix with integer entries. The values are returned in decreasing order of magnitude. The eigenvalues, eigenvectors and performance index of this matrix are computed and printed. See routine EPIRG for details.
USE EVCRH_INT
USE EPIRG_INT
USE UMACH_INT
USE WRCRN_INT
IMPLICIT NONE
! Declare variables
INTEGER LDA, LDEVEC, N
PARAMETER (N=4, LDA=N, LDEVEC=N)
!
INTEGER NOUT
REAL A(LDA,N), PI
COMPLEX EVAL(N), EVEC(LDEVEC,N)
! Define values of A:
!
! A = ( -1.0 -1.0 -1.0 -1.0 )
! ( 1.0 0.0 0.0 0.0 )
! ( 1.0 0.0 0.0 )
! ( 1.0 0.0 )
!
DATA A/-1.0, 1.0, 0.0, 0.0, -1.0, 0.0, 1.0, 0.0, -1.0, 0.0, 0.0, &
1.0, -1.0, 0.0, 0.0, 0.0/
!
! Find eigenvalues and vectors of A
CALL EVCRH (A, EVAL, EVEC)
! Compute performance index
PI = EPIRG(N,A,EVAL,EVEC)
! Print results
CALL UMACH (2, NOUT)
CALL WRCRN ('EVAL', EVAL, 1, N, 1)
CALL WRCRN ('EVEC', EVEC)
WRITE (NOUT,'(/,A,F6.3)') ' Performance index = ', PI
END
EVAL
1 2 3 4
(-0.8090, 0.5878) (-0.8090,-0.5878) ( 0.3090, 0.9511) ( 0.3090,-0.9511)
EVEC
1 2 3 4
1 (-0.4045, 0.2939) (-0.4045,-0.2939) (-0.4045,-0.2939) (-0.4045, 0.2939)
2 ( 0.5000, 0.0000) ( 0.5000, 0.0000) (-0.4045, 0.2939) (-0.4045,-0.2939)
3 (-0.4045,-0.2939) (-0.4045, 0.2939) ( 0.1545, 0.4755) ( 0.1545,-0.4755)
4 ( 0.1545, 0.4755) ( 0.1545,-0.4755) ( 0.5000, 0.0000) ( 0.5000, 0.0000)
Performance index = 0.098
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |