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