EVCRH

Computes all of the eigenvalues and eigenvectors of a real upper Hessenberg matrix.

Required Arguments

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.

Optional Arguments

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).

FORTRAN 90 Interface

Generic: CALL EVCRH (A, EVAL, EVEC [,])

Specific: The specific interface names are S_EVCRH and D_EVCRH.

FORTRAN 77 Interface

Single: CALL EVCRH (N, A, LDA, EVAL, EVEC, LDEVEC)

Double: The double precision name is DEVCRH.

Description

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).

Comments

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

Description

4

1

The iteration for the eigenvalues failed to converge.

Example

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 2.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, 2.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

Output

 

EVAL

1 2 3 4

(1.722, 0.000) (-0.651,0.759) (-0.651, -0.759) (0.581,0.000)

 

EVEC

1 2 3 4

1 (-0.3733, 0.0000) (-0.4330, 0.5044) (-0.4330,-0.5044) (-0.3194, 0.0000)

2 (-0.2168, 0.0000) ( 0.6648, 0.0000) ( 0.6648, 0.0000) (-0.5500, 0.0000)

3 ( 0.7800, 0.0000) (-0.2317,-0.0663) (-0.2317, 0.0663) ( 0.3875, 0.0000)

4 ( 0.4530, 0.0000) ( 0.1006, 0.2190) ( 0.1006,-0.2190) ( 0.6673, 0.0000)

 

Performance index = 0.026