| 1 | /* eispack/hqr.f -- translated by f2c (version 20050501). |
| 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 | #ifdef __cplusplus |
| 14 | extern "C" { |
| 15 | #endif |
| 16 | #include "v3p_netlib.h"cxx . . $ `<file>/Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib.h`/ |
| 17 | |
| 18 | /*< subroutine hqr(nm,n,low,igh,h,wr,wi,ierr) >*/ |
| 19 | /* Subroutine */ int hqr_cxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_netlib_mangle.h:178:9`!(integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *nm, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *n, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *low, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *igh, |
| 20 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *h__, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *wr, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *wi, integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! *ierr) |
| 21 | { |
| 22 | /* System generated locals */ |
| 23 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! h_dim1, h_offset, i__1, i__2, i__3; |
| 24 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! d__1, d__2; |
| 25 | |
| 26 | /* Builtin functions */ |
| 27 | double sqrtcxx . . $ sqrt(447c67c6676f75c3).(doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`!), d_signcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:14:9`!(doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *, doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! *); |
| 28 | |
| 29 | /* Local variables */ |
| 30 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! i__, j, k, l=0, m=0; |
| 31 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! p, q=0, r__=0, s, t, w, x, y; |
| 32 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! na, en, ll, mm; |
| 33 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! zz; |
| 34 | integercxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:63:9`! mp2, itn, its, enm2; |
| 35 | doublerealcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:57:9`! tst1, tst2, norm; |
| 36 | logicalcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:65:9`! notlas; |
| 37 | |
| 38 | /* RESTORED CORRECT INDICES OF LOOPS (200,210,230,240). (9/29/89 BSG) */ |
| 39 | |
| 40 | /*< integer i,j,k,l,m,n,en,ll,mm,na,nm,igh,itn,its,low,mp2,enm2,ierr >*/ |
| 41 | /*< double precision h(nm,n),wr(n),wi(n) >*/ |
| 42 | /*< double precision p,q,r,s,t,w,x,y,zz,norm,tst1,tst2 >*/ |
| 43 | /*< logical notlas >*/ |
| 44 | |
| 45 | /* this subroutine is a translation of the algol procedure hqr, */ |
| 46 | /* num. math. 14, 219-231(1970) by martin, peters, and wilkinson. */ |
| 47 | /* handbook for auto. comp., vol.ii-linear algebra, 359-371(1971). */ |
| 48 | |
| 49 | /* this subroutine finds the eigenvalues of a real */ |
| 50 | /* upper hessenberg matrix by the qr method. */ |
| 51 | |
| 52 | /* on input */ |
| 53 | |
| 54 | /* nm must be set to the row dimension of two-dimensional */ |
| 55 | /* array parameters as declared in the calling program */ |
| 56 | /* dimension statement. */ |
| 57 | |
| 58 | /* n is the order of the matrix. */ |
| 59 | |
| 60 | /* low and igh are integers determined by the balancing */ |
| 61 | /* subroutine balanc. if balanc has not been used, */ |
| 62 | /* set low=1, igh=n. */ |
| 63 | |
| 64 | /* h contains the upper hessenberg matrix. information about */ |
| 65 | /* the transformations used in the reduction to hessenberg */ |
| 66 | /* form by elmhes or orthes, if performed, is stored */ |
| 67 | /* in the remaining triangle under the hessenberg matrix. */ |
| 68 | |
| 69 | /* on output */ |
| 70 | |
| 71 | /* h has been destroyed. therefore, it must be saved */ |
| 72 | /* before calling hqr if subsequent calculation and */ |
| 73 | /* back transformation of eigenvectors is to be performed. */ |
| 74 | |
| 75 | /* wr and wi contain the real and imaginary parts, */ |
| 76 | /* respectively, of the eigenvalues. the eigenvalues */ |
| 77 | /* are unordered except that complex conjugate pairs */ |
| 78 | /* of values appear consecutively with the eigenvalue */ |
| 79 | /* having the positive imaginary part first. if an */ |
| 80 | /* error exit is made, the eigenvalues should be correct */ |
| 81 | /* for indices ierr+1,...,n. */ |
| 82 | |
| 83 | /* ierr is set to */ |
| 84 | /* zero for normal return, */ |
| 85 | /* j if the limit of 30*n iterations is exhausted */ |
| 86 | /* while the j-th eigenvalue is being sought. */ |
| 87 | |
| 88 | /* questions and comments should be directed to burton s. garbow, */ |
| 89 | /* mathematics and computer science div, argonne national laboratory */ |
| 90 | |
| 91 | /* this version dated september 1989. */ |
| 92 | |
| 93 | /* ------------------------------------------------------------------ */ |
| 94 | |
| 95 | /*< ierr = 0 >*/ |
| 96 | /* Parameter adjustments */ |
| 97 | --wi; |
| 98 | --wr; |
| 99 | h_dim1 = *nm; |
| 100 | h_offset = 1 + h_dim1; |
| 101 | h__ -= h_offset; |
| 102 | |
| 103 | /* Function Body */ |
| 104 | *ierr = 0; |
| 105 | /*< norm = 0.0d0 >*/ |
| 106 | norm = 0.; |
| 107 | /*< k = 1 >*/ |
| 108 | k = 1; |
| 109 | /* .......... store roots isolated by balanc */ |
| 110 | /* and compute matrix norm .......... */ |
| 111 | /*< do 50 i = 1, n >*/ |
| 112 | i__1 = *n; |
| 113 | for (i__ = 1; i__ <= i__1; ++i__) { |
| 114 | |
| 115 | /*< do 40 j = k, n >*/ |
| 116 | i__2 = *n; |
| 117 | for (j = k; j <= i__2; ++j) { |
| 118 | /*< 40 norm = norm + dabs(h(i,j)) >*/ |
| 119 | /* L40: */ |
| 120 | norm += (d__1 = h__[i__ + j * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)); |
| 121 | } |
| 122 | |
| 123 | /*< k = i >*/ |
| 124 | k = i__; |
| 125 | /*< if (i .ge. low .and. i .le. igh) go to 50 >*/ |
| 126 | if (i__ >= *low && i__ <= *igh) { |
| 127 | goto L50; |
| 128 | } |
| 129 | /*< wr(i) = h(i,i) >*/ |
| 130 | wr[i__] = h__[i__ + i__ * h_dim1]; |
| 131 | /*< wi(i) = 0.0d0 >*/ |
| 132 | wi[i__] = 0.; |
| 133 | /*< 50 continue >*/ |
| 134 | L50: |
| 135 | ; |
| 136 | } |
| 137 | |
| 138 | /*< en = igh >*/ |
| 139 | en = *igh; |
| 140 | /*< t = 0.0d0 >*/ |
| 141 | t = 0.; |
| 142 | /*< itn = 30*n >*/ |
| 143 | itn = *n * 30; |
| 144 | /* .......... search for next eigenvalues .......... */ |
| 145 | /*< 60 if (en .lt. low) go to 1001 >*/ |
| 146 | L60: |
| 147 | if (en < *low) { |
| 148 | goto L1001; |
| 149 | } |
| 150 | /*< its = 0 >*/ |
| 151 | its = 0; |
| 152 | /*< na = en - 1 >*/ |
| 153 | na = en - 1; |
| 154 | /*< enm2 = na - 1 >*/ |
| 155 | enm2 = na - 1; |
| 156 | /* .......... look for single small sub-diagonal element */ |
| 157 | /* for l=en step -1 until low do -- .......... */ |
| 158 | /*< 70 do 80 ll = low, en >*/ |
| 159 | L70: |
| 160 | i__1 = en; |
| 161 | for (ll = *low; ll <= i__1; ++ll) { |
| 162 | /*< l = en + low - ll >*/ |
| 163 | l = en + *low - ll; |
| 164 | /*< if (l .eq. low) go to 100 >*/ |
| 165 | if (l == *low) { |
| 166 | goto L100; |
| 167 | } |
| 168 | /*< s = dabs(h(l-1,l-1)) + dabs(h(l,l)) >*/ |
| 169 | s = (d__1 = h__[l - 1 + (l - 1) * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)) + (d__2 = h__[l |
| 170 | + l * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__2)); |
| 171 | /*< if (s .eq. 0.0d0) s = norm >*/ |
| 172 | if (s == 0.) { |
| 173 | s = norm; |
| 174 | } |
| 175 | /*< tst1 = s >*/ |
| 176 | tst1 = s; |
| 177 | /*< tst2 = tst1 + dabs(h(l,l-1)) >*/ |
| 178 | tst2 = tst1 + (d__1 = h__[l + (l - 1) * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)); |
| 179 | /*< if (tst2 .eq. tst1) go to 100 >*/ |
| 180 | if (tst2 == tst1) { |
| 181 | goto L100; |
| 182 | } |
| 183 | /*< 80 continue >*/ |
| 184 | /* L80: */ |
| 185 | } |
| 186 | /* .......... form shift .......... */ |
| 187 | /*< 100 x = h(en,en) >*/ |
| 188 | L100: |
| 189 | x = h__[en + en * h_dim1]; |
| 190 | /*< if (l .eq. en) go to 270 >*/ |
| 191 | if (l == en) { |
| 192 | goto L270; |
| 193 | } |
| 194 | /*< y = h(na,na) >*/ |
| 195 | y = h__[na + na * h_dim1]; |
| 196 | /*< w = h(en,na) * h(na,en) >*/ |
| 197 | w = h__[en + na * h_dim1] * h__[na + en * h_dim1]; |
| 198 | /*< if (l .eq. na) go to 280 >*/ |
| 199 | if (l == na) { |
| 200 | goto L280; |
| 201 | } |
| 202 | /*< if (itn .eq. 0) go to 1000 >*/ |
| 203 | if (itn == 0) { |
| 204 | goto L1000; |
| 205 | } |
| 206 | /*< if (its .ne. 10 .and. its .ne. 20) go to 130 >*/ |
| 207 | if (its != 10 && its != 20) { |
| 208 | goto L130; |
| 209 | } |
| 210 | /* .......... form exceptional shift .......... */ |
| 211 | /*< t = t + x >*/ |
| 212 | t += x; |
| 213 | |
| 214 | /*< do 120 i = low, en >*/ |
| 215 | i__1 = en; |
| 216 | for (i__ = *low; i__ <= i__1; ++i__) { |
| 217 | /*< 120 h(i,i) = h(i,i) - x >*/ |
| 218 | /* L120: */ |
| 219 | h__[i__ + i__ * h_dim1] -= x; |
| 220 | } |
| 221 | |
| 222 | /*< s = dabs(h(en,na)) + dabs(h(na,enm2)) >*/ |
| 223 | s = (d__1 = h__[en + na * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)) + (d__2 = h__[na + enm2 * |
| 224 | h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__2)); |
| 225 | /*< x = 0.75d0 * s >*/ |
| 226 | x = s * .75; |
| 227 | /*< y = x >*/ |
| 228 | y = x; |
| 229 | /*< w = -0.4375d0 * s * s >*/ |
| 230 | w = s * -.4375 * s; |
| 231 | /*< 130 its = its + 1 >*/ |
| 232 | L130: |
| 233 | ++its; |
| 234 | /*< itn = itn - 1 >*/ |
| 235 | --itn; |
| 236 | /* .......... look for two consecutive small */ |
| 237 | /* sub-diagonal elements. */ |
| 238 | /* for m=en-2 step -1 until l do -- .......... */ |
| 239 | /*< do 140 mm = l, enm2 >*/ |
| 240 | i__1 = enm2; |
| 241 | for (mm = l; mm <= i__1; ++mm) { |
| 242 | /*< m = enm2 + l - mm >*/ |
| 243 | m = enm2 + l - mm; |
| 244 | /*< zz = h(m,m) >*/ |
| 245 | zz = h__[m + m * h_dim1]; |
| 246 | /*< r = x - zz >*/ |
| 247 | r__ = x - zz; |
| 248 | /*< s = y - zz >*/ |
| 249 | s = y - zz; |
| 250 | /*< p = (r * s - w) / h(m+1,m) + h(m,m+1) >*/ |
| 251 | p = (r__ * s - w) / h__[m + 1 + m * h_dim1] + h__[m + (m + 1) * |
| 252 | h_dim1]; |
| 253 | /*< q = h(m+1,m+1) - zz - r - s >*/ |
| 254 | q = h__[m + 1 + (m + 1) * h_dim1] - zz - r__ - s; |
| 255 | /*< r = h(m+2,m+1) >*/ |
| 256 | r__ = h__[m + 2 + (m + 1) * h_dim1]; |
| 257 | /*< s = dabs(p) + dabs(q) + dabs(r) >*/ |
| 258 | s = abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(p) + abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(q) + abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(r__); |
| 259 | /*< p = p / s >*/ |
| 260 | p /= s; |
| 261 | /*< q = q / s >*/ |
| 262 | q /= s; |
| 263 | /*< r = r / s >*/ |
| 264 | r__ /= s; |
| 265 | /*< if (m .eq. l) go to 150 >*/ |
| 266 | if (m == l) { |
| 267 | goto L150; |
| 268 | } |
| 269 | /*< tst1 = dabs(p)*(dabs(h(m-1,m-1)) + dabs(zz) + dabs(h(m+1,m+1))) >*/ |
| 270 | tst1 = abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(p) * ((d__1 = h__[m - 1 + (m - 1) * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)) + |
| 271 | abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(zz) + (d__2 = h__[m + 1 + (m + 1) * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__2))); |
| 272 | /*< tst2 = tst1 + dabs(h(m,m-1))*(dabs(q) + dabs(r)) >*/ |
| 273 | tst2 = tst1 + (d__1 = h__[m + (m - 1) * h_dim1], abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(d__1)) * (abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(q) |
| 274 | + abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(r__)); |
| 275 | /*< if (tst2 .eq. tst1) go to 150 >*/ |
| 276 | if (tst2 == tst1) { |
| 277 | goto L150; |
| 278 | } |
| 279 | /*< 140 continue >*/ |
| 280 | /* L140: */ |
| 281 | } |
| 282 | |
| 283 | /*< 150 mp2 = m + 2 >*/ |
| 284 | L150: |
| 285 | mp2 = m + 2; |
| 286 | |
| 287 | /*< do 160 i = mp2, en >*/ |
| 288 | i__1 = en; |
| 289 | for (i__ = mp2; i__ <= i__1; ++i__) { |
| 290 | /*< h(i,i-2) = 0.0d0 >*/ |
| 291 | h__[i__ + (i__ - 2) * h_dim1] = 0.; |
| 292 | /*< if (i .eq. mp2) go to 160 >*/ |
| 293 | if (i__ == mp2) { |
| 294 | goto L160; |
| 295 | } |
| 296 | /*< h(i,i-3) = 0.0d0 >*/ |
| 297 | h__[i__ + (i__ - 3) * h_dim1] = 0.; |
| 298 | /*< 160 continue >*/ |
| 299 | L160: |
| 300 | ; |
| 301 | } |
| 302 | /* .......... double qr step involving rows l to en and */ |
| 303 | /* columns m to en .......... */ |
| 304 | /*< do 260 k = m, na >*/ |
| 305 | i__1 = na; |
| 306 | for (k = m; k <= i__1; ++k) { |
| 307 | /*< notlas = k .ne. na >*/ |
| 308 | notlas = k != na; |
| 309 | /*< if (k .eq. m) go to 170 >*/ |
| 310 | if (k == m) { |
| 311 | goto L170; |
| 312 | } |
| 313 | /*< p = h(k,k-1) >*/ |
| 314 | p = h__[k + (k - 1) * h_dim1]; |
| 315 | /*< q = h(k+1,k-1) >*/ |
| 316 | q = h__[k + 1 + (k - 1) * h_dim1]; |
| 317 | /*< r = 0.0d0 >*/ |
| 318 | r__ = 0.; |
| 319 | /*< if (notlas) r = h(k+2,k-1) >*/ |
| 320 | if (notlas) { |
| 321 | r__ = h__[k + 2 + (k - 1) * h_dim1]; |
| 322 | } |
| 323 | /*< x = dabs(p) + dabs(q) + dabs(r) >*/ |
| 324 | x = abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(p) + abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(q) + abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(r__); |
| 325 | /*< if (x .eq. 0.0d0) go to 260 >*/ |
| 326 | if (x == 0.) { |
| 327 | goto L260; |
| 328 | } |
| 329 | /*< p = p / x >*/ |
| 330 | p /= x; |
| 331 | /*< q = q / x >*/ |
| 332 | q /= x; |
| 333 | /*< r = r / x >*/ |
| 334 | r__ /= x; |
| 335 | /*< 170 s = dsign(dsqrt(p*p+q*q+r*r),p) >*/ |
| 336 | L170: |
| 337 | d__1 = sqrtcxx . . $ sqrt(447c67c6676f75c3).(p * p + q * q + r__ * r__); |
| 338 | s = d_signcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:14:9`!(&d__1, &p); |
| 339 | /*< if (k .eq. m) go to 180 >*/ |
| 340 | if (k == m) { |
| 341 | goto L180; |
| 342 | } |
| 343 | /*< h(k,k-1) = -s * x >*/ |
| 344 | h__[k + (k - 1) * h_dim1] = -s * x; |
| 345 | /*< go to 190 >*/ |
| 346 | goto L190; |
| 347 | /*< 180 if (l .ne. m) h(k,k-1) = -h(k,k-1) >*/ |
| 348 | L180: |
| 349 | if (l != m) { |
| 350 | h__[k + (k - 1) * h_dim1] = -h__[k + (k - 1) * h_dim1]; |
| 351 | } |
| 352 | /*< 190 p = p + s >*/ |
| 353 | L190: |
| 354 | p += s; |
| 355 | /*< x = p / s >*/ |
| 356 | x = p / s; |
| 357 | /*< y = q / s >*/ |
| 358 | y = q / s; |
| 359 | /*< zz = r / s >*/ |
| 360 | zz = r__ / s; |
| 361 | /*< q = q / p >*/ |
| 362 | q /= p; |
| 363 | /*< r = r / p >*/ |
| 364 | r__ /= p; |
| 365 | /*< if (notlas) go to 225 >*/ |
| 366 | if (notlas) { |
| 367 | goto L225; |
| 368 | } |
| 369 | /* .......... row modification .......... */ |
| 370 | /*< do 200 j = k, EN >*/ |
| 371 | i__2 = en; |
| 372 | for (j = k; j <= i__2; ++j) { |
| 373 | /*< p = h(k,j) + q * h(k+1,j) >*/ |
| 374 | p = h__[k + j * h_dim1] + q * h__[k + 1 + j * h_dim1]; |
| 375 | /*< h(k,j) = h(k,j) - p * x >*/ |
| 376 | h__[k + j * h_dim1] -= p * x; |
| 377 | /*< h(k+1,j) = h(k+1,j) - p * y >*/ |
| 378 | h__[k + 1 + j * h_dim1] -= p * y; |
| 379 | /*< 200 continue >*/ |
| 380 | /* L200: */ |
| 381 | } |
| 382 | |
| 383 | /*< j = min0(en,k+3) >*/ |
| 384 | /* Computing MIN */ |
| 385 | i__2 = en, i__3 = k + 3; |
| 386 | j = mincxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:159:9`!(i__2,i__3); |
| 387 | /* .......... column modification .......... */ |
| 388 | /*< do 210 i = L, j >*/ |
| 389 | i__2 = j; |
| 390 | for (i__ = l; i__ <= i__2; ++i__) { |
| 391 | /*< p = x * h(i,k) + y * h(i,k+1) >*/ |
| 392 | p = x * h__[i__ + k * h_dim1] + y * h__[i__ + (k + 1) * h_dim1]; |
| 393 | /*< h(i,k) = h(i,k) - p >*/ |
| 394 | h__[i__ + k * h_dim1] -= p; |
| 395 | /*< h(i,k+1) = h(i,k+1) - p * q >*/ |
| 396 | h__[i__ + (k + 1) * h_dim1] -= p * q; |
| 397 | /*< 210 continue >*/ |
| 398 | /* L210: */ |
| 399 | } |
| 400 | /*< go to 255 >*/ |
| 401 | goto L255; |
| 402 | /*< 225 continue >*/ |
| 403 | L225: |
| 404 | /* .......... row modification .......... */ |
| 405 | /*< do 230 j = k, EN >*/ |
| 406 | i__2 = en; |
| 407 | for (j = k; j <= i__2; ++j) { |
| 408 | /*< p = h(k,j) + q * h(k+1,j) + r * h(k+2,j) >*/ |
| 409 | p = h__[k + j * h_dim1] + q * h__[k + 1 + j * h_dim1] + r__ * h__[ |
| 410 | k + 2 + j * h_dim1]; |
| 411 | /*< h(k,j) = h(k,j) - p * x >*/ |
| 412 | h__[k + j * h_dim1] -= p * x; |
| 413 | /*< h(k+1,j) = h(k+1,j) - p * y >*/ |
| 414 | h__[k + 1 + j * h_dim1] -= p * y; |
| 415 | /*< h(k+2,j) = h(k+2,j) - p * zz >*/ |
| 416 | h__[k + 2 + j * h_dim1] -= p * zz; |
| 417 | /*< 230 continue >*/ |
| 418 | /* L230: */ |
| 419 | } |
| 420 | |
| 421 | /*< j = min0(en,k+3) >*/ |
| 422 | /* Computing MIN */ |
| 423 | i__2 = en, i__3 = k + 3; |
| 424 | j = mincxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:159:9`!(i__2,i__3); |
| 425 | /* .......... column modification .......... */ |
| 426 | /*< do 240 i = L, j >*/ |
| 427 | i__2 = j; |
| 428 | for (i__ = l; i__ <= i__2; ++i__) { |
| 429 | /*< p = x * h(i,k) + y * h(i,k+1) + zz * h(i,k+2) >*/ |
| 430 | p = x * h__[i__ + k * h_dim1] + y * h__[i__ + (k + 1) * h_dim1] + |
| 431 | zz * h__[i__ + (k + 2) * h_dim1]; |
| 432 | /*< h(i,k) = h(i,k) - p >*/ |
| 433 | h__[i__ + k * h_dim1] -= p; |
| 434 | /*< h(i,k+1) = h(i,k+1) - p * q >*/ |
| 435 | h__[i__ + (k + 1) * h_dim1] -= p * q; |
| 436 | /*< h(i,k+2) = h(i,k+2) - p * r >*/ |
| 437 | h__[i__ + (k + 2) * h_dim1] -= p * r__; |
| 438 | /*< 240 continue >*/ |
| 439 | /* L240: */ |
| 440 | } |
| 441 | /*< 255 continue >*/ |
| 442 | L255: |
| 443 | |
| 444 | /*< 260 continue >*/ |
| 445 | L260: |
| 446 | ; |
| 447 | } |
| 448 | |
| 449 | /*< go to 70 >*/ |
| 450 | goto L70; |
| 451 | /* .......... one root found .......... */ |
| 452 | /*< 270 wr(en) = x + t >*/ |
| 453 | L270: |
| 454 | wr[en] = x + t; |
| 455 | /*< wi(en) = 0.0d0 >*/ |
| 456 | wi[en] = 0.; |
| 457 | /*< en = na >*/ |
| 458 | en = na; |
| 459 | /*< go to 60 >*/ |
| 460 | goto L60; |
| 461 | /* .......... two roots found .......... */ |
| 462 | /*< 280 p = (y - x) / 2.0d0 >*/ |
| 463 | L280: |
| 464 | p = (y - x) / 2.; |
| 465 | /*< q = p * p + w >*/ |
| 466 | q = p * p + w; |
| 467 | /*< zz = dsqrt(dabs(q)) >*/ |
| 468 | zz = sqrtcxx . . $ sqrt(447c67c6676f75c3).((abscxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_original.h:157:9`!(q))); |
| 469 | /*< x = x + t >*/ |
| 470 | x += t; |
| 471 | /*< if (q .lt. 0.0d0) go to 320 >*/ |
| 472 | if (q < 0.) { |
| 473 | goto L320; |
| 474 | } |
| 475 | /* .......... real pair .......... */ |
| 476 | /*< zz = p + dsign(zz,p) >*/ |
| 477 | zz = p + d_signcxx . . $ `Modules/ThirdParty/VNL/src/vxl/v3p/netlib/v3p_f2c_mangle.h:14:9`!(&zz, &p); |
| 478 | /*< wr(na) = x + zz >*/ |
| 479 | wr[na] = x + zz; |
| 480 | /*< wr(en) = wr(na) >*/ |
| 481 | wr[en] = wr[na]; |
| 482 | /*< if (zz .ne. 0.0d0) wr(en) = x - w / zz >*/ |
| 483 | if (zz != 0.) { |
| 484 | wr[en] = x - w / zz; |
| 485 | } |
| 486 | /*< wi(na) = 0.0d0 >*/ |
| 487 | wi[na] = 0.; |
| 488 | /*< wi(en) = 0.0d0 >*/ |
| 489 | wi[en] = 0.; |
| 490 | /*< go to 330 >*/ |
| 491 | goto L330; |
| 492 | /* .......... complex pair .......... */ |
| 493 | /*< 320 wr(na) = x + p >*/ |
| 494 | L320: |
| 495 | wr[na] = x + p; |
| 496 | /*< wr(en) = x + p >*/ |
| 497 | wr[en] = x + p; |
| 498 | /*< wi(na) = zz >*/ |
| 499 | wi[na] = zz; |
| 500 | /*< wi(en) = -zz >*/ |
| 501 | wi[en] = -zz; |
| 502 | /*< 330 en = enm2 >*/ |
| 503 | L330: |
| 504 | en = enm2; |
| 505 | /*< go to 60 >*/ |
| 506 | goto L60; |
| 507 | /* .......... set error -- all eigenvalues have not */ |
| 508 | /* converged after 30*n iterations .......... */ |
| 509 | /*< 1000 ierr = en >*/ |
| 510 | L1000: |
| 511 | *ierr = en; |
| 512 | /*< 1001 return >*/ |
| 513 | L1001: |
| 514 | return 0; |
| 515 | /*< end >*/ |
| 516 | } /* hqr_ */ |
| 517 | |
| 518 | #ifdef __cplusplus |
| 519 | } |
| 520 | #endif |