1      SUBROUTINE HTRIBK(NM,N,AR,AI,TAU,M,ZR,ZI)
2C***BEGIN PROLOGUE  HTRIBK
3C***DATE WRITTEN   760101   (YYMMDD)
4C***REVISION DATE  830518   (YYMMDD)
5C***CATEGORY NO.  D4C4
6C***KEYWORDS  EIGENVALUES,EIGENVECTORS,EISPACK
7C***AUTHOR  SMITH, B. T., ET AL.
8C***PURPOSE  Forms eigenvectors of complex Hermitian matrix from
9C            eigenvectors of real symmetric tridiagonal matrix output
10C            from HTRIDI.
11C***DESCRIPTION
12C
13C     This subroutine is a translation of a complex analogue of
14C     the ALGOL procedure TRBAK1, NUM. MATH. 11, 181-195(1968)
15C     by Martin, Reinsch, and Wilkinson.
16C     HANDBOOK FOR AUTO. COMP., VOL.II-LINEAR ALGEBRA, 212-226(1971).
17C
18C     This subroutine forms the eigenvectors of a COMPLEX HERMITIAN
19C     matrix by back transforming those of the corresponding
20C     real symmetric tridiagonal matrix determined by  HTRIDI.
21C
22C     On INPUT
23C
24C        NM must be set to the row dimension of two-dimensional
25C          array parameters as declared in the calling program
26C          dimension statement.
27C
28C        N is the order of the matrix.
29C
30C        AR and AI contain information about the unitary trans-
31C          formations used in the reduction by  HTRIDI  in their
32C          full lower triangles except for the diagonal of AR.
33C
34C        TAU contains further information about the transformations.
35C
36C        M is the number of eigenvectors to be back transformed.
37C
38C        ZR contains the eigenvectors to be back transformed
39C          in its first M columns.
40C
41C     On OUTPUT
42C
43C        ZR and ZI contain the real and imaginary parts,
44C          respectively, of the transformed eigenvectors
45C          in their first M columns.
46C
47C     Note that the last component of each returned vector
48C     is real and that vector Euclidean norms are preserved.
49C
50C     Questions and comments should be directed to B. S. Garbow,
51C     APPLIED MATHEMATICS DIVISION, ARGONNE NATIONAL LABORATORY
52C     ------------------------------------------------------------------
53C***REFERENCES  B. T. SMITH, J. M. BOYLE, J. J. DONGARRA, B. S. GARBOW,
54C                 Y. IKEBE, V. C. KLEMA, C. B. MOLER, *MATRIX EIGEN-
55C                 SYSTEM ROUTINES - EISPACK GUIDE*, SPRINGER-VERLAG,
56C                 1976.
57C***ROUTINES CALLED  (NONE)
58C***END PROLOGUE  HTRIBK
59C
60      INTEGER I,J,K,L,M,N,NM
61      REAL AR(NM,N),AI(NM,N),TAU(2,N),ZR(NM,M),ZI(NM,M)
62      REAL H,S,SI
63C
64C***FIRST EXECUTABLE STATEMENT  HTRIBK
65      IF (M .EQ. 0) GO TO 200
66C     .......... TRANSFORM THE EIGENVECTORS OF THE REAL SYMMETRIC
67C                TRIDIAGONAL MATRIX TO THOSE OF THE HERMITIAN
68C                TRIDIAGONAL MATRIX. ..........
69      DO 50 K = 1, N
70C
71         DO 50 J = 1, M
72            ZI(K,J) = -ZR(K,J) * TAU(2,K)
73            ZR(K,J) = ZR(K,J) * TAU(1,K)
74   50 CONTINUE
75C
76      IF (N .EQ. 1) GO TO 200
77C     .......... RECOVER AND APPLY THE HOUSEHOLDER MATRICES ..........
78      DO 140 I = 2, N
79         L = I - 1
80         H = AI(I,I)
81         IF (H .EQ. 0.0E0) GO TO 140
82C
83         DO 130 J = 1, M
84            S = 0.0E0
85            SI = 0.0E0
86C
87            DO 110 K = 1, L
88               S = S + AR(I,K) * ZR(K,J) - AI(I,K) * ZI(K,J)
89               SI = SI + AR(I,K) * ZI(K,J) + AI(I,K) * ZR(K,J)
90  110       CONTINUE
91C     .......... DOUBLE DIVISIONS AVOID POSSIBLE UNDERFLOW ..........
92            S = (S / H) / H
93            SI = (SI / H) / H
94C
95            DO 120 K = 1, L
96               ZR(K,J) = ZR(K,J) - S * AR(I,K) - SI * AI(I,K)
97               ZI(K,J) = ZI(K,J) - SI * AR(I,K) + S * AI(I,K)
98  120       CONTINUE
99C
100  130    CONTINUE
101C
102  140 CONTINUE
103C
104  200 RETURN
105      END
106