| 1 |
/* ./src_f77/cneupd.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
/* Common Block Declarations */ |
| 9 |
|
| 10 |
struct { |
| 11 |
integer logfil, ndigit, mgetv0, msaupd, msaup2, msaitr, mseigt, msapps, |
| 12 |
msgets, mseupd, mnaupd, mnaup2, mnaitr, mneigh, mnapps, mngets, |
| 13 |
mneupd, mcaupd, mcaup2, mcaitr, mceigh, mcapps, mcgets, mceupd; |
| 14 |
} debug_CNEUPD; |
| 15 |
|
| 16 |
#define debug_1 debug_CNEUPD |
| 17 |
|
| 18 |
struct { |
| 19 |
integer nopx, nbx, nrorth, nitref, nrstrt; |
| 20 |
real tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv, tnaupd, |
| 21 |
tnaup2, tnaitr, tneigh, tngets, tnapps, tnconv, tcaupd, tcaup2, |
| 22 |
tcaitr, tceigh, tcgets, tcapps, tcconv, tmvopx, tmvbx, tgetv0, |
| 23 |
titref, trvec; |
| 24 |
} timing_CNEUPD; |
| 25 |
|
| 26 |
#define timing_1 timing_CNEUPD |
| 27 |
|
| 28 |
/* Table of constant values */ |
| 29 |
|
| 30 |
static realcomplex c_b1 = {1.f,0.f}; |
| 31 |
static realcomplex c_b2 = {0.f,0.f}; |
| 32 |
static doublereal c_b5 = .66666666666666663; |
| 33 |
static integer c__1 = 1; |
| 34 |
static logical c_true = TRUE_; |
| 35 |
|
| 36 |
/* \BeginDoc */ |
| 37 |
|
| 38 |
/* \Name: cneupd */ |
| 39 |
|
| 40 |
/* \Description: */ |
| 41 |
/* This subroutine returns the converged approximations to eigenvalues */ |
| 42 |
/* of A*z = lambda*B*z and (optionally): */ |
| 43 |
|
| 44 |
/* (1) The corresponding approximate eigenvectors; */ |
| 45 |
|
| 46 |
/* (2) An orthonormal basis for the associated approximate */ |
| 47 |
/* invariant subspace; */ |
| 48 |
|
| 49 |
/* (3) Both. */ |
| 50 |
|
| 51 |
/* There is negligible additional cost to obtain eigenvectors. An orthonormal */ |
| 52 |
/* basis is always computed. There is an additional storage cost of n*nev */ |
| 53 |
/* if both are requested (in this case a separate array Z must be supplied). */ |
| 54 |
|
| 55 |
/* The approximate eigenvalues and eigenvectors of A*z = lambda*B*z */ |
| 56 |
/* are derived from approximate eigenvalues and eigenvectors of */ |
| 57 |
/* of the linear operator OP prescribed by the MODE selection in the */ |
| 58 |
/* call to CNAUPD. CNAUPD must be called before this routine is called. */ |
| 59 |
/* These approximate eigenvalues and vectors are commonly called Ritz */ |
| 60 |
/* values and Ritz vectors respectively. They are referred to as such */ |
| 61 |
/* in the comments that follow. The computed orthonormal basis for the */ |
| 62 |
/* invariant subspace corresponding to these Ritz values is referred to as a */ |
| 63 |
/* Schur basis. */ |
| 64 |
|
| 65 |
/* The definition of OP as well as other terms and the relation of computed */ |
| 66 |
/* Ritz values and vectors of OP with respect to the given problem */ |
| 67 |
/* A*z = lambda*B*z may be found in the header of CNAUPD. For a brief */ |
| 68 |
/* description, see definitions of IPARAM(7), MODE and WHICH in the */ |
| 69 |
/* documentation of CNAUPD. */ |
| 70 |
|
| 71 |
/* \Usage: */ |
| 72 |
/* call cneupd */ |
| 73 |
/* ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, WORKEV, BMAT, */ |
| 74 |
/* N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, WORKD, */ |
| 75 |
/* WORKL, LWORKL, RWORK, INFO ) */ |
| 76 |
|
| 77 |
/* \Arguments: */ |
| 78 |
/* RVEC LOGICAL (INPUT) */ |
| 79 |
/* Specifies whether a basis for the invariant subspace corresponding */ |
| 80 |
/* to the converged Ritz value approximations for the eigenproblem */ |
| 81 |
/* A*z = lambda*B*z is computed. */ |
| 82 |
|
| 83 |
/* RVEC = .FALSE. Compute Ritz values only. */ |
| 84 |
|
| 85 |
/* RVEC = .TRUE. Compute Ritz vectors or Schur vectors. */ |
| 86 |
/* See Remarks below. */ |
| 87 |
|
| 88 |
/* HOWMNY Character*1 (INPUT) */ |
| 89 |
/* Specifies the form of the basis for the invariant subspace */ |
| 90 |
/* corresponding to the converged Ritz values that is to be computed. */ |
| 91 |
|
| 92 |
/* = 'A': Compute NEV Ritz vectors; */ |
| 93 |
/* = 'P': Compute NEV Schur vectors; */ |
| 94 |
/* = 'S': compute some of the Ritz vectors, specified */ |
| 95 |
/* by the logical array SELECT. */ |
| 96 |
|
| 97 |
/* SELECT Logical array of dimension NCV. (INPUT) */ |
| 98 |
/* If HOWMNY = 'S', SELECT specifies the Ritz vectors to be */ |
| 99 |
/* computed. To select the Ritz vector corresponding to a */ |
| 100 |
/* Ritz value D(j), SELECT(j) must be set to .TRUE.. */ |
| 101 |
/* If HOWMNY = 'A' or 'P', SELECT need not be initialized */ |
| 102 |
/* but it is used as internal workspace. */ |
| 103 |
|
| 104 |
/* D Complex array of dimension NEV+1. (OUTPUT) */ |
| 105 |
/* On exit, D contains the Ritz approximations */ |
| 106 |
/* to the eigenvalues lambda for A*z = lambda*B*z. */ |
| 107 |
|
| 108 |
/* Z Complex N by NEV array (OUTPUT) */ |
| 109 |
/* On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of */ |
| 110 |
/* Z represents approximate eigenvectors (Ritz vectors) corresponding */ |
| 111 |
/* to the NCONV=IPARAM(5) Ritz values for eigensystem */ |
| 112 |
/* A*z = lambda*B*z. */ |
| 113 |
|
| 114 |
/* If RVEC = .FALSE. or HOWMNY = 'P', then Z is NOT REFERENCED. */ |
| 115 |
|
| 116 |
/* NOTE: If if RVEC = .TRUE. and a Schur basis is not required, */ |
| 117 |
/* the array Z may be set equal to first NEV+1 columns of the Arnoldi */ |
| 118 |
/* basis array V computed by CNAUPD. In this case the Arnoldi basis */ |
| 119 |
/* will be destroyed and overwritten with the eigenvector basis. */ |
| 120 |
|
| 121 |
/* LDZ Integer. (INPUT) */ |
| 122 |
/* The leading dimension of the array Z. If Ritz vectors are */ |
| 123 |
/* desired, then LDZ .ge. max( 1, N ) is required. */ |
| 124 |
/* In any case, LDZ .ge. 1 is required. */ |
| 125 |
|
| 126 |
/* SIGMA Complex (INPUT) */ |
| 127 |
/* If IPARAM(7) = 3 then SIGMA represents the shift. */ |
| 128 |
/* Not referenced if IPARAM(7) = 1 or 2. */ |
| 129 |
|
| 130 |
/* WORKEV Complex work array of dimension 2*NCV. (WORKSPACE) */ |
| 131 |
|
| 132 |
/* **** The remaining arguments MUST be the same as for the **** */ |
| 133 |
/* **** call to CNAUPD that was just completed. **** */ |
| 134 |
|
| 135 |
/* NOTE: The remaining arguments */ |
| 136 |
|
| 137 |
/* BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, */ |
| 138 |
/* WORKD, WORKL, LWORKL, RWORK, INFO */ |
| 139 |
|
| 140 |
/* must be passed directly to CNEUPD following the last call */ |
| 141 |
/* to CNAUPD. These arguments MUST NOT BE MODIFIED between */ |
| 142 |
/* the the last call to CNAUPD and the call to CNEUPD. */ |
| 143 |
|
| 144 |
/* Three of these parameters (V, WORKL and INFO) are also output parameters: */ |
| 145 |
|
| 146 |
/* V Complex N by NCV array. (INPUT/OUTPUT) */ |
| 147 |
|
| 148 |
/* Upon INPUT: the NCV columns of V contain the Arnoldi basis */ |
| 149 |
/* vectors for OP as constructed by CNAUPD . */ |
| 150 |
|
| 151 |
/* Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns */ |
| 152 |
/* contain approximate Schur vectors that span the */ |
| 153 |
/* desired invariant subspace. */ |
| 154 |
|
| 155 |
/* NOTE: If the array Z has been set equal to first NEV+1 columns */ |
| 156 |
/* of the array V and RVEC=.TRUE. and HOWMNY= 'A', then the */ |
| 157 |
/* Arnoldi basis held by V has been overwritten by the desired */ |
| 158 |
/* Ritz vectors. If a separate array Z has been passed then */ |
| 159 |
/* the first NCONV=IPARAM(5) columns of V will contain approximate */ |
| 160 |
/* Schur vectors that span the desired invariant subspace. */ |
| 161 |
|
| 162 |
/* WORKL Real work array of length LWORKL. (OUTPUT/WORKSPACE) */ |
| 163 |
/* WORKL(1:ncv*ncv+2*ncv) contains information obtained in */ |
| 164 |
/* cnaupd. They are not changed by cneupd. */ |
| 165 |
/* WORKL(ncv*ncv+2*ncv+1:3*ncv*ncv+4*ncv) holds the */ |
| 166 |
/* untransformed Ritz values, the untransformed error estimates of */ |
| 167 |
/* the Ritz values, the upper triangular matrix for H, and the */ |
| 168 |
/* associated matrix representation of the invariant subspace for H. */ |
| 169 |
|
| 170 |
/* Note: IPNTR(9:13) contains the pointer into WORKL for addresses */ |
| 171 |
/* of the above information computed by cneupd. */ |
| 172 |
/* ------------------------------------------------------------- */ |
| 173 |
/* IPNTR(9): pointer to the NCV RITZ values of the */ |
| 174 |
/* original system. */ |
| 175 |
/* IPNTR(10): Not used */ |
| 176 |
/* IPNTR(11): pointer to the NCV corresponding error estimates. */ |
| 177 |
/* IPNTR(12): pointer to the NCV by NCV upper triangular */ |
| 178 |
/* Schur matrix for H. */ |
| 179 |
/* IPNTR(13): pointer to the NCV by NCV matrix of eigenvectors */ |
| 180 |
/* of the upper Hessenberg matrix H. Only referenced by */ |
| 181 |
/* cneupd if RVEC = .TRUE. See Remark 2 below. */ |
| 182 |
/* ------------------------------------------------------------- */ |
| 183 |
|
| 184 |
/* INFO Integer. (OUTPUT) */ |
| 185 |
/* Error flag on output. */ |
| 186 |
/* = 0: Normal exit. */ |
| 187 |
|
| 188 |
/* = 1: The Schur form computed by LAPACK routine csheqr */ |
| 189 |
/* could not be reordered by LAPACK routine ctrsen. */ |
| 190 |
/* Re-enter subroutine cneupd with IPARAM(5)=NCV and */ |
| 191 |
/* increase the size of the array D to have */ |
| 192 |
/* dimension at least dimension NCV and allocate at least NCV */ |
| 193 |
/* columns for Z. NOTE: Not necessary if Z and V share */ |
| 194 |
/* the same space. Please notify the authors if this error */ |
| 195 |
/* occurs. */ |
| 196 |
|
| 197 |
/* = -1: N must be positive. */ |
| 198 |
/* = -2: NEV must be positive. */ |
| 199 |
/* = -3: NCV-NEV >= 1 and less than or equal to N. */ |
| 200 |
/* = -5: WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI' */ |
| 201 |
/* = -6: BMAT must be one of 'I' or 'G'. */ |
| 202 |
/* = -7: Length of private work WORKL array is not sufficient. */ |
| 203 |
/* = -8: Error return from LAPACK eigenvalue calculation. */ |
| 204 |
/* This should never happened. */ |
| 205 |
/* = -9: Error return from calculation of eigenvectors. */ |
| 206 |
/* Informational error from LAPACK routine ctrevc. */ |
| 207 |
/* = -10: IPARAM(7) must be 1,2,3 */ |
| 208 |
/* = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatible. */ |
| 209 |
/* = -12: HOWMNY = 'S' not yet implemented */ |
| 210 |
/* = -13: HOWMNY must be one of 'A' or 'P' if RVEC = .true. */ |
| 211 |
/* = -14: CNAUPD did not find any eigenvalues to sufficient */ |
| 212 |
/* accuracy. */ |
| 213 |
/* = -15: CNEUPD got a different count of the number of converged */ |
| 214 |
/* Ritz values than CNAUPD got. This indicates the user */ |
| 215 |
/* probably made an error in passing data from CNAUPD to */ |
| 216 |
/* CNEUPD or that the data was modified before entering */ |
| 217 |
/* CNEUPD */ |
| 218 |
|
| 219 |
/* \BeginLib */ |
| 220 |
|
| 221 |
/* \References: */ |
| 222 |
/* 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in */ |
| 223 |
/* a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), */ |
| 224 |
/* pp 357-385. */ |
| 225 |
/* 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly */ |
| 226 |
/* Restarted Arnoldi Iteration", Rice University Technical Report */ |
| 227 |
/* TR95-13, Department of Computational and Applied Mathematics. */ |
| 228 |
/* 3. B. Nour-Omid, B. N. Parlett, T. Ericsson and P. S. Jensen, */ |
| 229 |
/* "How to Implement the Spectral Transformation", Math Comp., */ |
| 230 |
/* Vol. 48, No. 178, April, 1987 pp. 664-673. */ |
| 231 |
|
| 232 |
/* \Routines called: */ |
| 233 |
/* ivout ARPACK utility routine that prints integers. */ |
| 234 |
/* cmout ARPACK utility routine that prints matrices */ |
| 235 |
/* cvout ARPACK utility routine that prints vectors. */ |
| 236 |
/* cgeqr2 LAPACK routine that computes the QR factorization of */ |
| 237 |
/* a matrix. */ |
| 238 |
/* clacpy LAPACK matrix copy routine. */ |
| 239 |
/* clahqr LAPACK routine that computes the Schur form of a */ |
| 240 |
/* upper Hessenberg matrix. */ |
| 241 |
/* claset LAPACK matrix initialization routine. */ |
| 242 |
/* ctrevc LAPACK routine to compute the eigenvectors of a matrix */ |
| 243 |
/* in upper triangular form. */ |
| 244 |
/* ctrsen LAPACK routine that re-orders the Schur form. */ |
| 245 |
/* cunm2r LAPACK routine that applies an orthogonal matrix in */ |
| 246 |
/* factored form. */ |
| 247 |
/* slamch LAPACK routine that determines machine constants. */ |
| 248 |
/* ctrmm Level 3 BLAS matrix times an upper triangular matrix. */ |
| 249 |
/* cgeru Level 2 BLAS rank one update to a matrix. */ |
| 250 |
/* ccopy Level 1 BLAS that copies one vector to another . */ |
| 251 |
/* cscal Level 1 BLAS that scales a vector. */ |
| 252 |
/* csscal Level 1 BLAS that scales a complex vector by a real number. */ |
| 253 |
/* scnrm2 Level 1 BLAS that computes the norm of a complex vector. */ |
| 254 |
|
| 255 |
/* \Remarks */ |
| 256 |
|
| 257 |
/* 1. Currently only HOWMNY = 'A' and 'P' are implemented. */ |
| 258 |
|
| 259 |
/* 2. Schur vectors are an orthogonal representation for the basis of */ |
| 260 |
/* Ritz vectors. Thus, their numerical properties are often superior. */ |
| 261 |
/* If RVEC = .true. then the relationship */ |
| 262 |
/* A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and */ |
| 263 |
/* transpose( V(:,1:IPARAM(5)) ) * V(:,1:IPARAM(5)) = I */ |
| 264 |
/* are approximately satisfied. */ |
| 265 |
/* Here T is the leading submatrix of order IPARAM(5) of the */ |
| 266 |
/* upper triangular matrix stored workl(ipntr(12)). */ |
| 267 |
|
| 268 |
/* \Authors */ |
| 269 |
/* Danny Sorensen Phuong Vu */ |
| 270 |
/* Richard Lehoucq CRPC / Rice University */ |
| 271 |
/* Chao Yang Houston, Texas */ |
| 272 |
/* Dept. of Computational & */ |
| 273 |
/* Applied Mathematics */ |
| 274 |
/* Rice University */ |
| 275 |
/* Houston, Texas */ |
| 276 |
|
| 277 |
/* \SCCS Information: @(#) */ |
| 278 |
/* FILE: neupd.F SID: 2.8 DATE OF SID: 07/21/02 RELEASE: 2 */ |
| 279 |
|
| 280 |
/* \EndLib */ |
| 281 |
|
| 282 |
/* ----------------------------------------------------------------------- */ |
| 283 |
/* Subroutine */ int cneupd_(logical *rvec, char *howmny, logical *select, |
| 284 |
realcomplex *d__, realcomplex *z__, integer *ldz, realcomplex *sigma, realcomplex * |
| 285 |
workev, char *bmat, integer *n, char *which, integer *nev, real *tol, |
| 286 |
realcomplex *resid, integer *ncv, realcomplex *v, integer *ldv, integer * |
| 287 |
iparam, integer *ipntr, realcomplex *workd, realcomplex *workl, integer * |
| 288 |
lworkl, real *rwork, integer *info, ftnlen howmny_len, ftnlen |
| 289 |
bmat_len, ftnlen which_len) |
| 290 |
{ |
| 291 |
/* System generated locals */ |
| 292 |
integer v_dim1, v_offset, z_dim1, z_offset, i__1, i__2; |
| 293 |
real r__1, r__2, r__3, r__4; |
| 294 |
doublereal d__1; |
| 295 |
realcomplex q__1, q__2; |
| 296 |
|
| 297 |
/* Builtin functions */ |
| 298 |
double pow_dd(doublereal *, doublereal *); |
| 299 |
integer s_cmp(char *, char *, ftnlen, ftnlen); |
| 300 |
/* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); |
| 301 |
double r_imag(realcomplex *); |
| 302 |
void c_div(realcomplex *, realcomplex *, realcomplex *); |
| 303 |
|
| 304 |
/* Local variables */ |
| 305 |
static integer j, k, ih, jj, iq, np; |
| 306 |
static realcomplex vl[1]; |
| 307 |
static integer wr, ibd, ldh, ldq; |
| 308 |
static real sep; |
| 309 |
static integer irz, mode; |
| 310 |
static real eps23; |
| 311 |
static integer ierr; |
| 312 |
static realcomplex temp; |
| 313 |
static integer iwev; |
| 314 |
static char type__[6]; |
| 315 |
static integer ritz, iheig; |
| 316 |
extern /* Subroutine */ int cscal_(integer *, realcomplex *, realcomplex *, |
| 317 |
integer *); |
| 318 |
static integer ihbds; |
| 319 |
extern /* Complex */ VOID cdotc_(realcomplex *, integer *, realcomplex *, integer |
| 320 |
*, realcomplex *, integer *); |
| 321 |
extern /* Subroutine */ int cgeru_(integer *, integer *, realcomplex *, |
| 322 |
realcomplex *, integer *, realcomplex *, integer *, realcomplex *, integer *); |
| 323 |
static real conds; |
| 324 |
static logical reord; |
| 325 |
extern /* Subroutine */ int ccopy_(integer *, realcomplex *, integer *, |
| 326 |
realcomplex *, integer *), ctrmm_(char *, char *, char *, char *, |
| 327 |
integer *, integer *, realcomplex *, realcomplex *, integer *, realcomplex *, |
| 328 |
integer *, ftnlen, ftnlen, ftnlen, ftnlen); |
| 329 |
static integer nconv; |
| 330 |
static real rtemp; |
| 331 |
extern /* Subroutine */ int cmout_(integer *, integer *, integer *, |
| 332 |
realcomplex *, integer *, integer *, char *, ftnlen); |
| 333 |
static realcomplex rnorm; |
| 334 |
extern /* Subroutine */ int cvout_(integer *, integer *, realcomplex *, |
| 335 |
integer *, char *, ftnlen), ivout_(integer *, integer *, integer * |
| 336 |
, integer *, char *, ftnlen), cgeqr2_(integer *, integer *, |
| 337 |
realcomplex *, integer *, realcomplex *, realcomplex *, integer *); |
| 338 |
extern doublereal scnrm2_(integer *, realcomplex *, integer *); |
| 339 |
extern /* Subroutine */ int cunm2r_(char *, char *, integer *, integer *, |
| 340 |
integer *, realcomplex *, integer *, realcomplex *, realcomplex *, integer *, |
| 341 |
realcomplex *, integer *, ftnlen, ftnlen); |
| 342 |
extern doublereal slapy2_(real *, real *), slamch_(char *, ftnlen); |
| 343 |
extern /* Subroutine */ int clacpy_(char *, integer *, integer *, realcomplex |
| 344 |
*, integer *, realcomplex *, integer *, ftnlen); |
| 345 |
static integer bounds, invsub, iuptri, msglvl, outncv, numcnv, ishift; |
| 346 |
extern /* Subroutine */ int clahqr_(logical *, logical *, integer *, |
| 347 |
integer *, integer *, realcomplex *, integer *, realcomplex *, integer *, |
| 348 |
integer *, realcomplex *, integer *, integer *), cngets_(integer *, |
| 349 |
char *, integer *, integer *, realcomplex *, realcomplex *, ftnlen), |
| 350 |
claset_(char *, integer *, integer *, realcomplex *, realcomplex *, |
| 351 |
realcomplex *, integer *, ftnlen), ctrsen_(char *, char *, logical *, |
| 352 |
integer *, realcomplex *, integer *, realcomplex *, integer *, realcomplex *, |
| 353 |
integer *, real *, real *, realcomplex *, integer *, integer *, |
| 354 |
ftnlen, ftnlen), ctrevc_(char *, char *, logical *, integer *, |
| 355 |
realcomplex *, integer *, realcomplex *, integer *, realcomplex *, integer *, |
| 356 |
integer *, integer *, realcomplex *, real *, integer *, ftnlen, |
| 357 |
ftnlen), csscal_(integer *, real *, realcomplex *, integer *); |
| 358 |
|
| 359 |
|
| 360 |
/* %----------------------------------------------------% */ |
| 361 |
/* | Include files for debugging and timing information | */ |
| 362 |
/* %----------------------------------------------------% */ |
| 363 |
|
| 364 |
|
| 365 |
/* \SCCS Information: @(#) */ |
| 366 |
/* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 367 |
|
| 368 |
/* %---------------------------------% */ |
| 369 |
/* | See debug.doc for documentation | */ |
| 370 |
/* %---------------------------------% */ |
| 371 |
|
| 372 |
/* %------------------% */ |
| 373 |
/* | Scalar Arguments | */ |
| 374 |
/* %------------------% */ |
| 375 |
|
| 376 |
/* %--------------------------------% */ |
| 377 |
/* | See stat.doc for documentation | */ |
| 378 |
/* %--------------------------------% */ |
| 379 |
|
| 380 |
/* \SCCS Information: @(#) */ |
| 381 |
/* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
/* %-----------------% */ |
| 386 |
/* | Array Arguments | */ |
| 387 |
/* %-----------------% */ |
| 388 |
|
| 389 |
|
| 390 |
/* %------------% */ |
| 391 |
/* | Parameters | */ |
| 392 |
/* %------------% */ |
| 393 |
|
| 394 |
|
| 395 |
/* %---------------% */ |
| 396 |
/* | Local Scalars | */ |
| 397 |
/* %---------------% */ |
| 398 |
|
| 399 |
|
| 400 |
/* %----------------------% */ |
| 401 |
/* | External Subroutines | */ |
| 402 |
/* %----------------------% */ |
| 403 |
|
| 404 |
|
| 405 |
/* %--------------------% */ |
| 406 |
/* | External Functions | */ |
| 407 |
/* %--------------------% */ |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
/* %-----------------------% */ |
| 412 |
/* | Executable Statements | */ |
| 413 |
/* %-----------------------% */ |
| 414 |
|
| 415 |
/* %------------------------% */ |
| 416 |
/* | Set default parameters | */ |
| 417 |
/* %------------------------% */ |
| 418 |
|
| 419 |
/* Parameter adjustments */ |
| 420 |
--workd; |
| 421 |
--resid; |
| 422 |
z_dim1 = *ldz; |
| 423 |
z_offset = 1 + z_dim1; |
| 424 |
z__ -= z_offset; |
| 425 |
--d__; |
| 426 |
--rwork; |
| 427 |
--workev; |
| 428 |
--select; |
| 429 |
v_dim1 = *ldv; |
| 430 |
v_offset = 1 + v_dim1; |
| 431 |
v -= v_offset; |
| 432 |
--iparam; |
| 433 |
--ipntr; |
| 434 |
--workl; |
| 435 |
|
| 436 |
/* Function Body */ |
| 437 |
msglvl = debug_1.mceupd; |
| 438 |
mode = iparam[7]; |
| 439 |
nconv = iparam[5]; |
| 440 |
*info = 0; |
| 441 |
|
| 442 |
|
| 443 |
/* %---------------------------------% */ |
| 444 |
/* | Get machine dependent constant. | */ |
| 445 |
/* %---------------------------------% */ |
| 446 |
|
| 447 |
eps23 = slamch_("Epsilon-Machine", (ftnlen)15); |
| 448 |
d__1 = (doublereal) eps23; |
| 449 |
eps23 = pow_dd(&d__1, &c_b5); |
| 450 |
|
| 451 |
/* %-------------------------------% */ |
| 452 |
/* | Quick return | */ |
| 453 |
/* | Check for incompatible input | */ |
| 454 |
/* %-------------------------------% */ |
| 455 |
|
| 456 |
ierr = 0; |
| 457 |
|
| 458 |
if (nconv <= 0) { |
| 459 |
ierr = -14; |
| 460 |
} else if (*n <= 0) { |
| 461 |
ierr = -1; |
| 462 |
} else if (*nev <= 0) { |
| 463 |
ierr = -2; |
| 464 |
} else if (*ncv <= *nev || *ncv > *n) { |
| 465 |
ierr = -3; |
| 466 |
} else if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, |
| 467 |
"SM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, "LR", (ftnlen)2, |
| 468 |
(ftnlen)2) != 0 && s_cmp(which, "SR", (ftnlen)2, (ftnlen)2) != 0 |
| 469 |
&& s_cmp(which, "LI", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, |
| 470 |
"SI", (ftnlen)2, (ftnlen)2) != 0) { |
| 471 |
ierr = -5; |
| 472 |
} else if (*(unsigned char *)bmat != 'I' && *(unsigned char *)bmat != 'G') |
| 473 |
{ |
| 474 |
ierr = -6; |
| 475 |
} else /* if(complicated condition) */ { |
| 476 |
/* Computing 2nd power */ |
| 477 |
i__1 = *ncv; |
| 478 |
if (*lworkl < i__1 * i__1 * 3 + (*ncv << 2)) { |
| 479 |
ierr = -7; |
| 480 |
} else if (*(unsigned char *)howmny != 'A' && *(unsigned char *) |
| 481 |
howmny != 'P' && *(unsigned char *)howmny != 'S' && *rvec) { |
| 482 |
ierr = -13; |
| 483 |
} else if (*(unsigned char *)howmny == 'S') { |
| 484 |
ierr = -12; |
| 485 |
} |
| 486 |
} |
| 487 |
|
| 488 |
if (mode == 1 || mode == 2) { |
| 489 |
s_copy(type__, "REGULR", (ftnlen)6, (ftnlen)6); |
| 490 |
} else if (mode == 3) { |
| 491 |
s_copy(type__, "SHIFTI", (ftnlen)6, (ftnlen)6); |
| 492 |
} else { |
| 493 |
ierr = -10; |
| 494 |
} |
| 495 |
if (mode == 1 && *(unsigned char *)bmat == 'G') { |
| 496 |
ierr = -11; |
| 497 |
} |
| 498 |
|
| 499 |
/* %------------% */ |
| 500 |
/* | Error Exit | */ |
| 501 |
/* %------------% */ |
| 502 |
|
| 503 |
if (ierr != 0) { |
| 504 |
*info = ierr; |
| 505 |
goto L9000; |
| 506 |
} |
| 507 |
|
| 508 |
/* %--------------------------------------------------------% */ |
| 509 |
/* | Pointer into WORKL for address of H, RITZ, WORKEV, Q | */ |
| 510 |
/* | etc... and the remaining workspace. | */ |
| 511 |
/* | Also update pointer to be used on output. | */ |
| 512 |
/* | Memory is laid out as follows: | */ |
| 513 |
/* | workl(1:ncv*ncv) := generated Hessenberg matrix | */ |
| 514 |
/* | workl(ncv*ncv+1:ncv*ncv+ncv) := ritz values | */ |
| 515 |
/* | workl(ncv*ncv+ncv+1:ncv*ncv+2*ncv) := error bounds | */ |
| 516 |
/* %--------------------------------------------------------% */ |
| 517 |
|
| 518 |
/* %-----------------------------------------------------------% */ |
| 519 |
/* | The following is used and set by CNEUPD. | */ |
| 520 |
/* | workl(ncv*ncv+2*ncv+1:ncv*ncv+3*ncv) := The untransformed | */ |
| 521 |
/* | Ritz values. | */ |
| 522 |
/* | workl(ncv*ncv+3*ncv+1:ncv*ncv+4*ncv) := The untransformed | */ |
| 523 |
/* | error bounds of | */ |
| 524 |
/* | the Ritz values | */ |
| 525 |
/* | workl(ncv*ncv+4*ncv+1:2*ncv*ncv+4*ncv) := Holds the upper | */ |
| 526 |
/* | triangular matrix | */ |
| 527 |
/* | for H. | */ |
| 528 |
/* | workl(2*ncv*ncv+4*ncv+1: 3*ncv*ncv+4*ncv) := Holds the | */ |
| 529 |
/* | associated matrix | */ |
| 530 |
/* | representation of | */ |
| 531 |
/* | the invariant | */ |
| 532 |
/* | subspace for H. | */ |
| 533 |
/* | GRAND total of NCV * ( 3 * NCV + 4 ) locations. | */ |
| 534 |
/* %-----------------------------------------------------------% */ |
| 535 |
|
| 536 |
ih = ipntr[5]; |
| 537 |
ritz = ipntr[6]; |
| 538 |
iq = ipntr[7]; |
| 539 |
bounds = ipntr[8]; |
| 540 |
ldh = *ncv; |
| 541 |
ldq = *ncv; |
| 542 |
iheig = bounds + ldh; |
| 543 |
ihbds = iheig + ldh; |
| 544 |
iuptri = ihbds + ldh; |
| 545 |
invsub = iuptri + ldh * *ncv; |
| 546 |
ipntr[9] = iheig; |
| 547 |
ipntr[11] = ihbds; |
| 548 |
ipntr[12] = iuptri; |
| 549 |
ipntr[13] = invsub; |
| 550 |
wr = 1; |
| 551 |
iwev = wr + *ncv; |
| 552 |
|
| 553 |
/* %-----------------------------------------% */ |
| 554 |
/* | irz points to the Ritz values computed | */ |
| 555 |
/* | by _neigh before exiting _naup2. | */ |
| 556 |
/* | ibd points to the Ritz estimates | */ |
| 557 |
/* | computed by _neigh before exiting | */ |
| 558 |
/* | _naup2. | */ |
| 559 |
/* %-----------------------------------------% */ |
| 560 |
|
| 561 |
irz = ipntr[14] + *ncv * *ncv; |
| 562 |
ibd = irz + *ncv; |
| 563 |
|
| 564 |
/* %------------------------------------% */ |
| 565 |
/* | RNORM is B-norm of the RESID(1:N). | */ |
| 566 |
/* %------------------------------------% */ |
| 567 |
|
| 568 |
i__1 = ih + 2; |
| 569 |
rnorm.r = workl[i__1].r, rnorm.i = workl[i__1].i; |
| 570 |
i__1 = ih + 2; |
| 571 |
workl[i__1].r = 0.f, workl[i__1].i = 0.f; |
| 572 |
|
| 573 |
if (msglvl > 2) { |
| 574 |
cvout_(&debug_1.logfil, ncv, &workl[irz], &debug_1.ndigit, "_neupd: " |
| 575 |
"Ritz values passed in from _NAUPD.", (ftnlen)42); |
| 576 |
cvout_(&debug_1.logfil, ncv, &workl[ibd], &debug_1.ndigit, "_neupd: " |
| 577 |
"Ritz estimates passed in from _NAUPD.", (ftnlen)45); |
| 578 |
} |
| 579 |
|
| 580 |
if (*rvec) { |
| 581 |
|
| 582 |
reord = FALSE_; |
| 583 |
|
| 584 |
/* %---------------------------------------------------% */ |
| 585 |
/* | Use the temporary bounds array to store indices | */ |
| 586 |
/* | These will be used to mark the select array later | */ |
| 587 |
/* %---------------------------------------------------% */ |
| 588 |
|
| 589 |
i__1 = *ncv; |
| 590 |
for (j = 1; j <= i__1; ++j) { |
| 591 |
i__2 = bounds + j - 1; |
| 592 |
workl[i__2].r = (real) j, workl[i__2].i = 0.f; |
| 593 |
select[j] = FALSE_; |
| 594 |
/* L10: */ |
| 595 |
} |
| 596 |
|
| 597 |
/* %-------------------------------------% */ |
| 598 |
/* | Select the wanted Ritz values. | */ |
| 599 |
/* | Sort the Ritz values so that the | */ |
| 600 |
/* | wanted ones appear at the tailing | */ |
| 601 |
/* | NEV positions of workl(irr) and | */ |
| 602 |
/* | workl(iri). Move the corresponding | */ |
| 603 |
/* | error estimates in workl(ibd) | */ |
| 604 |
/* | accordingly. | */ |
| 605 |
/* %-------------------------------------% */ |
| 606 |
|
| 607 |
np = *ncv - *nev; |
| 608 |
ishift = 0; |
| 609 |
cngets_(&ishift, which, nev, &np, &workl[irz], &workl[bounds], ( |
| 610 |
ftnlen)2); |
| 611 |
|
| 612 |
if (msglvl > 2) { |
| 613 |
cvout_(&debug_1.logfil, ncv, &workl[irz], &debug_1.ndigit, "_neu" |
| 614 |
"pd: Ritz values after calling _NGETS.", (ftnlen)41); |
| 615 |
cvout_(&debug_1.logfil, ncv, &workl[bounds], &debug_1.ndigit, |
| 616 |
"_neupd: Ritz value indices after calling _NGETS.", ( |
| 617 |
ftnlen)48); |
| 618 |
} |
| 619 |
|
| 620 |
/* %-----------------------------------------------------% */ |
| 621 |
/* | Record indices of the converged wanted Ritz values | */ |
| 622 |
/* | Mark the select array for possible reordering | */ |
| 623 |
/* %-----------------------------------------------------% */ |
| 624 |
|
| 625 |
numcnv = 0; |
| 626 |
i__1 = *ncv; |
| 627 |
for (j = 1; j <= i__1; ++j) { |
| 628 |
/* Computing MAX */ |
| 629 |
i__2 = irz + *ncv - j; |
| 630 |
r__3 = workl[i__2].r; |
| 631 |
r__4 = r_imag(&workl[irz + *ncv - j]); |
| 632 |
r__1 = eps23, r__2 = slapy2_(&r__3, &r__4); |
| 633 |
rtemp = dmax(r__1,r__2); |
| 634 |
i__2 = bounds + *ncv - j; |
| 635 |
jj = workl[i__2].r; |
| 636 |
i__2 = ibd + jj - 1; |
| 637 |
r__1 = workl[i__2].r; |
| 638 |
r__2 = r_imag(&workl[ibd + jj - 1]); |
| 639 |
if (numcnv < nconv && slapy2_(&r__1, &r__2) <= *tol * rtemp) { |
| 640 |
select[jj] = TRUE_; |
| 641 |
++numcnv; |
| 642 |
if (jj > *nev) { |
| 643 |
reord = TRUE_; |
| 644 |
} |
| 645 |
} |
| 646 |
/* L11: */ |
| 647 |
} |
| 648 |
|
| 649 |
/* %-----------------------------------------------------------% */ |
| 650 |
/* | Check the count (numcnv) of converged Ritz values with | */ |
| 651 |
/* | the number (nconv) reported by dnaupd. If these two | */ |
| 652 |
/* | are different then there has probably been an error | */ |
| 653 |
/* | caused by incorrect passing of the dnaupd data. | */ |
| 654 |
/* %-----------------------------------------------------------% */ |
| 655 |
|
| 656 |
if (msglvl > 2) { |
| 657 |
ivout_(&debug_1.logfil, &c__1, &numcnv, &debug_1.ndigit, "_neupd" |
| 658 |
": Number of specified eigenvalues", (ftnlen)39); |
| 659 |
ivout_(&debug_1.logfil, &c__1, &nconv, &debug_1.ndigit, "_neupd:" |
| 660 |
" Number of \"converged\" eigenvalues", (ftnlen)41); |
| 661 |
} |
| 662 |
|
| 663 |
if (numcnv != nconv) { |
| 664 |
*info = -15; |
| 665 |
goto L9000; |
| 666 |
} |
| 667 |
|
| 668 |
/* %-------------------------------------------------------% */ |
| 669 |
/* | Call LAPACK routine clahqr to compute the Schur form | */ |
| 670 |
/* | of the upper Hessenberg matrix returned by CNAUPD. | */ |
| 671 |
/* | Make a copy of the upper Hessenberg matrix. | */ |
| 672 |
/* | Initialize the Schur vector matrix Q to the identity. | */ |
| 673 |
/* %-------------------------------------------------------% */ |
| 674 |
|
| 675 |
i__1 = ldh * *ncv; |
| 676 |
ccopy_(&i__1, &workl[ih], &c__1, &workl[iuptri], &c__1); |
| 677 |
claset_("All", ncv, ncv, &c_b2, &c_b1, &workl[invsub], &ldq, (ftnlen) |
| 678 |
3); |
| 679 |
clahqr_(&c_true, &c_true, ncv, &c__1, ncv, &workl[iuptri], &ldh, & |
| 680 |
workl[iheig], &c__1, ncv, &workl[invsub], &ldq, &ierr); |
| 681 |
ccopy_(ncv, &workl[invsub + *ncv - 1], &ldq, &workl[ihbds], &c__1); |
| 682 |
|
| 683 |
if (ierr != 0) { |
| 684 |
*info = -8; |
| 685 |
goto L9000; |
| 686 |
} |
| 687 |
|
| 688 |
if (msglvl > 1) { |
| 689 |
cvout_(&debug_1.logfil, ncv, &workl[iheig], &debug_1.ndigit, |
| 690 |
"_neupd: Eigenvalues of H", (ftnlen)24); |
| 691 |
cvout_(&debug_1.logfil, ncv, &workl[ihbds], &debug_1.ndigit, |
| 692 |
"_neupd: Last row of the Schur vector matrix", (ftnlen)43) |
| 693 |
; |
| 694 |
if (msglvl > 3) { |
| 695 |
cmout_(&debug_1.logfil, ncv, ncv, &workl[iuptri], &ldh, & |
| 696 |
debug_1.ndigit, "_neupd: The upper triangular matrix " |
| 697 |
, (ftnlen)36); |
| 698 |
} |
| 699 |
} |
| 700 |
|
| 701 |
if (reord) { |
| 702 |
|
| 703 |
/* %-----------------------------------------------% */ |
| 704 |
/* | Reorder the computed upper triangular matrix. | */ |
| 705 |
/* %-----------------------------------------------% */ |
| 706 |
|
| 707 |
ctrsen_("None", "V", &select[1], ncv, &workl[iuptri], &ldh, & |
| 708 |
workl[invsub], &ldq, &workl[iheig], &nconv, &conds, &sep, |
| 709 |
&workev[1], ncv, &ierr, (ftnlen)4, (ftnlen)1); |
| 710 |
|
| 711 |
if (ierr == 1) { |
| 712 |
*info = 1; |
| 713 |
goto L9000; |
| 714 |
} |
| 715 |
|
| 716 |
if (msglvl > 2) { |
| 717 |
cvout_(&debug_1.logfil, ncv, &workl[iheig], &debug_1.ndigit, |
| 718 |
"_neupd: Eigenvalues of H--reordered", (ftnlen)35); |
| 719 |
if (msglvl > 3) { |
| 720 |
cmout_(&debug_1.logfil, ncv, ncv, &workl[iuptri], &ldq, & |
| 721 |
debug_1.ndigit, "_neupd: Triangular matrix after" |
| 722 |
" re-ordering", (ftnlen)43); |
| 723 |
} |
| 724 |
} |
| 725 |
|
| 726 |
} |
| 727 |
|
| 728 |
/* %---------------------------------------------% */ |
| 729 |
/* | Copy the last row of the Schur basis matrix | */ |
| 730 |
/* | to workl(ihbds). This vector will be used | */ |
| 731 |
/* | to compute the Ritz estimates of converged | */ |
| 732 |
/* | Ritz values. | */ |
| 733 |
/* %---------------------------------------------% */ |
| 734 |
|
| 735 |
ccopy_(ncv, &workl[invsub + *ncv - 1], &ldq, &workl[ihbds], &c__1); |
| 736 |
|
| 737 |
/* %--------------------------------------------% */ |
| 738 |
/* | Place the computed eigenvalues of H into D | */ |
| 739 |
/* | if a spectral transformation was not used. | */ |
| 740 |
/* %--------------------------------------------% */ |
| 741 |
|
| 742 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0) { |
| 743 |
ccopy_(&nconv, &workl[iheig], &c__1, &d__[1], &c__1); |
| 744 |
} |
| 745 |
|
| 746 |
/* %----------------------------------------------------------% */ |
| 747 |
/* | Compute the QR factorization of the matrix representing | */ |
| 748 |
/* | the wanted invariant subspace located in the first NCONV | */ |
| 749 |
/* | columns of workl(invsub,ldq). | */ |
| 750 |
/* %----------------------------------------------------------% */ |
| 751 |
|
| 752 |
cgeqr2_(ncv, &nconv, &workl[invsub], &ldq, &workev[1], &workev[*ncv + |
| 753 |
1], &ierr); |
| 754 |
|
| 755 |
/* %--------------------------------------------------------% */ |
| 756 |
/* | * Postmultiply V by Q using cunm2r. | */ |
| 757 |
/* | * Copy the first NCONV columns of VQ into Z. | */ |
| 758 |
/* | * Postmultiply Z by R. | */ |
| 759 |
/* | The N by NCONV matrix Z is now a matrix representation | */ |
| 760 |
/* | of the approximate invariant subspace associated with | */ |
| 761 |
/* | the Ritz values in workl(iheig). The first NCONV | */ |
| 762 |
/* | columns of V are now approximate Schur vectors | */ |
| 763 |
/* | associated with the upper triangular matrix of order | */ |
| 764 |
/* | NCONV in workl(iuptri). | */ |
| 765 |
/* %--------------------------------------------------------% */ |
| 766 |
|
| 767 |
cunm2r_("Right", "Notranspose", n, ncv, &nconv, &workl[invsub], &ldq, |
| 768 |
&workev[1], &v[v_offset], ldv, &workd[*n + 1], &ierr, (ftnlen) |
| 769 |
5, (ftnlen)11); |
| 770 |
clacpy_("All", n, &nconv, &v[v_offset], ldv, &z__[z_offset], ldz, ( |
| 771 |
ftnlen)3); |
| 772 |
|
| 773 |
i__1 = nconv; |
| 774 |
for (j = 1; j <= i__1; ++j) { |
| 775 |
|
| 776 |
/* %---------------------------------------------------% */ |
| 777 |
/* | Perform both a column and row scaling if the | */ |
| 778 |
/* | diagonal element of workl(invsub,ldq) is negative | */ |
| 779 |
/* | I'm lazy and don't take advantage of the upper | */ |
| 780 |
/* | triangular form of workl(iuptri,ldq). | */ |
| 781 |
/* | Note that since Q is orthogonal, R is a diagonal | */ |
| 782 |
/* | matrix consisting of plus or minus ones. | */ |
| 783 |
/* %---------------------------------------------------% */ |
| 784 |
|
| 785 |
i__2 = invsub + (j - 1) * ldq + j - 1; |
| 786 |
if (workl[i__2].r < 0.f) { |
| 787 |
q__1.r = -1.f, q__1.i = -0.f; |
| 788 |
cscal_(&nconv, &q__1, &workl[iuptri + j - 1], &ldq); |
| 789 |
q__1.r = -1.f, q__1.i = -0.f; |
| 790 |
cscal_(&nconv, &q__1, &workl[iuptri + (j - 1) * ldq], &c__1); |
| 791 |
} |
| 792 |
|
| 793 |
/* L20: */ |
| 794 |
} |
| 795 |
|
| 796 |
if (*(unsigned char *)howmny == 'A') { |
| 797 |
|
| 798 |
/* %--------------------------------------------% */ |
| 799 |
/* | Compute the NCONV wanted eigenvectors of T | */ |
| 800 |
/* | located in workl(iuptri,ldq). | */ |
| 801 |
/* %--------------------------------------------% */ |
| 802 |
|
| 803 |
i__1 = *ncv; |
| 804 |
for (j = 1; j <= i__1; ++j) { |
| 805 |
if (j <= nconv) { |
| 806 |
select[j] = TRUE_; |
| 807 |
} else { |
| 808 |
select[j] = FALSE_; |
| 809 |
} |
| 810 |
/* L30: */ |
| 811 |
} |
| 812 |
|
| 813 |
ctrevc_("Right", "Select", &select[1], ncv, &workl[iuptri], &ldq, |
| 814 |
vl, &c__1, &workl[invsub], &ldq, ncv, &outncv, &workev[1], |
| 815 |
&rwork[1], &ierr, (ftnlen)5, (ftnlen)6); |
| 816 |
|
| 817 |
if (ierr != 0) { |
| 818 |
*info = -9; |
| 819 |
goto L9000; |
| 820 |
} |
| 821 |
|
| 822 |
/* %------------------------------------------------% */ |
| 823 |
/* | Scale the returning eigenvectors so that their | */ |
| 824 |
/* | Euclidean norms are all one. LAPACK subroutine | */ |
| 825 |
/* | ctrevc returns each eigenvector normalized so | */ |
| 826 |
/* | that the element of largest magnitude has | */ |
| 827 |
/* | magnitude 1. | */ |
| 828 |
/* %------------------------------------------------% */ |
| 829 |
|
| 830 |
i__1 = nconv; |
| 831 |
for (j = 1; j <= i__1; ++j) { |
| 832 |
rtemp = scnrm2_(ncv, &workl[invsub + (j - 1) * ldq], &c__1); |
| 833 |
rtemp = 1.f / rtemp; |
| 834 |
csscal_(ncv, &rtemp, &workl[invsub + (j - 1) * ldq], &c__1); |
| 835 |
|
| 836 |
/* %------------------------------------------% */ |
| 837 |
/* | Ritz estimates can be obtained by taking | */ |
| 838 |
/* | the inner product of the last row of the | */ |
| 839 |
/* | Schur basis of H with eigenvectors of T. | */ |
| 840 |
/* | Note that the eigenvector matrix of T is | */ |
| 841 |
/* | upper triangular, thus the length of the | */ |
| 842 |
/* | inner product can be set to j. | */ |
| 843 |
/* %------------------------------------------% */ |
| 844 |
|
| 845 |
i__2 = j; |
| 846 |
cdotc_(&q__1, &j, &workl[ihbds], &c__1, &workl[invsub + (j - |
| 847 |
1) * ldq], &c__1); |
| 848 |
workev[i__2].r = q__1.r, workev[i__2].i = q__1.i; |
| 849 |
/* L40: */ |
| 850 |
} |
| 851 |
|
| 852 |
if (msglvl > 2) { |
| 853 |
ccopy_(&nconv, &workl[invsub + *ncv - 1], &ldq, &workl[ihbds], |
| 854 |
&c__1); |
| 855 |
cvout_(&debug_1.logfil, &nconv, &workl[ihbds], & |
| 856 |
debug_1.ndigit, "_neupd: Last row of the eigenvector" |
| 857 |
" matrix for T", (ftnlen)48); |
| 858 |
if (msglvl > 3) { |
| 859 |
cmout_(&debug_1.logfil, ncv, ncv, &workl[invsub], &ldq, & |
| 860 |
debug_1.ndigit, "_neupd: The eigenvector matrix " |
| 861 |
"for T", (ftnlen)36); |
| 862 |
} |
| 863 |
} |
| 864 |
|
| 865 |
/* %---------------------------------------% */ |
| 866 |
/* | Copy Ritz estimates into workl(ihbds) | */ |
| 867 |
/* %---------------------------------------% */ |
| 868 |
|
| 869 |
ccopy_(&nconv, &workev[1], &c__1, &workl[ihbds], &c__1); |
| 870 |
|
| 871 |
/* %----------------------------------------------% */ |
| 872 |
/* | The eigenvector matrix Q of T is triangular. | */ |
| 873 |
/* | Form Z*Q. | */ |
| 874 |
/* %----------------------------------------------% */ |
| 875 |
|
| 876 |
ctrmm_("Right", "Upper", "No transpose", "Non-unit", n, &nconv, & |
| 877 |
c_b1, &workl[invsub], &ldq, &z__[z_offset], ldz, (ftnlen) |
| 878 |
5, (ftnlen)5, (ftnlen)12, (ftnlen)8); |
| 879 |
} |
| 880 |
|
| 881 |
} else { |
| 882 |
|
| 883 |
/* %--------------------------------------------------% */ |
| 884 |
/* | An approximate invariant subspace is not needed. | */ |
| 885 |
/* | Place the Ritz values computed CNAUPD into D. | */ |
| 886 |
/* %--------------------------------------------------% */ |
| 887 |
|
| 888 |
ccopy_(&nconv, &workl[ritz], &c__1, &d__[1], &c__1); |
| 889 |
ccopy_(&nconv, &workl[ritz], &c__1, &workl[iheig], &c__1); |
| 890 |
ccopy_(&nconv, &workl[bounds], &c__1, &workl[ihbds], &c__1); |
| 891 |
|
| 892 |
} |
| 893 |
|
| 894 |
/* %------------------------------------------------% */ |
| 895 |
/* | Transform the Ritz values and possibly vectors | */ |
| 896 |
/* | and corresponding error bounds of OP to those | */ |
| 897 |
/* | of A*x = lambda*B*x. | */ |
| 898 |
/* %------------------------------------------------% */ |
| 899 |
|
| 900 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0) { |
| 901 |
|
| 902 |
if (*rvec) { |
| 903 |
cscal_(ncv, &rnorm, &workl[ihbds], &c__1); |
| 904 |
} |
| 905 |
|
| 906 |
} else { |
| 907 |
|
| 908 |
/* %---------------------------------------% */ |
| 909 |
/* | A spectral transformation was used. | */ |
| 910 |
/* | * Determine the Ritz estimates of the | */ |
| 911 |
/* | Ritz values in the original system. | */ |
| 912 |
/* %---------------------------------------% */ |
| 913 |
|
| 914 |
if (*rvec) { |
| 915 |
cscal_(ncv, &rnorm, &workl[ihbds], &c__1); |
| 916 |
} |
| 917 |
|
| 918 |
i__1 = *ncv; |
| 919 |
for (k = 1; k <= i__1; ++k) { |
| 920 |
i__2 = iheig + k - 1; |
| 921 |
temp.r = workl[i__2].r, temp.i = workl[i__2].i; |
| 922 |
i__2 = ihbds + k - 1; |
| 923 |
c_div(&q__2, &workl[ihbds + k - 1], &temp); |
| 924 |
c_div(&q__1, &q__2, &temp); |
| 925 |
workl[i__2].r = q__1.r, workl[i__2].i = q__1.i; |
| 926 |
/* L50: */ |
| 927 |
} |
| 928 |
|
| 929 |
} |
| 930 |
|
| 931 |
/* %-----------------------------------------------------------% */ |
| 932 |
/* | * Transform the Ritz values back to the original system. | */ |
| 933 |
/* | For TYPE = 'SHIFTI' the transformation is | */ |
| 934 |
/* | lambda = 1/theta + sigma | */ |
| 935 |
/* | NOTES: | */ |
| 936 |
/* | *The Ritz vectors are not affected by the transformation. | */ |
| 937 |
/* %-----------------------------------------------------------% */ |
| 938 |
|
| 939 |
if (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0) { |
| 940 |
i__1 = nconv; |
| 941 |
for (k = 1; k <= i__1; ++k) { |
| 942 |
i__2 = k; |
| 943 |
c_div(&q__2, &c_b1, &workl[iheig + k - 1]); |
| 944 |
q__1.r = q__2.r + sigma->r, q__1.i = q__2.i + sigma->i; |
| 945 |
d__[i__2].r = q__1.r, d__[i__2].i = q__1.i; |
| 946 |
/* L60: */ |
| 947 |
} |
| 948 |
} |
| 949 |
|
| 950 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) != 0 && msglvl > 1) { |
| 951 |
cvout_(&debug_1.logfil, &nconv, &d__[1], &debug_1.ndigit, "_neupd: U" |
| 952 |
"ntransformed Ritz values.", (ftnlen)34); |
| 953 |
cvout_(&debug_1.logfil, &nconv, &workl[ihbds], &debug_1.ndigit, "_ne" |
| 954 |
"upd: Ritz estimates of the untransformed Ritz values.", ( |
| 955 |
ftnlen)56); |
| 956 |
} else if (msglvl > 1) { |
| 957 |
cvout_(&debug_1.logfil, &nconv, &d__[1], &debug_1.ndigit, "_neupd: C" |
| 958 |
"onverged Ritz values.", (ftnlen)30); |
| 959 |
cvout_(&debug_1.logfil, &nconv, &workl[ihbds], &debug_1.ndigit, "_ne" |
| 960 |
"upd: Associated Ritz estimates.", (ftnlen)34); |
| 961 |
} |
| 962 |
|
| 963 |
/* %-------------------------------------------------% */ |
| 964 |
/* | Eigenvector Purification step. Formally perform | */ |
| 965 |
/* | one of inverse subspace iteration. Only used | */ |
| 966 |
/* | for MODE = 3. See reference 3. | */ |
| 967 |
/* %-------------------------------------------------% */ |
| 968 |
|
| 969 |
if (*rvec && *(unsigned char *)howmny == 'A' && s_cmp(type__, "SHIFTI", ( |
| 970 |
ftnlen)6, (ftnlen)6) == 0) { |
| 971 |
|
| 972 |
/* %------------------------------------------------% */ |
| 973 |
/* | Purify the computed Ritz vectors by adding a | */ |
| 974 |
/* | little bit of the residual vector: | */ |
| 975 |
/* | T | */ |
| 976 |
/* | resid(:)*( e s ) / theta | */ |
| 977 |
/* | NCV | */ |
| 978 |
/* | where H s = s theta. | */ |
| 979 |
/* %------------------------------------------------% */ |
| 980 |
|
| 981 |
i__1 = nconv; |
| 982 |
for (j = 1; j <= i__1; ++j) { |
| 983 |
i__2 = iheig + j - 1; |
| 984 |
if (workl[i__2].r != 0.f || workl[i__2].i != 0.f) { |
| 985 |
i__2 = j; |
| 986 |
c_div(&q__1, &workl[invsub + (j - 1) * ldq + *ncv - 1], & |
| 987 |
workl[iheig + j - 1]); |
| 988 |
workev[i__2].r = q__1.r, workev[i__2].i = q__1.i; |
| 989 |
} |
| 990 |
/* L100: */ |
| 991 |
} |
| 992 |
/* %---------------------------------------% */ |
| 993 |
/* | Perform a rank one update to Z and | */ |
| 994 |
/* | purify all the Ritz vectors together. | */ |
| 995 |
/* %---------------------------------------% */ |
| 996 |
|
| 997 |
cgeru_(n, &nconv, &c_b1, &resid[1], &c__1, &workev[1], &c__1, &z__[ |
| 998 |
z_offset], ldz); |
| 999 |
|
| 1000 |
} |
| 1001 |
|
| 1002 |
L9000: |
| 1003 |
|
| 1004 |
return 0; |
| 1005 |
|
| 1006 |
/* %---------------% */ |
| 1007 |
/* | End of cneupd| */ |
| 1008 |
/* %---------------% */ |
| 1009 |
|
| 1010 |
} /* cneupd_ */ |
| 1011 |
|