/src/igraph/vendor/lapack/dlaqrb.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* -- translated by f2c (version 20191129). |
2 | | You must link the resulting object file with libf2c: |
3 | | on Microsoft Windows system, link with libf2c.lib; |
4 | | on Linux or Unix systems, link with .../path/to/libf2c.a -lm |
5 | | or, if you install libf2c.a in a standard place, with -lf2c -lm |
6 | | -- in that order, at the end of the command line, as in |
7 | | cc *.o -lf2c -lm |
8 | | Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., |
9 | | |
10 | | http://www.netlib.org/f2c/libf2c.zip |
11 | | */ |
12 | | |
13 | | #include "f2c.h" |
14 | | |
15 | | /* Table of constant values */ |
16 | | |
17 | | static integer c__1 = 1; |
18 | | |
19 | | /* ----------------------------------------------------------------------- |
20 | | \BeginDoc |
21 | | |
22 | | \Name: dlaqrb |
23 | | |
24 | | \Description: |
25 | | Compute the eigenvalues and the Schur decomposition of an upper |
26 | | Hessenberg submatrix in rows and columns ILO to IHI. Only the |
27 | | last component of the Schur vectors are computed. |
28 | | |
29 | | This is mostly a modification of the LAPACK routine dlahqr. |
30 | | |
31 | | \Usage: |
32 | | call dlaqrb |
33 | | ( WANTT, N, ILO, IHI, H, LDH, WR, WI, Z, INFO ) |
34 | | |
35 | | \Arguments |
36 | | WANTT Logical variable. (INPUT) |
37 | | = .TRUE. : the full Schur form T is required; |
38 | | = .FALSE.: only eigenvalues are required. |
39 | | |
40 | | N Integer. (INPUT) |
41 | | The order of the matrix H. N >= 0. |
42 | | |
43 | | ILO Integer. (INPUT) |
44 | | IHI Integer. (INPUT) |
45 | | It is assumed that H is already upper quasi-triangular in |
46 | | rows and columns IHI+1:N, and that H(ILO,ILO-1) = 0 (unless |
47 | | ILO = 1). SLAQRB works primarily with the Hessenberg |
48 | | submatrix in rows and columns ILO to IHI, but applies |
49 | | transformations to all of H if WANTT is .TRUE.. |
50 | | 1 <= ILO <= max(1,IHI); IHI <= N. |
51 | | |
52 | | H Double precision array, dimension (LDH,N). (INPUT/OUTPUT) |
53 | | On entry, the upper Hessenberg matrix H. |
54 | | On exit, if WANTT is .TRUE., H is upper quasi-triangular in |
55 | | rows and columns ILO:IHI, with any 2-by-2 diagonal blocks in |
56 | | standard form. If WANTT is .FALSE., the contents of H are |
57 | | unspecified on exit. |
58 | | |
59 | | LDH Integer. (INPUT) |
60 | | The leading dimension of the array H. LDH >= max(1,N). |
61 | | |
62 | | WR Double precision array, dimension (N). (OUTPUT) |
63 | | WI Double precision array, dimension (N). (OUTPUT) |
64 | | The real and imaginary parts, respectively, of the computed |
65 | | eigenvalues ILO to IHI are stored in the corresponding |
66 | | elements of WR and WI. If two eigenvalues are computed as a |
67 | | complex conjugate pair, they are stored in consecutive |
68 | | elements of WR and WI, say the i-th and (i+1)th, with |
69 | | WI(i) > 0 and WI(i+1) < 0. If WANTT is .TRUE., the |
70 | | eigenvalues are stored in the same order as on the diagonal |
71 | | of the Schur form returned in H, with WR(i) = H(i,i), and, if |
72 | | H(i:i+1,i:i+1) is a 2-by-2 diagonal block, |
73 | | WI(i) = sqrt(H(i+1,i)*H(i,i+1)) and WI(i+1) = -WI(i). |
74 | | |
75 | | Z Double precision array, dimension (N). (OUTPUT) |
76 | | On exit Z contains the last components of the Schur vectors. |
77 | | |
78 | | INFO Integer. (OUPUT) |
79 | | = 0: successful exit |
80 | | > 0: SLAQRB failed to compute all the eigenvalues ILO to IHI |
81 | | in a total of 30*(IHI-ILO+1) iterations; if INFO = i, |
82 | | elements i+1:ihi of WR and WI contain those eigenvalues |
83 | | which have been successfully computed. |
84 | | |
85 | | \Remarks |
86 | | 1. None. |
87 | | |
88 | | ----------------------------------------------------------------------- |
89 | | |
90 | | \BeginLib |
91 | | |
92 | | \Local variables: |
93 | | xxxxxx real |
94 | | |
95 | | \Routines called: |
96 | | dlabad LAPACK routine that computes machine constants. |
97 | | dlamch LAPACK routine that determines machine constants. |
98 | | dlanhs LAPACK routine that computes various norms of a matrix. |
99 | | dlanv2 LAPACK routine that computes the Schur factorization of |
100 | | 2 by 2 nonsymmetric matrix in standard form. |
101 | | dlarfg LAPACK Householder reflection construction routine. |
102 | | dcopy Level 1 BLAS that copies one vector to another. |
103 | | drot Level 1 BLAS that applies a rotation to a 2 by 2 matrix. |
104 | | |
105 | | \Author |
106 | | Danny Sorensen Phuong Vu |
107 | | Richard Lehoucq CRPC / Rice University |
108 | | Dept. of Computational & Houston, Texas |
109 | | Applied Mathematics |
110 | | Rice University |
111 | | Houston, Texas |
112 | | |
113 | | \Revision history: |
114 | | xx/xx/92: Version ' 2.4' |
115 | | Modified from the LAPACK routine dlahqr so that only the |
116 | | last component of the Schur vectors are computed. |
117 | | |
118 | | \SCCS Information: @(#) |
119 | | FILE: laqrb.F SID: 2.2 DATE OF SID: 8/27/96 RELEASE: 2 |
120 | | |
121 | | \Remarks |
122 | | 1. None |
123 | | |
124 | | \EndLib |
125 | | |
126 | | ----------------------------------------------------------------------- |
127 | | |
128 | | Subroutine */ int igraphdlaqrb_(logical *wantt, integer *n, integer *ilo, |
129 | | integer *ihi, doublereal *h__, integer *ldh, doublereal *wr, |
130 | | doublereal *wi, doublereal *z__, integer *info) |
131 | 0 | { |
132 | | /* System generated locals */ |
133 | 0 | integer h_dim1, h_offset, i__1, i__2, i__3, i__4; |
134 | 0 | doublereal d__1, d__2; |
135 | | |
136 | | /* Local variables */ |
137 | 0 | integer i__, j, k, l, m; |
138 | 0 | doublereal s, v[3]; |
139 | 0 | integer i1, i2; |
140 | 0 | doublereal t1, t2, t3, v1, v2, v3, h00, h10, h11, h12, h21, h22, h33, h44; |
141 | 0 | integer nh; |
142 | 0 | doublereal cs; |
143 | 0 | integer nr; |
144 | 0 | doublereal sn, h33s, h44s; |
145 | 0 | integer itn, its; |
146 | 0 | doublereal ulp, sum, tst1, h43h34, unfl, ovfl; |
147 | 0 | extern /* Subroutine */ int igraphdrot_(integer *, doublereal *, integer *, |
148 | 0 | doublereal *, integer *, doublereal *, doublereal *); |
149 | 0 | doublereal work[1]; |
150 | 0 | extern /* Subroutine */ int igraphdcopy_(integer *, doublereal *, integer *, |
151 | 0 | doublereal *, integer *), igraphdlanv2_(doublereal *, doublereal *, |
152 | 0 | doublereal *, doublereal *, doublereal *, doublereal *, |
153 | 0 | doublereal *, doublereal *, doublereal *, doublereal *), igraphdlabad_( |
154 | 0 | doublereal *, doublereal *); |
155 | 0 | extern doublereal igraphdlamch_(char *); |
156 | 0 | extern /* Subroutine */ int igraphdlarfg_(integer *, doublereal *, doublereal *, |
157 | 0 | integer *, doublereal *); |
158 | 0 | extern doublereal igraphdlanhs_(char *, integer *, doublereal *, integer *, |
159 | 0 | doublereal *); |
160 | 0 | doublereal smlnum; |
161 | | |
162 | | |
163 | | /* %------------------% |
164 | | | Scalar Arguments | |
165 | | %------------------% |
166 | | |
167 | | |
168 | | %-----------------% |
169 | | | Array Arguments | |
170 | | %-----------------% |
171 | | |
172 | | |
173 | | %------------% |
174 | | | Parameters | |
175 | | %------------% |
176 | | |
177 | | |
178 | | %------------------------% |
179 | | | Local Scalars & Arrays | |
180 | | %------------------------% |
181 | | |
182 | | |
183 | | %--------------------% |
184 | | | External Functions | |
185 | | %--------------------% |
186 | | |
187 | | |
188 | | %----------------------% |
189 | | | External Subroutines | |
190 | | %----------------------% |
191 | | |
192 | | |
193 | | %-----------------------% |
194 | | | Executable Statements | |
195 | | %-----------------------% |
196 | | |
197 | | Parameter adjustments */ |
198 | 0 | h_dim1 = *ldh; |
199 | 0 | h_offset = 1 + h_dim1; |
200 | 0 | h__ -= h_offset; |
201 | 0 | --wr; |
202 | 0 | --wi; |
203 | 0 | --z__; |
204 | | |
205 | | /* Function Body */ |
206 | 0 | *info = 0; |
207 | | |
208 | | /* %--------------------------% |
209 | | | Quick return if possible | |
210 | | %--------------------------% */ |
211 | |
|
212 | 0 | if (*n == 0) { |
213 | 0 | return 0; |
214 | 0 | } |
215 | 0 | if (*ilo == *ihi) { |
216 | 0 | wr[*ilo] = h__[*ilo + *ilo * h_dim1]; |
217 | 0 | wi[*ilo] = 0.; |
218 | 0 | return 0; |
219 | 0 | } |
220 | | |
221 | | /* %---------------------------------------------% |
222 | | | Initialize the vector of last components of | |
223 | | | the Schur vectors for accumulation. | |
224 | | %---------------------------------------------% */ |
225 | | |
226 | 0 | i__1 = *n - 1; |
227 | 0 | for (j = 1; j <= i__1; ++j) { |
228 | 0 | z__[j] = 0.; |
229 | | /* L5: */ |
230 | 0 | } |
231 | 0 | z__[*n] = 1.; |
232 | |
|
233 | 0 | nh = *ihi - *ilo + 1; |
234 | | |
235 | | /* %-------------------------------------------------------------% |
236 | | | Set machine-dependent constants for the stopping criterion. | |
237 | | | If norm(H) <= sqrt(OVFL), overflow should not occur. | |
238 | | %-------------------------------------------------------------% */ |
239 | |
|
240 | 0 | unfl = igraphdlamch_("safe minimum"); |
241 | 0 | ovfl = 1. / unfl; |
242 | 0 | igraphdlabad_(&unfl, &ovfl); |
243 | 0 | ulp = igraphdlamch_("precision"); |
244 | 0 | smlnum = unfl * (nh / ulp); |
245 | | |
246 | | /* %---------------------------------------------------------------% |
247 | | | I1 and I2 are the indices of the first row and last column | |
248 | | | of H to which transformations must be applied. If eigenvalues | |
249 | | | only are computed, I1 and I2 are set inside the main loop. | |
250 | | | Zero out H(J+2,J) = ZERO for J=1:N if WANTT = .TRUE. | |
251 | | | else H(J+2,J) for J=ILO:IHI-ILO-1 if WANTT = .FALSE. | |
252 | | %---------------------------------------------------------------% */ |
253 | |
|
254 | 0 | if (*wantt) { |
255 | 0 | i1 = 1; |
256 | 0 | i2 = *n; |
257 | 0 | i__1 = i2 - 2; |
258 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
259 | 0 | h__[i1 + i__ + 1 + i__ * h_dim1] = 0.; |
260 | | /* L8: */ |
261 | 0 | } |
262 | 0 | } else { |
263 | 0 | i__1 = *ihi - *ilo - 1; |
264 | 0 | for (i__ = 1; i__ <= i__1; ++i__) { |
265 | 0 | h__[*ilo + i__ + 1 + (*ilo + i__ - 1) * h_dim1] = 0.; |
266 | | /* L9: */ |
267 | 0 | } |
268 | 0 | } |
269 | | |
270 | | /* %---------------------------------------------------% |
271 | | | ITN is the total number of QR iterations allowed. | |
272 | | %---------------------------------------------------% */ |
273 | |
|
274 | 0 | itn = nh * 30; |
275 | | |
276 | | /* ------------------------------------------------------------------ |
277 | | The main loop begins here. I is the loop index and decreases from |
278 | | IHI to ILO in steps of 1 or 2. Each iteration of the loop works |
279 | | with the active submatrix in rows and columns L to I. |
280 | | Eigenvalues I+1 to IHI have already converged. Either L = ILO or |
281 | | H(L,L-1) is negligible so that the matrix splits. |
282 | | ------------------------------------------------------------------ */ |
283 | |
|
284 | 0 | i__ = *ihi; |
285 | 0 | L10: |
286 | 0 | l = *ilo; |
287 | 0 | if (i__ < *ilo) { |
288 | 0 | goto L150; |
289 | 0 | } |
290 | | /* %--------------------------------------------------------------% |
291 | | | Perform QR iterations on rows and columns ILO to I until a | |
292 | | | submatrix of order 1 or 2 splits off at the bottom because a | |
293 | | | subdiagonal element has become negligible. | |
294 | | %--------------------------------------------------------------% */ |
295 | 0 | i__1 = itn; |
296 | 0 | for (its = 0; its <= i__1; ++its) { |
297 | | |
298 | | /* %----------------------------------------------% |
299 | | | Look for a single small subdiagonal element. | |
300 | | %----------------------------------------------% */ |
301 | |
|
302 | 0 | i__2 = l + 1; |
303 | 0 | for (k = i__; k >= i__2; --k) { |
304 | 0 | tst1 = (d__1 = h__[k - 1 + (k - 1) * h_dim1], abs(d__1)) + (d__2 = |
305 | 0 | h__[k + k * h_dim1], abs(d__2)); |
306 | 0 | if (tst1 == 0.) { |
307 | 0 | i__3 = i__ - l + 1; |
308 | 0 | tst1 = igraphdlanhs_("1", &i__3, &h__[l + l * h_dim1], ldh, work); |
309 | 0 | } |
310 | | /* Computing MAX */ |
311 | 0 | d__2 = ulp * tst1; |
312 | 0 | if ((d__1 = h__[k + (k - 1) * h_dim1], abs(d__1)) <= max(d__2, |
313 | 0 | smlnum)) { |
314 | 0 | goto L30; |
315 | 0 | } |
316 | | /* L20: */ |
317 | 0 | } |
318 | 0 | L30: |
319 | 0 | l = k; |
320 | 0 | if (l > *ilo) { |
321 | | |
322 | | /* %------------------------% |
323 | | | H(L,L-1) is negligible | |
324 | | %------------------------% */ |
325 | |
|
326 | 0 | h__[l + (l - 1) * h_dim1] = 0.; |
327 | 0 | } |
328 | | |
329 | | /* %-------------------------------------------------------------% |
330 | | | Exit from loop if a submatrix of order 1 or 2 has split off | |
331 | | %-------------------------------------------------------------% */ |
332 | |
|
333 | 0 | if (l >= i__ - 1) { |
334 | 0 | goto L140; |
335 | 0 | } |
336 | | |
337 | | /* %---------------------------------------------------------% |
338 | | | Now the active submatrix is in rows and columns L to I. | |
339 | | | If eigenvalues only are being computed, only the active | |
340 | | | submatrix need be transformed. | |
341 | | %---------------------------------------------------------% */ |
342 | | |
343 | 0 | if (! (*wantt)) { |
344 | 0 | i1 = l; |
345 | 0 | i2 = i__; |
346 | 0 | } |
347 | |
|
348 | 0 | if (its == 10 || its == 20) { |
349 | | |
350 | | /* %-------------------% |
351 | | | Exceptional shift | |
352 | | %-------------------% */ |
353 | |
|
354 | 0 | s = (d__1 = h__[i__ + (i__ - 1) * h_dim1], abs(d__1)) + (d__2 = |
355 | 0 | h__[i__ - 1 + (i__ - 2) * h_dim1], abs(d__2)); |
356 | 0 | h44 = s * .75; |
357 | 0 | h33 = h44; |
358 | 0 | h43h34 = s * -.4375 * s; |
359 | |
|
360 | 0 | } else { |
361 | | |
362 | | /* %-----------------------------------------% |
363 | | | Prepare to use Wilkinson's double shift | |
364 | | %-----------------------------------------% */ |
365 | |
|
366 | 0 | h44 = h__[i__ + i__ * h_dim1]; |
367 | 0 | h33 = h__[i__ - 1 + (i__ - 1) * h_dim1]; |
368 | 0 | h43h34 = h__[i__ + (i__ - 1) * h_dim1] * h__[i__ - 1 + i__ * |
369 | 0 | h_dim1]; |
370 | 0 | } |
371 | | |
372 | | /* %-----------------------------------------------------% |
373 | | | Look for two consecutive small subdiagonal elements | |
374 | | %-----------------------------------------------------% */ |
375 | |
|
376 | 0 | i__2 = l; |
377 | 0 | for (m = i__ - 2; m >= i__2; --m) { |
378 | | |
379 | | /* %---------------------------------------------------------% |
380 | | | Determine the effect of starting the double-shift QR | |
381 | | | iteration at row M, and see if this would make H(M,M-1) | |
382 | | | negligible. | |
383 | | %---------------------------------------------------------% */ |
384 | |
|
385 | 0 | h11 = h__[m + m * h_dim1]; |
386 | 0 | h22 = h__[m + 1 + (m + 1) * h_dim1]; |
387 | 0 | h21 = h__[m + 1 + m * h_dim1]; |
388 | 0 | h12 = h__[m + (m + 1) * h_dim1]; |
389 | 0 | h44s = h44 - h11; |
390 | 0 | h33s = h33 - h11; |
391 | 0 | v1 = (h33s * h44s - h43h34) / h21 + h12; |
392 | 0 | v2 = h22 - h11 - h33s - h44s; |
393 | 0 | v3 = h__[m + 2 + (m + 1) * h_dim1]; |
394 | 0 | s = abs(v1) + abs(v2) + abs(v3); |
395 | 0 | v1 /= s; |
396 | 0 | v2 /= s; |
397 | 0 | v3 /= s; |
398 | 0 | v[0] = v1; |
399 | 0 | v[1] = v2; |
400 | 0 | v[2] = v3; |
401 | 0 | if (m == l) { |
402 | 0 | goto L50; |
403 | 0 | } |
404 | 0 | h00 = h__[m - 1 + (m - 1) * h_dim1]; |
405 | 0 | h10 = h__[m + (m - 1) * h_dim1]; |
406 | 0 | tst1 = abs(v1) * (abs(h00) + abs(h11) + abs(h22)); |
407 | 0 | if (abs(h10) * (abs(v2) + abs(v3)) <= ulp * tst1) { |
408 | 0 | goto L50; |
409 | 0 | } |
410 | | /* L40: */ |
411 | 0 | } |
412 | 0 | L50: |
413 | | |
414 | | /* %----------------------% |
415 | | | Double-shift QR step | |
416 | | %----------------------% */ |
417 | |
|
418 | 0 | i__2 = i__ - 1; |
419 | 0 | for (k = m; k <= i__2; ++k) { |
420 | | |
421 | | /* ------------------------------------------------------------ |
422 | | The first iteration of this loop determines a reflection G |
423 | | from the vector V and applies it from left and right to H, |
424 | | thus creating a nonzero bulge below the subdiagonal. |
425 | | |
426 | | Each subsequent iteration determines a reflection G to |
427 | | restore the Hessenberg form in the (K-1)th column, and thus |
428 | | chases the bulge one step toward the bottom of the active |
429 | | submatrix. NR is the order of G. |
430 | | ------------------------------------------------------------ |
431 | | |
432 | | Computing MIN */ |
433 | 0 | i__3 = 3, i__4 = i__ - k + 1; |
434 | 0 | nr = min(i__3,i__4); |
435 | 0 | if (k > m) { |
436 | 0 | igraphdcopy_(&nr, &h__[k + (k - 1) * h_dim1], &c__1, v, &c__1); |
437 | 0 | } |
438 | 0 | igraphdlarfg_(&nr, v, &v[1], &c__1, &t1); |
439 | 0 | if (k > m) { |
440 | 0 | h__[k + (k - 1) * h_dim1] = v[0]; |
441 | 0 | h__[k + 1 + (k - 1) * h_dim1] = 0.; |
442 | 0 | if (k < i__ - 1) { |
443 | 0 | h__[k + 2 + (k - 1) * h_dim1] = 0.; |
444 | 0 | } |
445 | 0 | } else if (m > l) { |
446 | 0 | h__[k + (k - 1) * h_dim1] = -h__[k + (k - 1) * h_dim1]; |
447 | 0 | } |
448 | 0 | v2 = v[1]; |
449 | 0 | t2 = t1 * v2; |
450 | 0 | if (nr == 3) { |
451 | 0 | v3 = v[2]; |
452 | 0 | t3 = t1 * v3; |
453 | | |
454 | | /* %------------------------------------------------% |
455 | | | Apply G from the left to transform the rows of | |
456 | | | the matrix in columns K to I2. | |
457 | | %------------------------------------------------% */ |
458 | |
|
459 | 0 | i__3 = i2; |
460 | 0 | for (j = k; j <= i__3; ++j) { |
461 | 0 | sum = h__[k + j * h_dim1] + v2 * h__[k + 1 + j * h_dim1] |
462 | 0 | + v3 * h__[k + 2 + j * h_dim1]; |
463 | 0 | h__[k + j * h_dim1] -= sum * t1; |
464 | 0 | h__[k + 1 + j * h_dim1] -= sum * t2; |
465 | 0 | h__[k + 2 + j * h_dim1] -= sum * t3; |
466 | | /* L60: */ |
467 | 0 | } |
468 | | |
469 | | /* %----------------------------------------------------% |
470 | | | Apply G from the right to transform the columns of | |
471 | | | the matrix in rows I1 to min(K+3,I). | |
472 | | %----------------------------------------------------% |
473 | | |
474 | | Computing MIN */ |
475 | 0 | i__4 = k + 3; |
476 | 0 | i__3 = min(i__4,i__); |
477 | 0 | for (j = i1; j <= i__3; ++j) { |
478 | 0 | sum = h__[j + k * h_dim1] + v2 * h__[j + (k + 1) * h_dim1] |
479 | 0 | + v3 * h__[j + (k + 2) * h_dim1]; |
480 | 0 | h__[j + k * h_dim1] -= sum * t1; |
481 | 0 | h__[j + (k + 1) * h_dim1] -= sum * t2; |
482 | 0 | h__[j + (k + 2) * h_dim1] -= sum * t3; |
483 | | /* L70: */ |
484 | 0 | } |
485 | | |
486 | | /* %----------------------------------% |
487 | | | Accumulate transformations for Z | |
488 | | %----------------------------------% */ |
489 | |
|
490 | 0 | sum = z__[k] + v2 * z__[k + 1] + v3 * z__[k + 2]; |
491 | 0 | z__[k] -= sum * t1; |
492 | 0 | z__[k + 1] -= sum * t2; |
493 | 0 | z__[k + 2] -= sum * t3; |
494 | 0 | } else if (nr == 2) { |
495 | | |
496 | | /* %------------------------------------------------% |
497 | | | Apply G from the left to transform the rows of | |
498 | | | the matrix in columns K to I2. | |
499 | | %------------------------------------------------% */ |
500 | |
|
501 | 0 | i__3 = i2; |
502 | 0 | for (j = k; j <= i__3; ++j) { |
503 | 0 | sum = h__[k + j * h_dim1] + v2 * h__[k + 1 + j * h_dim1]; |
504 | 0 | h__[k + j * h_dim1] -= sum * t1; |
505 | 0 | h__[k + 1 + j * h_dim1] -= sum * t2; |
506 | | /* L90: */ |
507 | 0 | } |
508 | | |
509 | | /* %----------------------------------------------------% |
510 | | | Apply G from the right to transform the columns of | |
511 | | | the matrix in rows I1 to min(K+3,I). | |
512 | | %----------------------------------------------------% */ |
513 | |
|
514 | 0 | i__3 = i__; |
515 | 0 | for (j = i1; j <= i__3; ++j) { |
516 | 0 | sum = h__[j + k * h_dim1] + v2 * h__[j + (k + 1) * h_dim1] |
517 | 0 | ; |
518 | 0 | h__[j + k * h_dim1] -= sum * t1; |
519 | 0 | h__[j + (k + 1) * h_dim1] -= sum * t2; |
520 | | /* L100: */ |
521 | 0 | } |
522 | | |
523 | | /* %----------------------------------% |
524 | | | Accumulate transformations for Z | |
525 | | %----------------------------------% */ |
526 | |
|
527 | 0 | sum = z__[k] + v2 * z__[k + 1]; |
528 | 0 | z__[k] -= sum * t1; |
529 | 0 | z__[k + 1] -= sum * t2; |
530 | 0 | } |
531 | | /* L120: */ |
532 | 0 | } |
533 | | /* L130: */ |
534 | 0 | } |
535 | | |
536 | | /* %-------------------------------------------------------% |
537 | | | Failure to converge in remaining number of iterations | |
538 | | %-------------------------------------------------------% */ |
539 | | |
540 | 0 | *info = i__; |
541 | 0 | return 0; |
542 | 0 | L140: |
543 | 0 | if (l == i__) { |
544 | | |
545 | | /* %------------------------------------------------------% |
546 | | | H(I,I-1) is negligible: one eigenvalue has converged | |
547 | | %------------------------------------------------------% */ |
548 | |
|
549 | 0 | wr[i__] = h__[i__ + i__ * h_dim1]; |
550 | 0 | wi[i__] = 0.; |
551 | 0 | } else if (l == i__ - 1) { |
552 | | |
553 | | /* %--------------------------------------------------------% |
554 | | | H(I-1,I-2) is negligible; | |
555 | | | a pair of eigenvalues have converged. | |
556 | | | | |
557 | | | Transform the 2-by-2 submatrix to standard Schur form, | |
558 | | | and compute and store the eigenvalues. | |
559 | | %--------------------------------------------------------% */ |
560 | |
|
561 | 0 | igraphdlanv2_(&h__[i__ - 1 + (i__ - 1) * h_dim1], &h__[i__ - 1 + i__ * |
562 | 0 | h_dim1], &h__[i__ + (i__ - 1) * h_dim1], &h__[i__ + i__ * |
563 | 0 | h_dim1], &wr[i__ - 1], &wi[i__ - 1], &wr[i__], &wi[i__], &cs, |
564 | 0 | &sn); |
565 | 0 | if (*wantt) { |
566 | | |
567 | | /* %-----------------------------------------------------% |
568 | | | Apply the transformation to the rest of H and to Z, | |
569 | | | as required. | |
570 | | %-----------------------------------------------------% */ |
571 | |
|
572 | 0 | if (i2 > i__) { |
573 | 0 | i__1 = i2 - i__; |
574 | 0 | igraphdrot_(&i__1, &h__[i__ - 1 + (i__ + 1) * h_dim1], ldh, &h__[ |
575 | 0 | i__ + (i__ + 1) * h_dim1], ldh, &cs, &sn); |
576 | 0 | } |
577 | 0 | i__1 = i__ - i1 - 1; |
578 | 0 | igraphdrot_(&i__1, &h__[i1 + (i__ - 1) * h_dim1], &c__1, &h__[i1 + i__ * |
579 | 0 | h_dim1], &c__1, &cs, &sn); |
580 | 0 | sum = cs * z__[i__ - 1] + sn * z__[i__]; |
581 | 0 | z__[i__] = cs * z__[i__] - sn * z__[i__ - 1]; |
582 | 0 | z__[i__ - 1] = sum; |
583 | 0 | } |
584 | 0 | } |
585 | | |
586 | | /* %---------------------------------------------------------% |
587 | | | Decrement number of remaining iterations, and return to | |
588 | | | start of the main loop with new value of I. | |
589 | | %---------------------------------------------------------% */ |
590 | |
|
591 | 0 | itn -= its; |
592 | 0 | i__ = l - 1; |
593 | 0 | goto L10; |
594 | 0 | L150: |
595 | 0 | return 0; |
596 | | |
597 | | /* %---------------% |
598 | | | End of dlaqrb | |
599 | | %---------------% */ |
600 | |
|
601 | 0 | } /* igraphdlaqrb_ */ |
602 | | |