1 SUBROUTINE sexchqz(NMAX, N, A, B, Z, L, LS1, LS2, EPS, FAIL)
2 INTEGER nmax, n, l, ls1, ls2
3 REAL a(nmax,n), b(nmax,n), z(nmax,n),
eps
29 INTEGER i, j, l1, l2, l3, li, lj, ll, it1, it2
30 REAL u(3,3),
d, e,
f, g, sa, sb, a11b11, a21b11,
32 * a22b22, ammbmm, anmbmm, amnbnn, bmnbnn, annbnn, tempr
43 IF (
abs(a(l1,l1)).GE.
f) altb = .false.
46 f = sa*b(l,l) - sb*a(l,l)
48 g = sa*b(l,l1) - sb*a(l,l1)
49 CALL slartg(
f, g,
d, e,tempr)
50 CALL srot(l1, a(1,l), 1, a(1,l1), 1, e, -
d)
51 CALL srot(l1, b(1,l), 1, b(1,l1), 1, e, -
d)
52 CALL srot(n, z(1,l), 1, z(1,l1), 1, e, -
d)
54 IF (altb) CALL slartg(b(l,l), b(l1,l),
d, e,tempr)
55 IF (.NOT.altb) CALL slartg(a(l,l), a(l1,l),
d, e,tempr)
56 CALL srot(n-l+1, a(l,l), nmax, a(l1,l), nmax,
d, e)
57 CALL srot(n-l+1, b(l,l), nmax, b(l1,l), nmax,
d, e)
65 IF (ls1.EQ.2) go to 60
68 IF (
abs(a(l,l)).LT.g) go to 20
70 CALL slartg(a(l1,l1), a(l2,l1),
d, e,tempr)
71 CALL srot(n-l, a(l1,l1), nmax, a(l2,l1), nmax,
d, e)
72 CALL srot(n-l, b(l1,l1), nmax, b(l2,l1), nmax,
d, e)
81 u(i,j) = sa*b(li,lj) - sb*a(li,lj)
84 CALL slartg(u(3,1), u(3,2),
d, e,tempr)
85 CALL srot(3, u(1,1), 1, u(1,2), 1, e, -
d)
87 CALL slartg(u(1,1), u(2,1),
d, e,tempr)
88 u(2,2) = -u(1,2)*e + u(2,2)*
d
89 CALL srot(n-l+1, a(l,l), nmax, a(l1,l), nmax,
d, e)
90 CALL srot(n-l+1, b(l,l), nmax, b(l1,l), nmax,
d, e)
92 IF (altb) CALL slartg(b(l1,l), b(l1,l1),
d, e,tempr)
93 IF (.NOT.altb) CALL slartg(a(l1,l), a(l1,l1),
d, e,tempr)
94 CALL srot(l2, a(1,l), 1, a(1,l1), 1, e, -
d)
95 CALL srot(l2, b(1,l), 1, b(1,l1), 1, e, -
d)
96 CALL srot(n, z(1,l), 1, z(1,l1), 1, e, -
d)
98 CALL slartg(u(2,2), u(3,2),
d, e,tempr)
99 CALL srot(n-l+1, a(l1,l), nmax, a(l2,l), nmax,
d, e)
100 CALL srot(n-l+1, b(l1,l), nmax, b(l2,l), nmax,
d, e)
102 IF (altb) CALL slartg(b(l2,l1), b(l2,l2),
d, e,tempr)
103 IF (.NOT.altb) CALL slartg(a(l2,l1), a(l2,l2),
d, e,tempr)
104 CALL srot(l2, a(1,l1), 1, a(1,l2), 1, e, -
d)
105 CALL srot(l2, b(1,l1), 1, b(1,l2), 1, e, -
d)
106 CALL srot(n, z(1,l1), 1, z(1,l2), 1, e, -
d)
108 CALL slartg(b(l,l), b(l1,l),
d, e,tempr)
109 CALL srot(n-l+1, a(l,l), nmax, a(l1,l), nmax,
d, e)
110 CALL srot(n-l+1, b(l,l), nmax, b(l1,l), nmax,
d, e)
121 60
IF (ls2.EQ.2) go to 110
124 IF (
abs(a(l2,l2)).LT.g) go to 70
126 CALL slartg(a(l,l), a(l1,l),
d, e,tempr)
127 CALL srot(n-l+1, a(l,l), nmax, a(l1,l), nmax,
d, e)
128 CALL srot(n-l+1, b(l,l), nmax, b(l1,l), nmax,
d, e)
137 u(i,j) = sa*b(li,lj) - sb*a(li,lj)
140 CALL slartg(u(1,1), u(2,1),
d, e,tempr)
141 CALL srot(3, u(1,1), 3, u(2,1), 3,
d, e)
143 CALL slartg(u(2,2), u(2,3),
d, e,tempr)
144 u(1,2) = u(1,2)*e - u(1,3)*
d
145 CALL srot(l2, a(1,l1), 1, a(1,l2), 1, e, -
d)
146 CALL srot(l2, b(1,l1), 1, b(1,l2), 1, e, -
d)
147 CALL srot(n, z(1,l1), 1, z(1,l2), 1, e, -
d)
149 IF (altb) CALL slartg(b(l1,l1), b(l2,l1),
d, e,tempr)
150 IF (.NOT.altb) CALL slartg(a(l1,l1), a(l2,l1),
d, e,tempr)
151 CALL srot(n-l+1, a(l1,l), nmax, a(l2,l), nmax,
d, e)
152 CALL srot(n-l+1, b(l1,l), nmax, b(l2,l), nmax,
d, e)
154 CALL slartg(u(1,1), u(1,2),
d, e,tempr)
155 CALL srot(l2, a(1,l), 1, a(1,l1), 1, e, -
d)
156 CALL srot(l2, b(1,l), 1, b(1,l1), 1, e, -
d)
157 CALL srot(n, z(1,l), 1, z(1,l1), 1, e, -
d)
159 IF (altb) CALL slartg(b(l,l), b(l1,l),
d, e,tempr)
160 IF (.NOT.altb) CALL slartg(a(l,l), a(l1,l),
d, e,tempr)
161 CALL srot(n-l+1, a(l,l), nmax, a(l1,l), nmax,
d, e)
162 CALL srot(n-l+1, b(l,l), nmax, b(l1,l), nmax,
d, e)
164 CALL slartg(b(l1,l1), b(l2,l1),
d, e,tempr)
165 CALL srot(n-l, a(l1,l1), nmax, a(l2,l1), nmax,
d, e)
166 CALL srot(n-l, b(l1,l1), nmax, b(l2,l1), nmax,
d, e)
181 ammbmm = a(l,l)/b(l,l)
182 anmbmm = a(l1,l)/b(l,l)
183 amnbnn = a(l,l1)/b(l1,l1)
184 annbnn = a(l1,l1)/b(l1,l1)
185 bmnbnn = b(l,l1)/b(l1,l1)
192 CALL slartg(u(2,1), u(3,1),
d, e,tempr)
193 CALL srot(n-l+1, a(l1,l), nmax, a(l2,l), nmax,
d, e)
194 CALL srot(n-l, b(l1,l1), nmax, b(l2,l1), nmax,
d, e)
195 u(2,1) =
d*u(2,1) + e*u(3,1)
196 CALL slartg(u(1,1), u(2,1),
d, e,tempr)
197 CALL srot(n-l+1, a(l,l), nmax, a(l1,l), nmax,
d, e)
198 CALL srot(n-l+1, b(l,l), nmax, b(l1,l), nmax,
d, e)
200 CALL slartg(b(l2,l1), b(l2,l2),
d, e,tempr)
201 CALL srot(l3, a(1,l1), 1, a(1,l2), 1, e, -
d)
202 CALL srot(l2, b(1,l1), 1, b(1,l2), 1, e, -
d)
203 CALL srot(n, z(1,l1), 1, z(1,l2), 1, e, -
d)
204 CALL slartg(b(l1,l), b(l1,l1),
d, e,tempr)
205 CALL srot(l3, a(1,l), 1, a(1,l1), 1, e, -
d)
206 CALL srot(l1, b(1,l), 1, b(1,l1), 1, e, -
d)
207 CALL srot(n, z(1,l), 1, z(1,l1), 1, e, -
d)
210 CALL slartg(a(l2,l), a(l3,l),
d, e,tempr)
211 CALL srot(n-l+1, a(l2,l), nmax, a(l3,l), nmax,
d, e)
212 CALL srot(n-l1, b(l2,l2), nmax, b(l3,l2), nmax,
d, e)
213 CALL slartg(b(l3,l2), b(l3,l3),
d, e,tempr)
214 CALL srot(l3, a(1,l2), 1, a(1,l3), 1, e, -
d)
215 CALL srot(l3, b(1,l2), 1, b(1,l3), 1, e, -
d)
216 CALL srot(n, z(1,l2), 1, z(1,l3), 1, e, -
d)
217 CALL slartg(a(l1,l), a(l2,l),
d, e,tempr)
218 CALL srot(n-l+1, a(l1,l), nmax, a(l2,l), nmax,
d, e)
219 CALL srot(n-l, b(l1,l1), nmax, b(l2,l1), nmax,
d, e)
220 CALL slartg(b(l2,l1), b(l2,l2),
d, e,tempr)
221 CALL srot(l3, a(1,l1), 1, a(1,l2), 1, e, -
d)
222 CALL srot(l2, b(1,l1), 1, b(1,l2), 1, e, -
d)
223 CALL srot(n, z(1,l1), 1, z(1,l2), 1, e, -
d)
224 CALL slartg(a(l2,l1), a(l3,l1),
d, e,tempr)
225 CALL srot(n-l, a(l2,l1), nmax, a(l3,l1), nmax,
d, e)
226 CALL srot(n-l1, b(l2,l2), nmax, b(l3,l2), nmax,
d, e)
227 CALL slartg(b(l3,l2), b(l3,l3),
d, e,tempr)
228 CALL srot(l3, a(1,l2), 1, a(1,l3), 1, e, -
d)
229 CALL srot(l3, b(1,l2), 1, b(1,l3), 1, e, -
d)
230 CALL srot(n, z(1,l2), 1, z(1,l3), 1, e, -
d)
232 IF (
abs(a(l2,l1)).LE.
eps) go to 140
234 a11b11 = a(l,l)/b(l,l)
235 a12b22 = a(l,l1)/b(l1,l1)
236 a21b11 = a(l1,l)/b(l,l)
237 a22b22 = a(l1,l1)/b(l1,l1)
238 b12b22 = b(l,l1)/b(l1,l1)
239 u(1,1) = ((ammbmm-a11b11)*(annbnn-a11b11)-amnbnn*
240 * anmbmm+anmbmm*bmnbnn*a11b11)/a21b11 + a12b22 - a11b11*b12b22
241 u(2,1) = (a22b22-a11b11) - a21b11*b12b22 - (ammbmm-a11b11) -
242 * (annbnn-a11b11) + anmbmm*bmnbnn
243 u(3,1) = a(l2,l1)/b(l1,l1)