~ubuntu-branches/debian/wheezy/arpack/wheezy

« back to all changes in this revision

Viewing changes to ARPACK/SRC/sneupd.f

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2011-12-10 20:32:45 UTC
  • mfrom: (1.2.2)
  • Revision ID: package-import@ubuntu.com-20111210203245-g0fo30pqvuo92fqh
Tags: 3.0-1
* Switch to arpack-ng since upstream is dead.
* New upstream release
* Daniel Leidert removed from the uploaders (Closes: #651351)

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
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
 
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
 
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    , nconv2
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
 
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
 
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
 
     &                   nconv2       , conds        ,
665
 
     &                   sep          , workl(ihbds) , 
666
 
     &                   ncv          , iwork        ,
667
 
     &                   1            , ierr)
668
 
c
669
 
            if (nconv2 .lt. nconv) then
670
 
               nconv = nconv2
671
 
            end if
672
 
 
673
 
            if (ierr .eq. 1) then
674
 
               info = 1
675
 
               go to 9000
676
 
            end if
677
 
c
678
 
            if (msglvl .gt. 2) then
679
 
                call svout(logfil, ncv, workl(iheigr), ndigit,
680
 
     &           '_neupd: Real part of the eigenvalues of H--reordered')
681
 
                call svout(logfil, ncv, workl(iheigi), ndigit,
682
 
     &           '_neupd: Imag part of the eigenvalues of H--reordered')
683
 
                if (msglvl .gt. 3) then
684
 
                   call smout(logfil       , ncv, ncv   , 
685
 
     &                         workl(iuptri), ldq, ndigit,
686
 
     &             '_neupd: Quasi-triangular matrix after re-ordering')
687
 
                end if
688
 
            end if
689
 
c     
690
 
         end if
691
 
c
692
 
c        %---------------------------------------%
693
 
c        | Copy the last row of the Schur vector |
694
 
c        | into workl(ihbds).  This will be used |
695
 
c        | to compute the Ritz estimates of      |
696
 
c        | converged Ritz values.                |
697
 
c        %---------------------------------------%
698
 
c
699
 
         call scopy(ncv, workl(invsub+ncv-1), ldq, workl(ihbds), 1)
700
 
c
701
 
c        %----------------------------------------------------%
702
 
c        | Place the computed eigenvalues of H into DR and DI |
703
 
c        | if a spectral transformation was not used.         |
704
 
c        %----------------------------------------------------%
705
 
c
706
 
         if (type .eq. 'REGULR') then 
707
 
            call scopy(nconv, workl(iheigr), 1, dr, 1)
708
 
            call scopy(nconv, workl(iheigi), 1, di, 1)
709
 
         end if
710
 
c     
711
 
c        %----------------------------------------------------------%
712
 
c        | Compute the QR factorization of the matrix representing  |
713
 
c        | the wanted invariant subspace located in the first NCONV |
714
 
c        | columns of workl(invsub,ldq).                            |
715
 
c        %----------------------------------------------------------%
716
 
c     
717
 
         call sgeqr2(ncv, nconv , workl(invsub), 
718
 
     &               ldq, workev, workev(ncv+1),
719
 
     &               ierr)
720
 
c
721
 
c        %---------------------------------------------------------%
722
 
c        | * Postmultiply V by Q using sorm2r.                     |   
723
 
c        | * Copy the first NCONV columns of VQ into Z.            |
724
 
c        | * Postmultiply Z by R.                                  |
725
 
c        | The N by NCONV matrix Z is now a matrix representation  |
726
 
c        | of the approximate invariant subspace associated with   |
727
 
c        | the Ritz values in workl(iheigr) and workl(iheigi)      |
728
 
c        | The first NCONV columns of V are now approximate Schur  |
729
 
c        | vectors associated with the real upper quasi-triangular |
730
 
c        | matrix of order NCONV in workl(iuptri)                  |
731
 
c        %---------------------------------------------------------%
732
 
c     
733
 
         call sorm2r('Right', 'Notranspose', n            , 
734
 
     &                ncv   , nconv        , workl(invsub),
735
 
     &                ldq   , workev       , v            , 
736
 
     &                ldv   , workd(n+1)   , ierr)
737
 
         call slacpy('All', n, nconv, v, ldv, z, ldz)
738
 
c
739
 
         do 20 j=1, nconv
740
 
c     
741
 
c           %---------------------------------------------------%
742
 
c           | Perform both a column and row scaling if the      |
743
 
c           | diagonal element of workl(invsub,ldq) is negative |
744
 
c           | I'm lazy and don't take advantage of the upper    |
745
 
c           | quasi-triangular form of workl(iuptri,ldq)        |
746
 
c           | Note that since Q is orthogonal, R is a diagonal  |
747
 
c           | matrix consisting of plus or minus ones           |
748
 
c           %---------------------------------------------------%
749
 
c     
750
 
            if (workl(invsub+(j-1)*ldq+j-1) .lt. zero) then
751
 
               call sscal(nconv, -one, workl(iuptri+j-1), ldq)
752
 
               call sscal(nconv, -one, workl(iuptri+(j-1)*ldq), 1)
753
 
            end if
754
 
c     
755
 
 20      continue
756
 
c     
757
 
         if (howmny .eq. 'A') then
758
 
c     
759
 
c           %--------------------------------------------%
760
 
c           | Compute the NCONV wanted eigenvectors of T | 
761
 
c           | located in workl(iuptri,ldq).              |
762
 
c           %--------------------------------------------%
763
 
c     
764
 
            do 30 j=1, ncv
765
 
               if (j .le. nconv) then
766
 
                  select(j) = .true.
767
 
               else
768
 
                  select(j) = .false.
769
 
               end if
770
 
 30         continue
771
 
c
772
 
            call strevc('Right', 'Select'     , select       , 
773
 
     &                   ncv    , workl(iuptri), ldq          , 
774
 
     &                   vl     , 1            , workl(invsub),
775
 
     &                   ldq    , ncv          , outncv       ,
776
 
     &                   workev , ierr)
777
 
c
778
 
            if (ierr .ne. 0) then
779
 
                info = -9
780
 
                go to 9000
781
 
            end if
782
 
c     
783
 
c           %------------------------------------------------%
784
 
c           | Scale the returning eigenvectors so that their |
785
 
c           | Euclidean norms are all one. LAPACK subroutine |
786
 
c           | strevc returns each eigenvector normalized so  |
787
 
c           | that the element of largest magnitude has      |
788
 
c           | magnitude 1;                                   |
789
 
c           %------------------------------------------------%
790
 
c     
791
 
            iconj = 0
792
 
            do 40 j=1, nconv
793
 
c
794
 
               if ( workl(iheigi+j-1) .eq. zero ) then
795
 
c     
796
 
c                 %----------------------%
797
 
c                 | real eigenvalue case |
798
 
c                 %----------------------%
799
 
c     
800
 
                  temp = snrm2( ncv, workl(invsub+(j-1)*ldq), 1 )
801
 
                  call sscal( ncv, one / temp, 
802
 
     &                 workl(invsub+(j-1)*ldq), 1 )
803
 
c
804
 
               else
805
 
c     
806
 
c                 %-------------------------------------------%
807
 
c                 | Complex conjugate pair case. Note that    |
808
 
c                 | since the real and imaginary part of      |
809
 
c                 | the eigenvector are stored in consecutive |
810
 
c                 | columns, we further normalize by the      |
811
 
c                 | square root of two.                       |
812
 
c                 %-------------------------------------------%
813
 
c
814
 
                  if (iconj .eq. 0) then
815
 
                     temp = slapy2(snrm2(ncv, 
816
 
     &                                   workl(invsub+(j-1)*ldq), 
817
 
     &                                   1),
818
 
     &                             snrm2(ncv, 
819
 
     &                                   workl(invsub+j*ldq),
820
 
     &                                   1))  
821
 
                     call sscal(ncv, one/temp, 
822
 
     &                           workl(invsub+(j-1)*ldq), 1 )
823
 
                     call sscal(ncv, one/temp, 
824
 
     &                           workl(invsub+j*ldq), 1 )
825
 
                     iconj = 1
826
 
                  else
827
 
                     iconj = 0
828
 
                  end if
829
 
c
830
 
               end if
831
 
c
832
 
 40         continue
833
 
c
834
 
            call sgemv('T', ncv, nconv, one, workl(invsub),
835
 
     &                 ldq, workl(ihbds), 1, zero,  workev, 1)
836
 
c
837
 
            iconj = 0
838
 
            do 45 j=1, nconv
839
 
               if (workl(iheigi+j-1) .ne. zero) then
840
 
c
841
 
c                 %-------------------------------------------%
842
 
c                 | Complex conjugate pair case. Note that    |
843
 
c                 | since the real and imaginary part of      |
844
 
c                 | the eigenvector are stored in consecutive |
845
 
c                 %-------------------------------------------%
846
 
c
847
 
                  if (iconj .eq. 0) then
848
 
                     workev(j) = slapy2(workev(j), workev(j+1))
849
 
                     workev(j+1) = workev(j)
850
 
                     iconj = 1
851
 
                  else
852
 
                     iconj = 0
853
 
                  end if
854
 
               end if
855
 
 45         continue
856
 
c
857
 
            if (msglvl .gt. 2) then
858
 
               call scopy(ncv, workl(invsub+ncv-1), ldq,
859
 
     &                    workl(ihbds), 1)
860
 
               call svout(logfil, ncv, workl(ihbds), ndigit,
861
 
     &              '_neupd: Last row of the eigenvector matrix for T')
862
 
               if (msglvl .gt. 3) then
863
 
                  call smout(logfil, ncv, ncv, workl(invsub), ldq, 
864
 
     &                 ndigit, '_neupd: The eigenvector matrix for T')
865
 
               end if
866
 
            end if
867
 
c
868
 
c           %---------------------------------------%
869
 
c           | Copy Ritz estimates into workl(ihbds) |
870
 
c           %---------------------------------------%
871
 
c
872
 
            call scopy(nconv, workev, 1, workl(ihbds), 1)
873
 
c
874
 
c           %---------------------------------------------------------%
875
 
c           | Compute the QR factorization of the eigenvector matrix  |
876
 
c           | associated with leading portion of T in the first NCONV |
877
 
c           | columns of workl(invsub,ldq).                           |
878
 
c           %---------------------------------------------------------%
879
 
c     
880
 
            call sgeqr2(ncv, nconv , workl(invsub), 
881
 
     &                   ldq, workev, workev(ncv+1),
882
 
     &                   ierr)
883
 
c     
884
 
c           %----------------------------------------------%
885
 
c           | * Postmultiply Z by Q.                       |   
886
 
c           | * Postmultiply Z by R.                       |
887
 
c           | The N by NCONV matrix Z is now contains the  | 
888
 
c           | Ritz vectors associated with the Ritz values |
889
 
c           | in workl(iheigr) and workl(iheigi).          |
890
 
c           %----------------------------------------------%
891
 
c     
892
 
            call sorm2r('Right', 'Notranspose', n            ,
893
 
     &                   ncv  , nconv        , workl(invsub),
894
 
     &                   ldq  , workev       , z            ,
895
 
     &                   ldz  , workd(n+1)   , ierr)
896
 
c     
897
 
            call strmm('Right'   , 'Upper'       , 'No transpose',
898
 
     &                  'Non-unit', n            , nconv         ,
899
 
     &                  one       , workl(invsub), ldq           ,
900
 
     &                  z         , ldz)
901
 
c     
902
 
         end if
903
 
c     
904
 
      else 
905
 
c
906
 
c        %------------------------------------------------------%
907
 
c        | An approximate invariant subspace is not needed.     |
908
 
c        | Place the Ritz values computed SNAUPD into DR and DI |
909
 
c        %------------------------------------------------------%
910
 
c
911
 
         call scopy(nconv, workl(ritzr), 1, dr, 1)
912
 
         call scopy(nconv, workl(ritzi), 1, di, 1)
913
 
         call scopy(nconv, workl(ritzr), 1, workl(iheigr), 1)
914
 
         call scopy(nconv, workl(ritzi), 1, workl(iheigi), 1)
915
 
         call scopy(nconv, workl(bounds), 1, workl(ihbds), 1)
916
 
      end if
917
 
918
 
c     %------------------------------------------------%
919
 
c     | Transform the Ritz values and possibly vectors |
920
 
c     | and corresponding error bounds of OP to those  |
921
 
c     | of A*x = lambda*B*x.                           |
922
 
c     %------------------------------------------------%
923
 
c
924
 
      if (type .eq. 'REGULR') then
925
 
c
926
 
         if (rvec) 
927
 
     &      call sscal(ncv, rnorm, workl(ihbds), 1)     
928
 
c     
929
 
      else 
930
 
c     
931
 
c        %---------------------------------------%
932
 
c        |   A spectral transformation was used. |
933
 
c        | * Determine the Ritz estimates of the |
934
 
c        |   Ritz values in the original system. |
935
 
c        %---------------------------------------%
936
 
c     
937
 
         if (type .eq. 'SHIFTI') then
938
 
c
939
 
            if (rvec) 
940
 
     &         call sscal(ncv, rnorm, workl(ihbds), 1)
941
 
c
942
 
            do 50 k=1, ncv
943
 
               temp = slapy2( workl(iheigr+k-1), 
944
 
     &                        workl(iheigi+k-1) )
945
 
               workl(ihbds+k-1) = abs( workl(ihbds+k-1) ) 
946
 
     &                          / temp / temp
947
 
 50         continue
948
 
c
949
 
         else if (type .eq. 'REALPT') then
950
 
c
951
 
            do 60 k=1, ncv
952
 
 60         continue
953
 
c
954
 
         else if (type .eq. 'IMAGPT') then
955
 
c
956
 
            do 70 k=1, ncv
957
 
 70         continue
958
 
c
959
 
         end if
960
 
c     
961
 
c        %-----------------------------------------------------------%
962
 
c        | *  Transform the Ritz values back to the original system. |
963
 
c        |    For TYPE = 'SHIFTI' the transformation is              |
964
 
c        |             lambda = 1/theta + sigma                      |
965
 
c        |    For TYPE = 'REALPT' or 'IMAGPT' the user must from     |
966
 
c        |    Rayleigh quotients or a projection. See remark 3 above.| 
967
 
c        | NOTES:                                                    |
968
 
c        | *The Ritz vectors are not affected by the transformation. |
969
 
c        %-----------------------------------------------------------%
970
 
c     
971
 
         if (type .eq. 'SHIFTI') then 
972
 
c
973
 
            do 80 k=1, ncv
974
 
               temp = slapy2( workl(iheigr+k-1), 
975
 
     &                        workl(iheigi+k-1) )
976
 
               workl(iheigr+k-1) = workl(iheigr+k-1)/temp/temp 
977
 
     &                           + sigmar   
978
 
               workl(iheigi+k-1) = -workl(iheigi+k-1)/temp/temp
979
 
     &                           + sigmai   
980
 
 80         continue
981
 
c
982
 
            call scopy(nconv, workl(iheigr), 1, dr, 1)
983
 
            call scopy(nconv, workl(iheigi), 1, di, 1)
984
 
c
985
 
         else if (type .eq. 'REALPT' .or. type .eq. 'IMAGPT') then
986
 
c
987
 
            call scopy(nconv, workl(iheigr), 1, dr, 1)
988
 
            call scopy(nconv, workl(iheigi), 1, di, 1)
989
 
c
990
 
         end if
991
 
c
992
 
      end if
993
 
c
994
 
      if (type .eq. 'SHIFTI' .and. msglvl .gt. 1) then
995
 
         call svout(logfil, nconv, dr, ndigit,
996
 
     &   '_neupd: Untransformed real part of the Ritz valuess.')
997
 
         call svout (logfil, nconv, di, ndigit,
998
 
     &   '_neupd: Untransformed imag part of the Ritz valuess.')
999
 
         call svout(logfil, nconv, workl(ihbds), ndigit,
1000
 
     &   '_neupd: Ritz estimates of untransformed Ritz values.')
1001
 
      else if (type .eq. 'REGULR' .and. msglvl .gt. 1) then
1002
 
         call svout(logfil, nconv, dr, ndigit,
1003
 
     &   '_neupd: Real parts of converged Ritz values.')
1004
 
         call svout (logfil, nconv, di, ndigit,
1005
 
     &   '_neupd: Imag parts of converged Ritz values.')
1006
 
         call svout(logfil, nconv, workl(ihbds), ndigit,
1007
 
     &   '_neupd: Associated Ritz estimates.')
1008
 
      end if
1009
 
1010
 
c     %-------------------------------------------------%
1011
 
c     | Eigenvector Purification step. Formally perform |
1012
 
c     | one of inverse subspace iteration. Only used    |
1013
 
c     | for MODE = 2.                                   |
1014
 
c     %-------------------------------------------------%
1015
 
c
1016
 
      if (rvec .and. howmny .eq. 'A' .and. type .eq. 'SHIFTI') then
1017
 
c
1018
 
c        %------------------------------------------------%
1019
 
c        | Purify the computed Ritz vectors by adding a   |
1020
 
c        | little bit of the residual vector:             |
1021
 
c        |                      T                         |
1022
 
c        |          resid(:)*( e    s ) / theta           |
1023
 
c        |                      NCV                       |
1024
 
c        | where H s = s theta. Remember that when theta  |
1025
 
c        | has nonzero imaginary part, the corresponding  |
1026
 
c        | Ritz vector is stored across two columns of Z. |
1027
 
c        %------------------------------------------------%
1028
 
c
1029
 
         iconj = 0
1030
 
         do 110 j=1, nconv
1031
 
            if (workl(iheigi+j-1) .eq. zero) then
1032
 
               workev(j) =  workl(invsub+(j-1)*ldq+ncv-1) /
1033
 
     &                      workl(iheigr+j-1)
1034
 
            else if (iconj .eq. 0) then
1035
 
               temp = slapy2( workl(iheigr+j-1), workl(iheigi+j-1) )
1036
 
               workev(j) = ( workl(invsub+(j-1)*ldq+ncv-1) * 
1037
 
     &                       workl(iheigr+j-1) +
1038
 
     &                       workl(invsub+j*ldq+ncv-1) * 
1039
 
     &                       workl(iheigi+j-1) ) / temp / temp
1040
 
               workev(j+1) = ( workl(invsub+j*ldq+ncv-1) * 
1041
 
     &                         workl(iheigr+j-1) -
1042
 
     &                         workl(invsub+(j-1)*ldq+ncv-1) * 
1043
 
     &                         workl(iheigi+j-1) ) / temp / temp
1044
 
               iconj = 1
1045
 
            else
1046
 
               iconj = 0
1047
 
            end if
1048
 
 110     continue
1049
 
c
1050
 
c        %---------------------------------------%
1051
 
c        | Perform a rank one update to Z and    |
1052
 
c        | purify all the Ritz vectors together. |
1053
 
c        %---------------------------------------%
1054
 
c
1055
 
         call sger(n, nconv, one, resid, 1, workev, 1, z, ldz)
1056
 
c
1057
 
      end if
1058
 
c
1059
 
 9000 continue
1060
 
c
1061
 
      return
1062
 
c     
1063
 
c     %---------------%
1064
 
c     | End of SNEUPD |
1065
 
c     %---------------%
1066
 
c
1067
 
      end