2 SUBROUTINE TRED2 (NM, N, A, D, E, Z)
3 C***BEGIN PROLOGUE TRED2
4 C***PURPOSE Reduce a real symmetric matrix to a symmetric tridiagonal
5 C matrix using and accumulating orthogonal transformations.
6 C***LIBRARY SLATEC (EISPACK)
8 C***TYPE SINGLE PRECISION (TRED2-S)
9 C***KEYWORDS EIGENVALUES, EIGENVECTORS, EISPACK
10 C***AUTHOR Smith, B. T., et al.
13 C This subroutine is a translation of the ALGOL procedure TRED2,
14 C NUM. MATH. 11, 181-195(1968) by Martin, Reinsch, and Wilkinson.
15 C HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971).
17 C This subroutine reduces a REAL SYMMETRIC matrix to a
18 C symmetric tridiagonal matrix using and accumulating
19 C orthogonal similarity transformations.
23 C NM must be set to the row dimension of the two-dimensional
24 C array parameters, A and Z, as declared in the calling
25 C program dimension statement. NM is an INTEGER variable.
27 C N is the order of the matrix A. N is an INTEGER variable.
28 C N must be less than or equal to NM.
30 C A contains the real symmetric input matrix. Only the lower
31 C triangle of the matrix need be supplied. A is a two-
32 C dimensional REAL array, dimensioned A(NM,N).
36 C D contains the diagonal elements of the symmetric tridiagonal
37 C matrix. D is a one-dimensional REAL array, dimensioned D(N).
39 C E contains the subdiagonal elements of the symmetric
40 C tridiagonal matrix in its last N-1 positions. E(1) is set
41 C to zero. E is a one-dimensional REAL array, dimensioned
44 C Z contains the orthogonal transformation matrix produced in
45 C the reduction. Z is a two-dimensional REAL array,
46 C dimensioned Z(NM,N).
48 C A and Z may coincide. If distinct, A is unaltered.
50 C Questions and comments should be directed to B. S. Garbow,
51 C APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
52 C ------------------------------------------------------------------
54 C***REFERENCES B. T. Smith, J. M. Boyle, J. J. Dongarra, B. S. Garbow,
55 C Y. Ikebe, V. C. Klema and C. B. Moler, Matrix Eigen-
56 C system Routines - EISPACK Guide, Springer-Verlag,
58 C***ROUTINES CALLED (NONE)
59 C***REVISION HISTORY (YYMMDD)
61 C 890831 Modified array declarations. (WRB)
62 C 890831 REVISION DATE from Version 3.2
63 C 891214 Prologue converted to Version 4.0 format. (BAB)
64 C 920501 Reformatted the REFERENCES section. (WRB)
65 C***END PROLOGUE TRED2
67 INTEGER I,J,K,L,N,II,NM,JP1
68 REAL A(NM,*),D(*),E(*),Z(NM,*)
71 C***FIRST EXECUTABLE STATEMENT TRED2
78 IF (N .EQ. 1) GO TO 320
79 C .......... FOR I=N STEP -1 UNTIL 2 DO -- ..........
85 IF (L .LT. 2) GO TO 130
86 C .......... SCALE ROW (ALGOL TOL THEN NOT NEEDED) ..........
88 120 SCALE = SCALE + ABS(Z(I,K))
90 IF (SCALE .NE. 0.0E0) GO TO 140
95 Z(I,K) = Z(I,K) / SCALE
96 H = H + Z(I,K) * Z(I,K)
109 C .......... FORM ELEMENT OF A*U ..........
111 180 G = G + Z(J,K) * Z(I,K)
114 IF (L .LT. JP1) GO TO 220
117 200 G = G + Z(K,J) * Z(I,K)
118 C .......... FORM ELEMENT OF P ..........
120 F = F + E(J) * Z(I,J)
124 C .......... FORM REDUCED A ..........
131 Z(J,K) = Z(J,K) - F * E(K) - G * Z(I,K)
139 C .......... ACCUMULATION OF TRANSFORMATION MATRICES ..........
142 IF (D(I) .EQ. 0.0E0) GO TO 380
148 340 G = G + Z(I,K) * Z(K,J)
151 Z(K,J) = Z(K,J) - G * Z(K,I)
156 IF (L .LT. 1) GO TO 500