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