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 doublereal c_b3 = .66666666666666663; 18 static integer c__1 = 1; 19 static doublereal c_b44 = 0.; 20 static doublereal c_b45 = 1.; 21 static logical c_true = TRUE_; 22 static doublereal c_b71 = -1.; 23 24 /* \BeginDoc 25 26 \Name: dneupd 27 28 \Description: 29 30 This subroutine returns the converged approximations to eigenvalues 31 of A*z = lambda*B*z and (optionally): 32 33 (1) The corresponding approximate eigenvectors; 34 35 (2) An orthonormal basis for the associated approximate 36 invariant subspace; 37 38 (3) Both. 39 40 There is negligible additional cost to obtain eigenvectors. An orthonormal 41 basis is always computed. There is an additional storage cost of n*nev 42 if both are requested (in this case a separate array Z must be supplied). 43 44 The approximate eigenvalues and eigenvectors of A*z = lambda*B*z 45 are derived from approximate eigenvalues and eigenvectors of 46 of the linear operator OP prescribed by the MODE selection in the 47 call to DNAUPD. DNAUPD must be called before this routine is called. 48 These approximate eigenvalues and vectors are commonly called Ritz 49 values and Ritz vectors respectively. They are referred to as such 50 in the comments that follow. The computed orthonormal basis for the 51 invariant subspace corresponding to these Ritz values is referred to as a 52 Schur basis. 53 54 See documentation in the header of the subroutine DNAUPD for 55 definition of OP as well as other terms and the relation of computed 56 Ritz values and Ritz vectors of OP with respect to the given problem 57 A*z = lambda*B*z. For a brief description, see definitions of 58 IPARAM(7), MODE and WHICH in the documentation of DNAUPD. 59 60 \Usage: 61 call dneupd 62 ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI, WORKEV, BMAT, 63 N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, WORKD, WORKL, 64 LWORKL, INFO ) 65 66 \Arguments: 67 RVEC LOGICAL (INPUT) 68 Specifies whether a basis for the invariant subspace corresponding 69 to the converged Ritz value approximations for the eigenproblem 70 A*z = lambda*B*z is computed. 71 72 RVEC = .FALSE. Compute Ritz values only. 73 74 RVEC = .TRUE. Compute the Ritz vectors or Schur vectors. 75 See Remarks below. 76 77 HOWMNY Character*1 (INPUT) 78 Specifies the form of the basis for the invariant subspace 79 corresponding to the converged Ritz values that is to be computed. 80 81 = 'A': Compute NEV Ritz vectors; 82 = 'P': Compute NEV Schur vectors; 83 = 'S': compute some of the Ritz vectors, specified 84 by the logical array SELECT. 85 86 SELECT Logical array of dimension NCV. (INPUT) 87 If HOWMNY = 'S', SELECT specifies the Ritz vectors to be 88 computed. To select the Ritz vector corresponding to a 89 Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE.. 90 If HOWMNY = 'A' or 'P', SELECT is used as internal workspace. 91 92 DR Double precision array of dimension NEV+1. (OUTPUT) 93 If IPARAM(7) = 1,2 or 3 and SIGMAI=0.0 then on exit: DR contains 94 the real part of the Ritz approximations to the eigenvalues of 95 A*z = lambda*B*z. 96 If IPARAM(7) = 3, 4 and SIGMAI is not equal to zero, then on exit: 97 DR contains the real part of the Ritz values of OP computed by 98 DNAUPD. A further computation must be performed by the user 99 to transform the Ritz values computed for OP by DNAUPD to those 100 of the original system A*z = lambda*B*z. See remark 3 below. 101 102 DI Double precision array of dimension NEV+1. (OUTPUT) 103 On exit, DI contains the imaginary part of the Ritz value 104 approximations to the eigenvalues of A*z = lambda*B*z associated 105 with DR. 106 107 NOTE: When Ritz values are complex, they will come in complex 108 conjugate pairs. If eigenvectors are requested, the 109 corresponding Ritz vectors will also come in conjugate 110 pairs and the real and imaginary parts of these are 111 represented in two consecutive columns of the array Z 112 (see below). 113 114 Z Double precision N by NEV+1 array if RVEC = .TRUE. and HOWMNY = 'A'. (OUTPUT) 115 On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of 116 Z represent approximate eigenvectors (Ritz vectors) corresponding 117 to the NCONV=IPARAM(5) Ritz values for eigensystem 118 A*z = lambda*B*z. 119 120 The complex Ritz vector associated with the Ritz value 121 with positive imaginary part is stored in two consecutive 122 columns. The first column holds the real part of the Ritz 123 vector and the second column holds the imaginary part. The 124 Ritz vector associated with the Ritz value with negative 125 imaginary part is simply the complex conjugate of the Ritz vector 126 associated with the positive imaginary part. 127 128 If RVEC = .FALSE. or HOWMNY = 'P', then Z is not referenced. 129 130 NOTE: If if RVEC = .TRUE. and a Schur basis is not required, 131 the array Z may be set equal to first NEV+1 columns of the Arnoldi 132 basis array V computed by DNAUPD. In this case the Arnoldi basis 133 will be destroyed and overwritten with the eigenvector basis. 134 135 LDZ Integer. (INPUT) 136 The leading dimension of the array Z. If Ritz vectors are 137 desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1. 138 139 SIGMAR Double precision (INPUT) 140 If IPARAM(7) = 3 or 4, represents the real part of the shift. 141 Not referenced if IPARAM(7) = 1 or 2. 142 143 SIGMAI Double precision (INPUT) 144 If IPARAM(7) = 3 or 4, represents the imaginary part of the shift. 145 Not referenced if IPARAM(7) = 1 or 2. See remark 3 below. 146 147 WORKEV Double precision work array of dimension 3*NCV. (WORKSPACE) 148 149 **** The remaining arguments MUST be the same as for the **** 150 **** call to DNAUPD that was just completed. **** 151 152 NOTE: The remaining arguments 153 154 BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, 155 WORKD, WORKL, LWORKL, INFO 156 157 must be passed directly to DNEUPD following the last call 158 to DNAUPD. These arguments MUST NOT BE MODIFIED between 159 the the last call to DNAUPD and the call to DNEUPD. 160 161 Three of these parameters (V, WORKL, INFO) are also output parameters: 162 163 V Double precision N by NCV array. (INPUT/OUTPUT) 164 165 Upon INPUT: the NCV columns of V contain the Arnoldi basis 166 vectors for OP as constructed by DNAUPD . 167 168 Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns 169 contain approximate Schur vectors that span the 170 desired invariant subspace. See Remark 2 below. 171 172 NOTE: If the array Z has been set equal to first NEV+1 columns 173 of the array V and RVEC=.TRUE. and HOWMNY= 'A', then the 174 Arnoldi basis held by V has been overwritten by the desired 175 Ritz vectors. If a separate array Z has been passed then 176 the first NCONV=IPARAM(5) columns of V will contain approximate 177 Schur vectors that span the desired invariant subspace. 178 179 WORKL Double precision work array of length LWORKL. (OUTPUT/WORKSPACE) 180 WORKL(1:ncv*ncv+3*ncv) contains information obtained in 181 dnaupd. They are not changed by dneupd. 182 WORKL(ncv*ncv+3*ncv+1:3*ncv*ncv+6*ncv) holds the 183 real and imaginary part of the untransformed Ritz values, 184 the upper quasi-triangular matrix for H, and the 185 associated matrix representation of the invariant subspace for H. 186 187 Note: IPNTR(9:13) contains the pointer into WORKL for addresses 188 of the above information computed by dneupd. 189 ------------------------------------------------------------- 190 IPNTR(9): pointer to the real part of the NCV RITZ values of the 191 original system. 192 IPNTR(10): pointer to the imaginary part of the NCV RITZ values of 193 the original system. 194 IPNTR(11): pointer to the NCV corresponding error bounds. 195 IPNTR(12): pointer to the NCV by NCV upper quasi-triangular 196 Schur matrix for H. 197 IPNTR(13): pointer to the NCV by NCV matrix of eigenvectors 198 of the upper Hessenberg matrix H. Only referenced by 199 dneupd if RVEC = .TRUE. See Remark 2 below. 200 ------------------------------------------------------------- 201 202 INFO Integer. (OUTPUT) 203 Error flag on output. 204 205 = 0: Normal exit. 206 207 = 1: The Schur form computed by LAPACK routine dlahqr 208 could not be reordered by LAPACK routine dtrsen. 209 Re-enter subroutine dneupd with IPARAM(5)=NCV and 210 increase the size of the arrays DR and DI to have 211 dimension at least dimension NCV and allocate at least NCV 212 columns for Z. NOTE: Not necessary if Z and V share 213 the same space. Please notify the authors if this error 214 occurs. 215 216 = -1: N must be positive. 217 = -2: NEV must be positive. 218 = -3: NCV-NEV >= 2 and less than or equal to N. 219 = -5: WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI' 220 = -6: BMAT must be one of 'I' or 'G'. 221 = -7: Length of private work WORKL array is not sufficient. 222 = -8: Error return from calculation of a real Schur form. 223 Informational error from LAPACK routine dlahqr. 224 = -9: Error return from calculation of eigenvectors. 225 Informational error from LAPACK routine dtrevc. 226 = -10: IPARAM(7) must be 1,2,3,4. 227 = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatible. 228 = -12: HOWMNY = 'S' not yet implemented 229 = -13: HOWMNY must be one of 'A' or 'P' if RVEC = .true. 230 = -14: DNAUPD did not find any eigenvalues to sufficient 231 accuracy. 232 233 \BeginLib 234 235 \References: 236 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in 237 a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), 238 pp 357-385. 239 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly 240 Restarted Arnoldi Iteration", Rice University Technical Report 241 TR95-13, Department of Computational and Applied Mathematics. 242 3. B.N. Parlett & Y. Saad, "Complex Shift and Invert Strategies for 243 Real Matrices", Linear Algebra and its Applications, vol 88/89, 244 pp 575-595, (1987). 245 246 \Routines called: 247 ivout ARPACK utility routine that prints integers. 248 dmout ARPACK utility routine that prints matrices 249 dvout ARPACK utility routine that prints vectors. 250 dgeqr2 LAPACK routine that computes the QR factorization of 251 a matrix. 252 dlacpy LAPACK matrix copy routine. 253 dlahqr LAPACK routine to compute the real Schur form of an 254 upper Hessenberg matrix. 255 dlamch LAPACK routine that determines machine constants. 256 dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully. 257 dlaset LAPACK matrix initialization routine. 258 dorm2r LAPACK routine that applies an orthogonal matrix in 259 factored form. 260 dtrevc LAPACK routine to compute the eigenvectors of a matrix 261 in upper quasi-triangular form. 262 dtrsen LAPACK routine that re-orders the Schur form. 263 dtrmm Level 3 BLAS matrix times an upper triangular matrix. 264 dger Level 2 BLAS rank one update to a matrix. 265 dcopy Level 1 BLAS that copies one vector to another . 266 ddot Level 1 BLAS that computes the scalar product of two vectors. 267 dnrm2 Level 1 BLAS that computes the norm of a vector. 268 dscal Level 1 BLAS that scales a vector. 269 270 \Remarks 271 272 1. Currently only HOWMNY = 'A' and 'P' are implemented. 273 274 Let X' denote the transpose of X. 275 276 2. Schur vectors are an orthogonal representation for the basis of 277 Ritz vectors. Thus, their numerical properties are often superior. 278 If RVEC = .TRUE. then the relationship 279 A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and 280 V(:,1:IPARAM(5))' * V(:,1:IPARAM(5)) = I are approximately satisfied. 281 Here T is the leading submatrix of order IPARAM(5) of the real 282 upper quasi-triangular matrix stored workl(ipntr(12)). That is, 283 T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks; 284 each 2-by-2 diagonal block has its diagonal elements equal and its 285 off-diagonal elements of opposite sign. Corresponding to each 2-by-2 286 diagonal block is a complex conjugate pair of Ritz values. The real 287 Ritz values are stored on the diagonal of T. 288 289 3. If IPARAM(7) = 3 or 4 and SIGMAI is not equal zero, then the user must 290 form the IPARAM(5) Rayleigh quotients in order to transform the Ritz 291 values computed by DNAUPD for OP to those of A*z = lambda*B*z. 292 Set RVEC = .true. and HOWMNY = 'A', and 293 compute 294 Z(:,I)' * A * Z(:,I) if DI(I) = 0. 295 If DI(I) is not equal to zero and DI(I+1) = - D(I), 296 then the desired real and imaginary parts of the Ritz value are 297 Z(:,I)' * A * Z(:,I) + Z(:,I+1)' * A * Z(:,I+1), 298 Z(:,I)' * A * Z(:,I+1) - Z(:,I+1)' * A * Z(:,I), respectively. 299 Another possibility is to set RVEC = .true. and HOWMNY = 'P' and 300 compute V(:,1:IPARAM(5))' * A * V(:,1:IPARAM(5)) and then an upper 301 quasi-triangular matrix of order IPARAM(5) is computed. See remark 302 2 above. 303 304 \Authors 305 Danny Sorensen Phuong Vu 306 Richard Lehoucq CRPC / Rice University 307 Chao Yang Houston, Texas 308 Dept. of Computational & 309 Applied Mathematics 310 Rice University 311 Houston, Texas 312 313 \SCCS Information: @(#) 314 FILE: neupd.F SID: 2.5 DATE OF SID: 7/31/96 RELEASE: 2 315 316 \EndLib 317 318 ----------------------------------------------------------------------- igraphdneupd_(logical * rvec,char * howmny,logical * select,doublereal * dr,doublereal * di,doublereal * z__,integer * ldz,doublereal * sigmar,doublereal * sigmai,doublereal * workev,char * bmat,integer * n,char * which,integer * nev,doublereal * tol,doublereal * resid,integer * ncv,doublereal * v,integer * ldv,integer * iparam,integer * ipntr,doublereal * workd,doublereal * workl,integer * lworkl,integer * info)319 Subroutine */ int igraphdneupd_(logical *rvec, char *howmny, logical *select, 320 doublereal *dr, doublereal *di, doublereal *z__, integer *ldz, 321 doublereal *sigmar, doublereal *sigmai, doublereal *workev, char * 322 bmat, integer *n, char *which, integer *nev, doublereal *tol, 323 doublereal *resid, integer *ncv, doublereal *v, integer *ldv, integer 324 *iparam, integer *ipntr, doublereal *workd, doublereal *workl, 325 integer *lworkl, integer *info) 326 { 327 /* System generated locals */ 328 integer v_dim1, v_offset, z_dim1, z_offset, i__1; 329 doublereal d__1, d__2; 330 331 /* Builtin functions */ 332 double pow_dd(doublereal *, doublereal *); 333 integer s_cmp(char *, char *, ftnlen, ftnlen); 334 /* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); 335 336 /* Local variables */ 337 integer j, k, ih; 338 doublereal vl[1] /* was [1][1] */; 339 integer ibd, ldh, ldq, iri; 340 doublereal sep; 341 integer irr, wri, wrr; 342 extern /* Subroutine */ int igraphdger_(integer *, integer *, doublereal *, 343 doublereal *, integer *, doublereal *, integer *, doublereal *, 344 integer *); 345 integer mode; 346 doublereal eps23; 347 integer ierr; 348 doublereal temp; 349 integer iwev; 350 char type__[6]; 351 extern doublereal igraphdnrm2_(integer *, doublereal *, integer *); 352 doublereal temp1; 353 extern /* Subroutine */ int igraphdscal_(integer *, doublereal *, doublereal *, 354 integer *); 355 integer ihbds, iconj; 356 extern /* Subroutine */ int igraphdgemv_(char *, integer *, integer *, 357 doublereal *, doublereal *, integer *, doublereal *, integer *, 358 doublereal *, doublereal *, integer *); 359 doublereal conds; 360 logical reord; 361 extern /* Subroutine */ int igraphdcopy_(integer *, doublereal *, integer *, 362 doublereal *, integer *); 363 integer nconv; 364 extern /* Subroutine */ int igraphdtrmm_(char *, char *, char *, char *, 365 integer *, integer *, doublereal *, doublereal *, integer *, 366 doublereal *, integer *); 367 doublereal thres; 368 extern /* Subroutine */ int igraphdmout_(integer *, integer *, integer *, 369 doublereal *, integer *, integer *, char *, ftnlen); 370 integer iwork[1]; 371 doublereal rnorm; 372 integer ritzi; 373 extern /* Subroutine */ int igraphdvout_(integer *, integer *, doublereal *, 374 integer *, char *, ftnlen), igraphivout_(integer *, integer *, integer * 375 , integer *, char *, ftnlen); 376 integer ritzr; 377 extern /* Subroutine */ int igraphdgeqr2_(integer *, integer *, doublereal *, 378 integer *, doublereal *, doublereal *, integer *); 379 extern doublereal igraphdlapy2_(doublereal *, doublereal *); 380 extern /* Subroutine */ int igraphdorm2r_(char *, char *, integer *, integer *, 381 integer *, doublereal *, integer *, doublereal *, doublereal *, 382 integer *, doublereal *, integer *); 383 extern doublereal igraphdlamch_(char *); 384 integer iheigi, iheigr; 385 extern /* Subroutine */ int igraphdlahqr_(logical *, logical *, integer *, 386 integer *, integer *, doublereal *, integer *, doublereal *, 387 doublereal *, integer *, integer *, doublereal *, integer *, 388 integer *), igraphdlacpy_(char *, integer *, integer *, doublereal *, 389 integer *, doublereal *, integer *), igraphdlaset_(char *, 390 integer *, integer *, doublereal *, doublereal *, doublereal *, 391 integer *); 392 integer logfil, ndigit; 393 extern /* Subroutine */ int igraphdtrevc_(char *, char *, logical *, integer *, 394 doublereal *, integer *, doublereal *, integer *, doublereal *, 395 integer *, integer *, integer *, doublereal *, integer *); 396 integer mneupd = 0, bounds; 397 extern /* Subroutine */ int igraphdtrsen_(char *, char *, logical *, integer *, 398 doublereal *, integer *, doublereal *, integer *, doublereal *, 399 doublereal *, integer *, doublereal *, doublereal *, doublereal *, 400 integer *, integer *, integer *, integer *); 401 integer msglvl, ktrord, invsub, iuptri, outncv; 402 403 404 /* %----------------------------------------------------% 405 | Include files for debugging and timing information | 406 %----------------------------------------------------% 407 408 409 %------------------% 410 | Scalar Arguments | 411 %------------------% 412 413 414 %-----------------% 415 | Array Arguments | 416 %-----------------% 417 418 419 %------------% 420 | Parameters | 421 %------------% 422 423 424 %---------------% 425 | Local Scalars | 426 %---------------% 427 428 429 %----------------------% 430 | External Subroutines | 431 %----------------------% 432 433 434 %--------------------% 435 | External Functions | 436 %--------------------% 437 438 439 %---------------------% 440 | Intrinsic Functions | 441 %---------------------% 442 443 444 %-----------------------% 445 | Executable Statements | 446 %-----------------------% 447 448 %------------------------% 449 | Set default parameters | 450 %------------------------% 451 452 Parameter adjustments */ 453 z_dim1 = *ldz; 454 z_offset = 1 + z_dim1; 455 z__ -= z_offset; 456 --workd; 457 --resid; 458 --di; 459 --dr; 460 --workev; 461 --select; 462 v_dim1 = *ldv; 463 v_offset = 1 + v_dim1; 464 v -= v_offset; 465 --iparam; 466 --ipntr; 467 --workl; 468 469 /* Function Body */ 470 msglvl = mneupd; 471 mode = iparam[7]; 472 nconv = iparam[5]; 473 *info = 0; 474 475 /* %---------------------------------% 476 | Get machine dependent constant. | 477 %---------------------------------% */ 478 479 eps23 = igraphdlamch_("Epsilon-Machine"); 480 eps23 = pow_dd(&eps23, &c_b3); 481 482 /* %--------------% 483 | Quick return | 484 %--------------% */ 485 486 ierr = 0; 487 488 if (nconv <= 0) { 489 ierr = -14; 490 } else if (*n <= 0) { 491 ierr = -1; 492 } else if (*nev <= 0) { 493 ierr = -2; 494 } else if (*ncv <= *nev + 1 || *ncv > *n) { 495 ierr = -3; 496 } else if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, 497 "SM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, "LR", (ftnlen)2, 498 (ftnlen)2) != 0 && s_cmp(which, "SR", (ftnlen)2, (ftnlen)2) != 0 499 && s_cmp(which, "LI", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, 500 "SI", (ftnlen)2, (ftnlen)2) != 0) { 501 ierr = -5; 502 } else if (*(unsigned char *)bmat != 'I' && *(unsigned char *)bmat != 'G') 503 { 504 ierr = -6; 505 } else /* if(complicated condition) */ { 506 /* Computing 2nd power */ 507 i__1 = *ncv; 508 if (*lworkl < i__1 * i__1 * 3 + *ncv * 6) { 509 ierr = -7; 510 } else if (*(unsigned char *)howmny != 'A' && *(unsigned char *) 511 howmny != 'P' && *(unsigned char *)howmny != 'S' && *rvec) { 512 ierr = -13; 513 } else if (*(unsigned char *)howmny == 'S') { 514 ierr = -12; 515 } 516 } 517 518 if (mode == 1 || mode == 2) { 519 s_copy(type__, "REGULR", (ftnlen)6, (ftnlen)6); 520 } else if (mode == 3 && *sigmai == 0.) { 521 s_copy(type__, "SHIFTI", (ftnlen)6, (ftnlen)6); 522 } else if (mode == 3) { 523 s_copy(type__, "REALPT", (ftnlen)6, (ftnlen)6); 524 } else if (mode == 4) { 525 s_copy(type__, "IMAGPT", (ftnlen)6, (ftnlen)6); 526 } else { 527 ierr = -10; 528 } 529 if (mode == 1 && *(unsigned char *)bmat == 'G') { 530 ierr = -11; 531 } 532 533 /* %------------% 534 | Error Exit | 535 %------------% */ 536 537 if (ierr != 0) { 538 *info = ierr; 539 goto L9000; 540 } 541 542 /* %--------------------------------------------------------% 543 | Pointer into WORKL for address of H, RITZ, BOUNDS, Q | 544 | etc... and the remaining workspace. | 545 | Also update pointer to be used on output. | 546 | Memory is laid out as follows: | 547 | workl(1:ncv*ncv) := generated Hessenberg matrix | 548 | workl(ncv*ncv+1:ncv*ncv+2*ncv) := real and imaginary | 549 | parts of ritz values | 550 | workl(ncv*ncv+2*ncv+1:ncv*ncv+3*ncv) := error bounds | 551 %--------------------------------------------------------% 552 553 %-----------------------------------------------------------% 554 | The following is used and set by DNEUPD. | 555 | workl(ncv*ncv+3*ncv+1:ncv*ncv+4*ncv) := The untransformed | 556 | real part of the Ritz values. | 557 | workl(ncv*ncv+4*ncv+1:ncv*ncv+5*ncv) := The untransformed | 558 | imaginary part of the Ritz values. | 559 | workl(ncv*ncv+5*ncv+1:ncv*ncv+6*ncv) := The untransformed | 560 | error bounds of the Ritz values | 561 | workl(ncv*ncv+6*ncv+1:2*ncv*ncv+6*ncv) := Holds the upper | 562 | quasi-triangular matrix for H | 563 | workl(2*ncv*ncv+6*ncv+1: 3*ncv*ncv+6*ncv) := Holds the | 564 | associated matrix representation of the invariant | 565 | subspace for H. | 566 | GRAND total of NCV * ( 3 * NCV + 6 ) locations. | 567 %-----------------------------------------------------------% */ 568 569 ih = ipntr[5]; 570 ritzr = ipntr[6]; 571 ritzi = ipntr[7]; 572 bounds = ipntr[8]; 573 ldh = *ncv; 574 ldq = *ncv; 575 iheigr = bounds + ldh; 576 iheigi = iheigr + ldh; 577 ihbds = iheigi + ldh; 578 iuptri = ihbds + ldh; 579 invsub = iuptri + ldh * *ncv; 580 ipntr[9] = iheigr; 581 ipntr[10] = iheigi; 582 ipntr[11] = ihbds; 583 ipntr[12] = iuptri; 584 ipntr[13] = invsub; 585 wrr = 1; 586 wri = *ncv + 1; 587 iwev = wri + *ncv; 588 589 /* %-----------------------------------------% 590 | irr points to the REAL part of the Ritz | 591 | values computed by _neigh before | 592 | exiting _naup2. | 593 | iri points to the IMAGINARY part of the | 594 | Ritz values computed by _neigh | 595 | before exiting _naup2. | 596 | ibd points to the Ritz estimates | 597 | computed by _neigh before exiting | 598 | _naup2. | 599 %-----------------------------------------% */ 600 601 irr = ipntr[14] + *ncv * *ncv; 602 iri = irr + *ncv; 603 ibd = iri + *ncv; 604 605 /* %------------------------------------% 606 | RNORM is B-norm of the RESID(1:N). | 607 %------------------------------------% */ 608 609 rnorm = workl[ih + 2]; 610 workl[ih + 2] = 0.; 611 612 if (*rvec) { 613 614 /* %-------------------------------------------% 615 | Get converged Ritz value on the boundary. | 616 | Note: converged Ritz values have been | 617 | placed in the first NCONV locations in | 618 | workl(ritzr) and workl(ritzi). They have | 619 | been sorted (in _naup2) according to the | 620 | WHICH selection criterion. | 621 %-------------------------------------------% */ 622 623 if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) == 0 || s_cmp(which, 624 "SM", (ftnlen)2, (ftnlen)2) == 0) { 625 thres = igraphdlapy2_(&workl[ritzr], &workl[ritzi]); 626 } else if (s_cmp(which, "LR", (ftnlen)2, (ftnlen)2) == 0 || s_cmp( 627 which, "SR", (ftnlen)2, (ftnlen)2) == 0) { 628 thres = workl[ritzr]; 629 } else if (s_cmp(which, "LI", (ftnlen)2, (ftnlen)2) == 0 || s_cmp( 630 which, "SI", (ftnlen)2, (ftnlen)2) == 0) { 631 thres = (d__1 = workl[ritzi], abs(d__1)); 632 } 633 634 if (msglvl > 2) { 635 igraphdvout_(&logfil, &c__1, &thres, &ndigit, "_neupd: Threshold eigen" 636 "value used for re-ordering", (ftnlen)49); 637 } 638 639 /* %----------------------------------------------------------% 640 | Check to see if all converged Ritz values appear at the | 641 | top of the upper quasi-triangular matrix computed by | 642 | _neigh in _naup2. This is done in the following way: | 643 | | 644 | 1) For each Ritz value obtained from _neigh, compare it | 645 | with the threshold Ritz value computed above to | 646 | determine whether it is a wanted one. | 647 | | 648 | 2) If it is wanted, then check the corresponding Ritz | 649 | estimate to see if it has converged. If it has, set | 650 | correponding entry in the logical array SELECT to | 651 | .TRUE.. | 652 | | 653 | If SELECT(j) = .TRUE. and j > NCONV, then there is a | 654 | converged Ritz value that does not appear at the top of | 655 | the upper quasi-triangular matrix computed by _neigh in | 656 | _naup2. Reordering is needed. | 657 %----------------------------------------------------------% */ 658 659 reord = FALSE_; 660 ktrord = 0; 661 i__1 = *ncv - 1; 662 for (j = 0; j <= i__1; ++j) { 663 select[j + 1] = FALSE_; 664 if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) == 0) { 665 if (igraphdlapy2_(&workl[irr + j], &workl[iri + j]) >= thres) { 666 /* Computing MAX */ 667 d__1 = eps23, d__2 = igraphdlapy2_(&workl[irr + j], &workl[iri 668 + j]); 669 temp1 = max(d__1,d__2); 670 if (workl[ibd + j] <= *tol * temp1) { 671 select[j + 1] = TRUE_; 672 } 673 } 674 } else if (s_cmp(which, "SM", (ftnlen)2, (ftnlen)2) == 0) { 675 if (igraphdlapy2_(&workl[irr + j], &workl[iri + j]) <= thres) { 676 /* Computing MAX */ 677 d__1 = eps23, d__2 = igraphdlapy2_(&workl[irr + j], &workl[iri 678 + j]); 679 temp1 = max(d__1,d__2); 680 if (workl[ibd + j] <= *tol * temp1) { 681 select[j + 1] = TRUE_; 682 } 683 } 684 } else if (s_cmp(which, "LR", (ftnlen)2, (ftnlen)2) == 0) { 685 if (workl[irr + j] >= thres) { 686 /* Computing MAX */ 687 d__1 = eps23, d__2 = igraphdlapy2_(&workl[irr + j], &workl[iri 688 + j]); 689 temp1 = max(d__1,d__2); 690 if (workl[ibd + j] <= *tol * temp1) { 691 select[j + 1] = TRUE_; 692 } 693 } 694 } else if (s_cmp(which, "SR", (ftnlen)2, (ftnlen)2) == 0) { 695 if (workl[irr + j] <= thres) { 696 /* Computing MAX */ 697 d__1 = eps23, d__2 = igraphdlapy2_(&workl[irr + j], &workl[iri 698 + j]); 699 temp1 = max(d__1,d__2); 700 if (workl[ibd + j] <= *tol * temp1) { 701 select[j + 1] = TRUE_; 702 } 703 } 704 } else if (s_cmp(which, "LI", (ftnlen)2, (ftnlen)2) == 0) { 705 if ((d__1 = workl[iri + j], abs(d__1)) >= thres) { 706 /* Computing MAX */ 707 d__1 = eps23, d__2 = igraphdlapy2_(&workl[irr + j], &workl[iri 708 + j]); 709 temp1 = max(d__1,d__2); 710 if (workl[ibd + j] <= *tol * temp1) { 711 select[j + 1] = TRUE_; 712 } 713 } 714 } else if (s_cmp(which, "SI", (ftnlen)2, (ftnlen)2) == 0) { 715 if ((d__1 = workl[iri + j], abs(d__1)) <= thres) { 716 /* Computing MAX */ 717 d__1 = eps23, d__2 = igraphdlapy2_(&workl[irr + j], &workl[iri 718 + j]); 719 temp1 = max(d__1,d__2); 720 if (workl[ibd + j] <= *tol * temp1) { 721 select[j + 1] = TRUE_; 722 } 723 } 724 } 725 if (j + 1 > nconv) { 726 reord = select[j + 1] || reord; 727 } 728 if (select[j + 1]) { 729 ++ktrord; 730 } 731 /* L10: */ 732 } 733 734 if (msglvl > 2) { 735 igraphivout_(&logfil, &c__1, &ktrord, &ndigit, "_neupd: Number of spec" 736 "ified eigenvalues", (ftnlen)39); 737 igraphivout_(&logfil, &c__1, &nconv, &ndigit, "_neupd: Number of \"con" 738 "verged\" eigenvalues", (ftnlen)41); 739 } 740 741 /* %-----------------------------------------------------------% 742 | Call LAPACK routine dlahqr to compute the real Schur form | 743 | of the upper Hessenberg matrix returned by DNAUPD. | 744 | Make a copy of the upper Hessenberg matrix. | 745 | Initialize the Schur vector matrix Q to the identity. | 746 %-----------------------------------------------------------% */ 747 748 i__1 = ldh * *ncv; 749 igraphdcopy_(&i__1, &workl[ih], &c__1, &workl[iuptri], &c__1); 750 igraphdlaset_("All", ncv, ncv, &c_b44, &c_b45, &workl[invsub], &ldq); 751 igraphdlahqr_(&c_true, &c_true, ncv, &c__1, ncv, &workl[iuptri], &ldh, & 752 workl[iheigr], &workl[iheigi], &c__1, ncv, &workl[invsub], & 753 ldq, &ierr); 754 igraphdcopy_(ncv, &workl[invsub + *ncv - 1], &ldq, &workl[ihbds], &c__1); 755 756 if (ierr != 0) { 757 *info = -8; 758 goto L9000; 759 } 760 761 if (msglvl > 1) { 762 igraphdvout_(&logfil, ncv, &workl[iheigr], &ndigit, "_neupd: Real part" 763 " of the eigenvalues of H", (ftnlen)41); 764 igraphdvout_(&logfil, ncv, &workl[iheigi], &ndigit, "_neupd: Imaginary" 765 " part of the Eigenvalues of H", (ftnlen)46); 766 igraphdvout_(&logfil, ncv, &workl[ihbds], &ndigit, "_neupd: Last row o" 767 "f the Schur vector matrix", (ftnlen)43); 768 if (msglvl > 3) { 769 igraphdmout_(&logfil, ncv, ncv, &workl[iuptri], &ldh, &ndigit, 770 "_neupd: The upper quasi-triangular matrix ", (ftnlen) 771 42); 772 } 773 } 774 775 if (reord) { 776 777 /* %-----------------------------------------------------% 778 | Reorder the computed upper quasi-triangular matrix. | 779 %-----------------------------------------------------% */ 780 781 igraphdtrsen_("None", "V", &select[1], ncv, &workl[iuptri], &ldh, & 782 workl[invsub], &ldq, &workl[iheigr], &workl[iheigi], & 783 nconv, &conds, &sep, &workl[ihbds], ncv, iwork, &c__1, & 784 ierr); 785 786 if (ierr == 1) { 787 *info = 1; 788 goto L9000; 789 } 790 791 if (msglvl > 2) { 792 igraphdvout_(&logfil, ncv, &workl[iheigr], &ndigit, "_neupd: Real " 793 "part of the eigenvalues of H--reordered", (ftnlen)52); 794 igraphdvout_(&logfil, ncv, &workl[iheigi], &ndigit, "_neupd: Imag " 795 "part of the eigenvalues of H--reordered", (ftnlen)52); 796 if (msglvl > 3) { 797 igraphdmout_(&logfil, ncv, ncv, &workl[iuptri], &ldq, &ndigit, 798 "_neupd: Quasi-triangular matrix after re-orderi" 799 "ng", (ftnlen)49); 800 } 801 } 802 803 } 804 805 /* %---------------------------------------% 806 | Copy the last row of the Schur vector | 807 | into workl(ihbds). This will be used | 808 | to compute the Ritz estimates of | 809 | converged Ritz values. | 810 %---------------------------------------% */ 811 812 igraphdcopy_(ncv, &workl[invsub + *ncv - 1], &ldq, &workl[ihbds], &c__1); 813 814 /* %----------------------------------------------------% 815 | Place the computed eigenvalues of H into DR and DI | 816 | if a spectral transformation was not used. | 817 %----------------------------------------------------% */ 818 819 if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0) { 820 igraphdcopy_(&nconv, &workl[iheigr], &c__1, &dr[1], &c__1); 821 igraphdcopy_(&nconv, &workl[iheigi], &c__1, &di[1], &c__1); 822 } 823 824 /* %----------------------------------------------------------% 825 | Compute the QR factorization of the matrix representing | 826 | the wanted invariant subspace located in the first NCONV | 827 | columns of workl(invsub,ldq). | 828 %----------------------------------------------------------% */ 829 830 igraphdgeqr2_(ncv, &nconv, &workl[invsub], &ldq, &workev[1], &workev[*ncv + 831 1], &ierr); 832 833 /* %---------------------------------------------------------% 834 | * Postmultiply V by Q using dorm2r. | 835 | * Copy the first NCONV columns of VQ into Z. | 836 | * Postmultiply Z by R. | 837 | The N by NCONV matrix Z is now a matrix representation | 838 | of the approximate invariant subspace associated with | 839 | the Ritz values in workl(iheigr) and workl(iheigi) | 840 | The first NCONV columns of V are now approximate Schur | 841 | vectors associated with the real upper quasi-triangular | 842 | matrix of order NCONV in workl(iuptri) | 843 %---------------------------------------------------------% */ 844 845 igraphdorm2r_("Right", "Notranspose", n, ncv, &nconv, &workl[invsub], &ldq, 846 &workev[1], &v[v_offset], ldv, &workd[*n + 1], &ierr); 847 igraphdlacpy_("All", n, &nconv, &v[v_offset], ldv, &z__[z_offset], ldz); 848 849 i__1 = nconv; 850 for (j = 1; j <= i__1; ++j) { 851 852 /* %---------------------------------------------------% 853 | Perform both a column and row scaling if the | 854 | diagonal element of workl(invsub,ldq) is negative | 855 | I'm lazy and don't take advantage of the upper | 856 | quasi-triangular form of workl(iuptri,ldq) | 857 | Note that since Q is orthogonal, R is a diagonal | 858 | matrix consisting of plus or minus ones | 859 %---------------------------------------------------% */ 860 861 if (workl[invsub + (j - 1) * ldq + j - 1] < 0.) { 862 igraphdscal_(&nconv, &c_b71, &workl[iuptri + j - 1], &ldq); 863 igraphdscal_(&nconv, &c_b71, &workl[iuptri + (j - 1) * ldq], &c__1); 864 } 865 866 /* L20: */ 867 } 868 869 if (*(unsigned char *)howmny == 'A') { 870 871 /* %--------------------------------------------% 872 | Compute the NCONV wanted eigenvectors of T | 873 | located in workl(iuptri,ldq). | 874 %--------------------------------------------% */ 875 876 i__1 = *ncv; 877 for (j = 1; j <= i__1; ++j) { 878 if (j <= nconv) { 879 select[j] = TRUE_; 880 } else { 881 select[j] = FALSE_; 882 } 883 /* L30: */ 884 } 885 886 igraphdtrevc_("Right", "Select", &select[1], ncv, &workl[iuptri], &ldq, 887 vl, &c__1, &workl[invsub], &ldq, ncv, &outncv, &workev[1], 888 &ierr); 889 890 if (ierr != 0) { 891 *info = -9; 892 goto L9000; 893 } 894 895 /* %------------------------------------------------% 896 | Scale the returning eigenvectors so that their | 897 | Euclidean norms are all one. LAPACK subroutine | 898 | dtrevc returns each eigenvector normalized so | 899 | that the element of largest magnitude has | 900 | magnitude 1; | 901 %------------------------------------------------% */ 902 903 iconj = 0; 904 i__1 = nconv; 905 for (j = 1; j <= i__1; ++j) { 906 907 if (workl[iheigi + j - 1] == 0.) { 908 909 /* %----------------------% 910 | real eigenvalue case | 911 %----------------------% */ 912 913 temp = igraphdnrm2_(ncv, &workl[invsub + (j - 1) * ldq], &c__1); 914 d__1 = 1. / temp; 915 igraphdscal_(ncv, &d__1, &workl[invsub + (j - 1) * ldq], &c__1); 916 917 } else { 918 919 /* %-------------------------------------------% 920 | Complex conjugate pair case. Note that | 921 | since the real and imaginary part of | 922 | the eigenvector are stored in consecutive | 923 | columns, we further normalize by the | 924 | square root of two. | 925 %-------------------------------------------% */ 926 927 if (iconj == 0) { 928 d__1 = igraphdnrm2_(ncv, &workl[invsub + (j - 1) * ldq], & 929 c__1); 930 d__2 = igraphdnrm2_(ncv, &workl[invsub + j * ldq], &c__1); 931 temp = igraphdlapy2_(&d__1, &d__2); 932 d__1 = 1. / temp; 933 igraphdscal_(ncv, &d__1, &workl[invsub + (j - 1) * ldq], & 934 c__1); 935 d__1 = 1. / temp; 936 igraphdscal_(ncv, &d__1, &workl[invsub + j * ldq], &c__1); 937 iconj = 1; 938 } else { 939 iconj = 0; 940 } 941 942 } 943 944 /* L40: */ 945 } 946 947 igraphdgemv_("T", ncv, &nconv, &c_b45, &workl[invsub], &ldq, &workl[ 948 ihbds], &c__1, &c_b44, &workev[1], &c__1); 949 950 iconj = 0; 951 i__1 = nconv; 952 for (j = 1; j <= i__1; ++j) { 953 if (workl[iheigi + j - 1] != 0.) { 954 955 /* %-------------------------------------------% 956 | Complex conjugate pair case. Note that | 957 | since the real and imaginary part of | 958 | the eigenvector are stored in consecutive | 959 %-------------------------------------------% */ 960 961 if (iconj == 0) { 962 workev[j] = igraphdlapy2_(&workev[j], &workev[j + 1]); 963 workev[j + 1] = workev[j]; 964 iconj = 1; 965 } else { 966 iconj = 0; 967 } 968 } 969 /* L45: */ 970 } 971 972 if (msglvl > 2) { 973 igraphdcopy_(ncv, &workl[invsub + *ncv - 1], &ldq, &workl[ihbds], & 974 c__1); 975 igraphdvout_(&logfil, ncv, &workl[ihbds], &ndigit, "_neupd: Last r" 976 "ow of the eigenvector matrix for T", (ftnlen)48); 977 if (msglvl > 3) { 978 igraphdmout_(&logfil, ncv, ncv, &workl[invsub], &ldq, &ndigit, 979 "_neupd: The eigenvector matrix for T", (ftnlen) 980 36); 981 } 982 } 983 984 /* %---------------------------------------% 985 | Copy Ritz estimates into workl(ihbds) | 986 %---------------------------------------% */ 987 988 igraphdcopy_(&nconv, &workev[1], &c__1, &workl[ihbds], &c__1); 989 990 /* %---------------------------------------------------------% 991 | Compute the QR factorization of the eigenvector matrix | 992 | associated with leading portion of T in the first NCONV | 993 | columns of workl(invsub,ldq). | 994 %---------------------------------------------------------% */ 995 996 igraphdgeqr2_(ncv, &nconv, &workl[invsub], &ldq, &workev[1], &workev[* 997 ncv + 1], &ierr); 998 999 /* %----------------------------------------------% 1000 | * Postmultiply Z by Q. | 1001 | * Postmultiply Z by R. | 1002 | The N by NCONV matrix Z is now contains the | 1003 | Ritz vectors associated with the Ritz values | 1004 | in workl(iheigr) and workl(iheigi). | 1005 %----------------------------------------------% */ 1006 1007 igraphdorm2r_("Right", "Notranspose", n, ncv, &nconv, &workl[invsub], & 1008 ldq, &workev[1], &z__[z_offset], ldz, &workd[*n + 1], & 1009 ierr); 1010 1011 igraphdtrmm_("Right", "Upper", "No transpose", "Non-unit", n, &nconv, & 1012 c_b45, &workl[invsub], &ldq, &z__[z_offset], ldz); 1013 1014 } 1015 1016 } else { 1017 1018 /* %------------------------------------------------------% 1019 | An approximate invariant subspace is not needed. | 1020 | Place the Ritz values computed DNAUPD into DR and DI | 1021 %------------------------------------------------------% */ 1022 1023 igraphdcopy_(&nconv, &workl[ritzr], &c__1, &dr[1], &c__1); 1024 igraphdcopy_(&nconv, &workl[ritzi], &c__1, &di[1], &c__1); 1025 igraphdcopy_(&nconv, &workl[ritzr], &c__1, &workl[iheigr], &c__1); 1026 igraphdcopy_(&nconv, &workl[ritzi], &c__1, &workl[iheigi], &c__1); 1027 igraphdcopy_(&nconv, &workl[bounds], &c__1, &workl[ihbds], &c__1); 1028 } 1029 1030 /* %------------------------------------------------% 1031 | Transform the Ritz values and possibly vectors | 1032 | and corresponding error bounds of OP to those | 1033 | of A*x = lambda*B*x. | 1034 %------------------------------------------------% */ 1035 1036 if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0) { 1037 1038 if (*rvec) { 1039 igraphdscal_(ncv, &rnorm, &workl[ihbds], &c__1); 1040 } 1041 1042 } else { 1043 1044 /* %---------------------------------------% 1045 | A spectral transformation was used. | 1046 | * Determine the Ritz estimates of the | 1047 | Ritz values in the original system. | 1048 %---------------------------------------% */ 1049 1050 if (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0) { 1051 1052 if (*rvec) { 1053 igraphdscal_(ncv, &rnorm, &workl[ihbds], &c__1); 1054 } 1055 1056 i__1 = *ncv; 1057 for (k = 1; k <= i__1; ++k) { 1058 temp = igraphdlapy2_(&workl[iheigr + k - 1], &workl[iheigi + k - 1]) 1059 ; 1060 workl[ihbds + k - 1] = (d__1 = workl[ihbds + k - 1], abs(d__1) 1061 ) / temp / temp; 1062 /* L50: */ 1063 } 1064 1065 } else if (s_cmp(type__, "REALPT", (ftnlen)6, (ftnlen)6) == 0) { 1066 1067 i__1 = *ncv; 1068 for (k = 1; k <= i__1; ++k) { 1069 /* L60: */ 1070 } 1071 1072 } else if (s_cmp(type__, "IMAGPT", (ftnlen)6, (ftnlen)6) == 0) { 1073 1074 i__1 = *ncv; 1075 for (k = 1; k <= i__1; ++k) { 1076 /* L70: */ 1077 } 1078 1079 } 1080 1081 /* %-----------------------------------------------------------% 1082 | * Transform the Ritz values back to the original system. | 1083 | For TYPE = 'SHIFTI' the transformation is | 1084 | lambda = 1/theta + sigma | 1085 | For TYPE = 'REALPT' or 'IMAGPT' the user must from | 1086 | Rayleigh quotients or a projection. See remark 3 above.| 1087 | NOTES: | 1088 | *The Ritz vectors are not affected by the transformation. | 1089 %-----------------------------------------------------------% */ 1090 1091 if (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0) { 1092 1093 i__1 = *ncv; 1094 for (k = 1; k <= i__1; ++k) { 1095 temp = igraphdlapy2_(&workl[iheigr + k - 1], &workl[iheigi + k - 1]) 1096 ; 1097 workl[iheigr + k - 1] = workl[iheigr + k - 1] / temp / temp + 1098 *sigmar; 1099 workl[iheigi + k - 1] = -workl[iheigi + k - 1] / temp / temp 1100 + *sigmai; 1101 /* L80: */ 1102 } 1103 1104 igraphdcopy_(&nconv, &workl[iheigr], &c__1, &dr[1], &c__1); 1105 igraphdcopy_(&nconv, &workl[iheigi], &c__1, &di[1], &c__1); 1106 1107 } else if (s_cmp(type__, "REALPT", (ftnlen)6, (ftnlen)6) == 0 || 1108 s_cmp(type__, "IMAGPT", (ftnlen)6, (ftnlen)6) == 0) { 1109 1110 igraphdcopy_(&nconv, &workl[iheigr], &c__1, &dr[1], &c__1); 1111 igraphdcopy_(&nconv, &workl[iheigi], &c__1, &di[1], &c__1); 1112 1113 } 1114 1115 } 1116 1117 if (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0 && msglvl > 1) { 1118 igraphdvout_(&logfil, &nconv, &dr[1], &ndigit, "_neupd: Untransformed real" 1119 " part of the Ritz valuess.", (ftnlen)52); 1120 igraphdvout_(&logfil, &nconv, &di[1], &ndigit, "_neupd: Untransformed imag" 1121 " part of the Ritz valuess.", (ftnlen)52); 1122 igraphdvout_(&logfil, &nconv, &workl[ihbds], &ndigit, "_neupd: Ritz estima" 1123 "tes of untransformed Ritz values.", (ftnlen)52); 1124 } else if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0 && msglvl > 1125 1) { 1126 igraphdvout_(&logfil, &nconv, &dr[1], &ndigit, "_neupd: Real parts of conv" 1127 "erged Ritz values.", (ftnlen)44); 1128 igraphdvout_(&logfil, &nconv, &di[1], &ndigit, "_neupd: Imag parts of conv" 1129 "erged Ritz values.", (ftnlen)44); 1130 igraphdvout_(&logfil, &nconv, &workl[ihbds], &ndigit, "_neupd: Associated " 1131 "Ritz estimates.", (ftnlen)34); 1132 } 1133 1134 /* %-------------------------------------------------% 1135 | Eigenvector Purification step. Formally perform | 1136 | one of inverse subspace iteration. Only used | 1137 | for MODE = 2. | 1138 %-------------------------------------------------% */ 1139 1140 if (*rvec && *(unsigned char *)howmny == 'A' && s_cmp(type__, "SHIFTI", ( 1141 ftnlen)6, (ftnlen)6) == 0) { 1142 1143 /* %------------------------------------------------% 1144 | Purify the computed Ritz vectors by adding a | 1145 | little bit of the residual vector: | 1146 | T | 1147 | resid(:)*( e s ) / theta | 1148 | NCV | 1149 | where H s = s theta. Remember that when theta | 1150 | has nonzero imaginary part, the corresponding | 1151 | Ritz vector is stored across two columns of Z. | 1152 %------------------------------------------------% */ 1153 1154 iconj = 0; 1155 i__1 = nconv; 1156 for (j = 1; j <= i__1; ++j) { 1157 if (workl[iheigi + j - 1] == 0.) { 1158 workev[j] = workl[invsub + (j - 1) * ldq + *ncv - 1] / workl[ 1159 iheigr + j - 1]; 1160 } else if (iconj == 0) { 1161 temp = igraphdlapy2_(&workl[iheigr + j - 1], &workl[iheigi + j - 1]) 1162 ; 1163 workev[j] = (workl[invsub + (j - 1) * ldq + *ncv - 1] * workl[ 1164 iheigr + j - 1] + workl[invsub + j * ldq + *ncv - 1] * 1165 workl[iheigi + j - 1]) / temp / temp; 1166 workev[j + 1] = (workl[invsub + j * ldq + *ncv - 1] * workl[ 1167 iheigr + j - 1] - workl[invsub + (j - 1) * ldq + *ncv 1168 - 1] * workl[iheigi + j - 1]) / temp / temp; 1169 iconj = 1; 1170 } else { 1171 iconj = 0; 1172 } 1173 /* L110: */ 1174 } 1175 1176 /* %---------------------------------------% 1177 | Perform a rank one update to Z and | 1178 | purify all the Ritz vectors together. | 1179 %---------------------------------------% */ 1180 1181 igraphdger_(n, &nconv, &c_b45, &resid[1], &c__1, &workev[1], &c__1, &z__[ 1182 z_offset], ldz); 1183 1184 } 1185 1186 L9000: 1187 1188 return 0; 1189 1190 /* %---------------% 1191 | End of DNEUPD | 1192 %---------------% */ 1193 1194 } /* igraphdneupd_ */ 1195 1196