Computes the largest or smallest eigenvalues of a real symmetric matrix.
NEVAL — Number of eigenvalues to be computed. (Input)
A — Real symmetric matrix of order N. (Input)
SMALL — Logical
variable. (Input)
If .TRUE., the smallest
NEVAL
eigenvalues are computed. If .FALSE., the largest
NEVAL
eigenvalues are computed.
EVAL — Real vector of length NEVAL containing the eigenvalues of A in decreasing order of magnitude. (Output)
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).
Generic: CALL EVASF (NEVAL, A, SMALL, EVAL [,…])
Specific: The specific interface names are S_EVASF and D_EVASF.
Single: CALL EVASF (N, NEVAL, A, LDA, SMALL, EVAL)
Double: The double precision name is DEVASF.
Routine EVASF computes the largest or smallest eigenvalues of a real symmetric matrix. Orthogonal similarity transformations are used to reduce the matrix to an equivalent symmetric tridiagonal matrix. Then, an implicit rational QR algorithm is used to compute the eigenvalues of this tridiagonal matrix.
The reduction routine is based on the EISPACK routine TRED2. See Smith et al. (1976). The rational QR algorithm is called the PWK algorithm. It is given in Parlett (1980, page 169).
1. Workspace may be explicitly provided, if desired, by use of E4ASF/DE4ASF. The reference is:
CALL E4ASF (N, NEVAL, A, LDA, SMALL, EVAL, WORK, IWK)
WORK — Work array of length 4N.
IWK — Integer work array of length N.
2. Informational error
Type Code
3 1 The iteration for an eigenvalue failed to converge. The best estimate will be returned.
In this example, the three largest eigenvalues of the computed Hilbert matrix aij = 1/(i + j -1) of order N = 10 are computed and printed.
USE EVASF_INT
USE WRRRN_INT
IMPLICIT NONE
! Declare variables
INTEGER LDA, N, NEVAL
PARAMETER (N=10, NEVAL=3, LDA=N)
!
INTEGER I, J
REAL A(LDA,N), EVAL(NEVAL), REAL
LOGICAL SMALL
INTRINSIC REAL
! Set up Hilbert matrix
DO 20 J=1, N
DO 10 I=1, N
A(I,J) = 1.0/REAL(I+J-1)
10 CONTINUE
20 CONTINUE
! Find the 3 largest eigenvalues
SMALL = .FALSE.
CALL EVASF (NEVAL, A, SMALL, EVAL)
! Print results
CALL WRRRN ('EVAL', EVAL, 1, NEVAL, 1)
END
EVAL
1 2 3
1.752 0.343 0.036
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |