| 1 |
/* ./src_f77/dseupd.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_DSEUPD; |
| 15 |
|
| 16 |
#define debug_1 debug_DSEUPD |
| 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_DSEUPD; |
| 25 |
|
| 26 |
#define timing_1 timing_DSEUPD |
| 27 |
|
| 28 |
/* Table of constant values */ |
| 29 |
|
| 30 |
static doublereal c_b21 = .66666666666666663; |
| 31 |
static integer c__1 = 1; |
| 32 |
static logical c_true = TRUE_; |
| 33 |
static doublereal c_b110 = 1.; |
| 34 |
|
| 35 |
/* \BeginDoc */ |
| 36 |
|
| 37 |
/* \Name: dseupd */ |
| 38 |
|
| 39 |
/* \Description: */ |
| 40 |
|
| 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 (Lanczos) 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 |
/* (Lanczos) basis is always computed. There is an additional storage cost */ |
| 53 |
/* of n*nev if both are requested (in this case a separate array Z must be */ |
| 54 |
/* supplied). */ |
| 55 |
|
| 56 |
/* These quantities are obtained from the Lanczos factorization computed */ |
| 57 |
/* by DSAUPD for the linear operator OP prescribed by the MODE selection */ |
| 58 |
/* (see IPARAM(7) in DSAUPD documentation.) DSAUPD must be called before */ |
| 59 |
/* this routine is called. These approximate eigenvalues and vectors are */ |
| 60 |
/* commonly called Ritz values and Ritz vectors respectively. They are */ |
| 61 |
/* referred to as such in the comments that follow. The computed orthonormal */ |
| 62 |
/* basis for the invariant subspace corresponding to these Ritz values is */ |
| 63 |
/* referred to as a Lanczos basis. */ |
| 64 |
|
| 65 |
/* See documentation in the header of the subroutine DSAUPD for a definition */ |
| 66 |
/* of OP as well as other terms and the relation of computed Ritz values */ |
| 67 |
/* and vectors of OP with respect to the given problem A*z = lambda*B*z. */ |
| 68 |
|
| 69 |
/* The approximate eigenvalues of the original problem are returned in */ |
| 70 |
/* ascending algebraic order. The user may elect to call this routine */ |
| 71 |
/* once for each desired Ritz vector and store it peripherally if desired. */ |
| 72 |
/* There is also the option of computing a selected set of these vectors */ |
| 73 |
/* with a single call. */ |
| 74 |
|
| 75 |
/* \Usage: */ |
| 76 |
/* call dseupd */ |
| 77 |
/* ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, BMAT, N, WHICH, NEV, TOL, */ |
| 78 |
/* RESID, NCV, V, LDV, IPARAM, IPNTR, WORKD, WORKL, LWORKL, INFO ) */ |
| 79 |
|
| 80 |
/* RVEC LOGICAL (INPUT) */ |
| 81 |
/* Specifies whether Ritz vectors corresponding to the Ritz value */ |
| 82 |
/* approximations to the eigenproblem A*z = lambda*B*z are computed. */ |
| 83 |
|
| 84 |
/* RVEC = .FALSE. Compute Ritz values only. */ |
| 85 |
|
| 86 |
/* RVEC = .TRUE. Compute Ritz vectors. */ |
| 87 |
|
| 88 |
/* HOWMNY Character*1 (INPUT) */ |
| 89 |
/* Specifies how many Ritz vectors are wanted and the form of Z */ |
| 90 |
/* the matrix of Ritz vectors. See remark 1 below. */ |
| 91 |
/* = 'A': compute NEV Ritz vectors; */ |
| 92 |
/* = 'S': compute some of the Ritz vectors, specified */ |
| 93 |
/* by the logical array SELECT. */ |
| 94 |
|
| 95 |
/* SELECT Logical array of dimension NCV. (INPUT/WORKSPACE) */ |
| 96 |
/* If HOWMNY = 'S', SELECT specifies the Ritz vectors to be */ |
| 97 |
/* computed. To select the Ritz vector corresponding to a */ |
| 98 |
/* Ritz value D(j), SELECT(j) must be set to .TRUE.. */ |
| 99 |
/* If HOWMNY = 'A' , SELECT is used as a workspace for */ |
| 100 |
/* reordering the Ritz values. */ |
| 101 |
|
| 102 |
/* D Double precision array of dimension NEV. (OUTPUT) */ |
| 103 |
/* On exit, D contains the Ritz value approximations to the */ |
| 104 |
/* eigenvalues of A*z = lambda*B*z. The values are returned */ |
| 105 |
/* in ascending order. If IPARAM(7) = 3,4,5 then D represents */ |
| 106 |
/* the Ritz values of OP computed by dsaupd transformed to */ |
| 107 |
/* those of the original eigensystem A*z = lambda*B*z. If */ |
| 108 |
/* IPARAM(7) = 1,2 then the Ritz values of OP are the same */ |
| 109 |
/* as the those of A*z = lambda*B*z. */ |
| 110 |
|
| 111 |
/* Z Double precision N by NEV array if HOWMNY = 'A'. (OUTPUT) */ |
| 112 |
/* On exit, Z contains the B-orthonormal Ritz vectors of the */ |
| 113 |
/* eigensystem A*z = lambda*B*z corresponding to the Ritz */ |
| 114 |
/* value approximations. */ |
| 115 |
/* If RVEC = .FALSE. then Z is not referenced. */ |
| 116 |
/* NOTE: The array Z may be set equal to first NEV columns of the */ |
| 117 |
/* Arnoldi/Lanczos basis array V computed by DSAUPD . */ |
| 118 |
|
| 119 |
/* LDZ Integer. (INPUT) */ |
| 120 |
/* The leading dimension of the array Z. If Ritz vectors are */ |
| 121 |
/* desired, then LDZ .ge. max( 1, N ). In any case, LDZ .ge. 1. */ |
| 122 |
|
| 123 |
/* SIGMA Double precision (INPUT) */ |
| 124 |
/* If IPARAM(7) = 3,4,5 represents the shift. Not referenced if */ |
| 125 |
/* IPARAM(7) = 1 or 2. */ |
| 126 |
|
| 127 |
|
| 128 |
/* **** The remaining arguments MUST be the same as for the **** */ |
| 129 |
/* **** call to DSAUPD that was just completed. **** */ |
| 130 |
|
| 131 |
/* NOTE: The remaining arguments */ |
| 132 |
|
| 133 |
/* BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM, IPNTR, */ |
| 134 |
/* WORKD, WORKL, LWORKL, INFO */ |
| 135 |
|
| 136 |
/* must be passed directly to DSEUPD following the last call */ |
| 137 |
/* to DSAUPD . These arguments MUST NOT BE MODIFIED between */ |
| 138 |
/* the the last call to DSAUPD and the call to DSEUPD . */ |
| 139 |
|
| 140 |
/* Two of these parameters (WORKL, INFO) are also output parameters: */ |
| 141 |
|
| 142 |
/* WORKL Double precision work array of length LWORKL. (OUTPUT/WORKSPACE) */ |
| 143 |
/* WORKL(1:4*ncv) contains information obtained in */ |
| 144 |
/* dsaupd . They are not changed by dseupd . */ |
| 145 |
/* WORKL(4*ncv+1:ncv*ncv+8*ncv) holds the */ |
| 146 |
/* untransformed Ritz values, the computed error estimates, */ |
| 147 |
/* and the associated eigenvector matrix of H. */ |
| 148 |
|
| 149 |
/* Note: IPNTR(8:10) contains the pointer into WORKL for addresses */ |
| 150 |
/* of the above information computed by dseupd . */ |
| 151 |
/* ------------------------------------------------------------- */ |
| 152 |
/* IPNTR(8): pointer to the NCV RITZ values of the original system. */ |
| 153 |
/* IPNTR(9): pointer to the NCV corresponding error bounds. */ |
| 154 |
/* IPNTR(10): pointer to the NCV by NCV matrix of eigenvectors */ |
| 155 |
/* of the tridiagonal matrix T. Only referenced by */ |
| 156 |
/* dseupd if RVEC = .TRUE. See Remarks. */ |
| 157 |
/* ------------------------------------------------------------- */ |
| 158 |
|
| 159 |
/* INFO Integer. (OUTPUT) */ |
| 160 |
/* Error flag on output. */ |
| 161 |
/* = 0: Normal exit. */ |
| 162 |
/* = -1: N must be positive. */ |
| 163 |
/* = -2: NEV must be positive. */ |
| 164 |
/* = -3: NCV must be greater than NEV and less than or equal to N. */ |
| 165 |
/* = -5: WHICH must be one of 'LM', 'SM', 'LA', 'SA' or 'BE'. */ |
| 166 |
/* = -6: BMAT must be one of 'I' or 'G'. */ |
| 167 |
/* = -7: Length of private work WORKL array is not sufficient. */ |
| 168 |
/* = -8: Error return from trid. eigenvalue calculation; */ |
| 169 |
/* Information error from LAPACK routine dsteqr . */ |
| 170 |
/* = -9: Starting vector is zero. */ |
| 171 |
/* = -10: IPARAM(7) must be 1,2,3,4,5. */ |
| 172 |
/* = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatible. */ |
| 173 |
/* = -12: NEV and WHICH = 'BE' are incompatible. */ |
| 174 |
/* = -14: DSAUPD did not find any eigenvalues to sufficient */ |
| 175 |
/* accuracy. */ |
| 176 |
/* = -15: HOWMNY must be one of 'A' or 'S' if RVEC = .true. */ |
| 177 |
/* = -16: HOWMNY = 'S' not yet implemented */ |
| 178 |
/* = -17: DSEUPD got a different count of the number of converged */ |
| 179 |
/* Ritz values than DSAUPD got. This indicates the user */ |
| 180 |
/* probably made an error in passing data from DSAUPD to */ |
| 181 |
/* DSEUPD or that the data was modified before entering */ |
| 182 |
/* DSEUPD . */ |
| 183 |
|
| 184 |
/* \BeginLib */ |
| 185 |
|
| 186 |
/* \References: */ |
| 187 |
/* 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in */ |
| 188 |
/* a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992), */ |
| 189 |
/* pp 357-385. */ |
| 190 |
/* 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly */ |
| 191 |
/* Restarted Arnoldi Iteration", Rice University Technical Report */ |
| 192 |
/* TR95-13, Department of Computational and Applied Mathematics. */ |
| 193 |
/* 3. B.N. Parlett, "The Symmetric Eigenvalue Problem". Prentice-Hall, */ |
| 194 |
/* 1980. */ |
| 195 |
/* 4. B.N. Parlett, B. Nour-Omid, "Towards a Black Box Lanczos Program", */ |
| 196 |
/* Computer Physics Communications, 53 (1989), pp 169-179. */ |
| 197 |
/* 5. B. Nour-Omid, B.N. Parlett, T. Ericson, P.S. Jensen, "How to */ |
| 198 |
/* Implement the Spectral Transformation", Math. Comp., 48 (1987), */ |
| 199 |
/* pp 663-673. */ |
| 200 |
/* 6. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos */ |
| 201 |
/* Algorithm for Solving Sparse Symmetric Generalized Eigenproblems", */ |
| 202 |
/* SIAM J. Matr. Anal. Apps., January (1993). */ |
| 203 |
/* 7. L. Reichel, W.B. Gragg, "Algorithm 686: FORTRAN Subroutines */ |
| 204 |
/* for Updating the QR decomposition", ACM TOMS, December 1990, */ |
| 205 |
/* Volume 16 Number 4, pp 369-377. */ |
| 206 |
|
| 207 |
/* \Remarks */ |
| 208 |
/* 1. The converged Ritz values are always returned in increasing */ |
| 209 |
/* (algebraic) order. */ |
| 210 |
|
| 211 |
/* 2. Currently only HOWMNY = 'A' is implemented. It is included at this */ |
| 212 |
/* stage for the user who wants to incorporate it. */ |
| 213 |
|
| 214 |
/* \Routines called: */ |
| 215 |
/* dsesrt ARPACK routine that sorts an array X, and applies the */ |
| 216 |
/* corresponding permutation to a matrix A. */ |
| 217 |
/* dsortr dsortr ARPACK sorting routine. */ |
| 218 |
/* ivout ARPACK utility routine that prints integers. */ |
| 219 |
/* dvout ARPACK utility routine that prints vectors. */ |
| 220 |
/* dgeqr2 LAPACK routine that computes the QR factorization of */ |
| 221 |
/* a matrix. */ |
| 222 |
/* dlacpy LAPACK matrix copy routine. */ |
| 223 |
/* dlamch LAPACK routine that determines machine constants. */ |
| 224 |
/* dorm2r LAPACK routine that applies an orthogonal matrix in */ |
| 225 |
/* factored form. */ |
| 226 |
/* dsteqr LAPACK routine that computes eigenvalues and eigenvectors */ |
| 227 |
/* of a tridiagonal matrix. */ |
| 228 |
/* dger Level 2 BLAS rank one update to a matrix. */ |
| 229 |
/* dcopy Level 1 BLAS that copies one vector to another . */ |
| 230 |
/* dnrm2 Level 1 BLAS that computes the norm of a vector. */ |
| 231 |
/* dscal Level 1 BLAS that scales a vector. */ |
| 232 |
/* dswap Level 1 BLAS that swaps the contents of two vectors. */ |
| 233 |
/* \Authors */ |
| 234 |
/* Danny Sorensen Phuong Vu */ |
| 235 |
/* Richard Lehoucq CRPC / Rice University */ |
| 236 |
/* Chao Yang Houston, Texas */ |
| 237 |
/* Dept. of Computational & */ |
| 238 |
/* Applied Mathematics */ |
| 239 |
/* Rice University */ |
| 240 |
/* Houston, Texas */ |
| 241 |
|
| 242 |
/* \Revision history: */ |
| 243 |
/* 12/15/93: Version ' 2.1' */ |
| 244 |
|
| 245 |
/* \SCCS Information: @(#) */ |
| 246 |
/* FILE: seupd.F SID: 2.11 DATE OF SID: 04/10/01 RELEASE: 2 */ |
| 247 |
|
| 248 |
/* \EndLib */ |
| 249 |
|
| 250 |
/* ----------------------------------------------------------------------- */ |
| 251 |
/* Subroutine */ int dseupd_(logical *rvec, char *howmny, logical *select, |
| 252 |
doublereal *d__, doublereal *z__, integer *ldz, doublereal *sigma, |
| 253 |
char *bmat, integer *n, char *which, integer *nev, doublereal *tol, |
| 254 |
doublereal *resid, integer *ncv, doublereal *v, integer *ldv, integer |
| 255 |
*iparam, integer *ipntr, doublereal *workd, doublereal *workl, |
| 256 |
integer *lworkl, integer *info, ftnlen howmny_len, ftnlen bmat_len, |
| 257 |
ftnlen which_len) |
| 258 |
{ |
| 259 |
/* System generated locals */ |
| 260 |
integer v_dim1, v_offset, z_dim1, z_offset, i__1; |
| 261 |
doublereal d__1, d__2, d__3; |
| 262 |
|
| 263 |
/* Builtin functions */ |
| 264 |
integer s_cmp(char *, char *, ftnlen, ftnlen); |
| 265 |
/* Subroutine */ int s_copy(char *, char *, ftnlen, ftnlen); |
| 266 |
double pow_dd(doublereal *, doublereal *); |
| 267 |
|
| 268 |
/* Local variables */ |
| 269 |
static integer j, k, ih, jj, iq, np, iw, ibd, ihb, ihd, ldh, ldq, irz; |
| 270 |
extern /* Subroutine */ int dger_(integer *, integer *, doublereal *, |
| 271 |
doublereal *, integer *, doublereal *, integer *, doublereal *, |
| 272 |
integer *); |
| 273 |
static integer mode; |
| 274 |
static doublereal eps23; |
| 275 |
static integer ierr; |
| 276 |
static doublereal temp; |
| 277 |
static integer next; |
| 278 |
static char type__[6]; |
| 279 |
static integer ritz; |
| 280 |
extern doublereal dnrm2_(integer *, doublereal *, integer *); |
| 281 |
static doublereal temp1; |
| 282 |
extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, |
| 283 |
integer *); |
| 284 |
static logical reord; |
| 285 |
extern /* Subroutine */ int dcopy_(integer *, doublereal *, integer *, |
| 286 |
doublereal *, integer *); |
| 287 |
static integer nconv; |
| 288 |
static doublereal rnorm; |
| 289 |
extern /* Subroutine */ int dvout_(integer *, integer *, doublereal *, |
| 290 |
integer *, char *, ftnlen), ivout_(integer *, integer *, integer * |
| 291 |
, integer *, char *, ftnlen), dgeqr2_(integer *, integer *, |
| 292 |
doublereal *, integer *, doublereal *, doublereal *, integer *); |
| 293 |
static doublereal bnorm2; |
| 294 |
extern /* Subroutine */ int dorm2r_(char *, char *, integer *, integer *, |
| 295 |
integer *, doublereal *, integer *, doublereal *, doublereal *, |
| 296 |
integer *, doublereal *, integer *, ftnlen, ftnlen); |
| 297 |
extern doublereal dlamch_(char *, ftnlen); |
| 298 |
static integer bounds, msglvl, ishift, numcnv; |
| 299 |
extern /* Subroutine */ int dlacpy_(char *, integer *, integer *, |
| 300 |
doublereal *, integer *, doublereal *, integer *, ftnlen), |
| 301 |
dsesrt_(char *, logical *, integer *, doublereal *, integer *, |
| 302 |
doublereal *, integer *, ftnlen), dsteqr_(char *, integer *, |
| 303 |
doublereal *, doublereal *, doublereal *, integer *, doublereal *, |
| 304 |
integer *, ftnlen), dsortr_(char *, logical *, integer *, |
| 305 |
doublereal *, doublereal *, ftnlen), dsgets_(integer *, char *, |
| 306 |
integer *, integer *, doublereal *, doublereal *, doublereal *, |
| 307 |
ftnlen); |
| 308 |
static integer leftptr, rghtptr; |
| 309 |
|
| 310 |
|
| 311 |
/* %----------------------------------------------------% */ |
| 312 |
/* | Include files for debugging and timing information | */ |
| 313 |
/* %----------------------------------------------------% */ |
| 314 |
|
| 315 |
|
| 316 |
/* \SCCS Information: @(#) */ |
| 317 |
/* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 318 |
|
| 319 |
/* %---------------------------------% */ |
| 320 |
/* | See debug.doc for documentation | */ |
| 321 |
/* %---------------------------------% */ |
| 322 |
|
| 323 |
/* %------------------% */ |
| 324 |
/* | Scalar Arguments | */ |
| 325 |
/* %------------------% */ |
| 326 |
|
| 327 |
/* %--------------------------------% */ |
| 328 |
/* | See stat.doc for documentation | */ |
| 329 |
/* %--------------------------------% */ |
| 330 |
|
| 331 |
/* \SCCS Information: @(#) */ |
| 332 |
/* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
/* %-----------------% */ |
| 337 |
/* | Array Arguments | */ |
| 338 |
/* %-----------------% */ |
| 339 |
|
| 340 |
|
| 341 |
/* %------------% */ |
| 342 |
/* | Parameters | */ |
| 343 |
/* %------------% */ |
| 344 |
|
| 345 |
|
| 346 |
/* %---------------% */ |
| 347 |
/* | Local Scalars | */ |
| 348 |
/* %---------------% */ |
| 349 |
|
| 350 |
|
| 351 |
/* %----------------------% */ |
| 352 |
/* | External Subroutines | */ |
| 353 |
/* %----------------------% */ |
| 354 |
|
| 355 |
|
| 356 |
/* %--------------------% */ |
| 357 |
/* | External Functions | */ |
| 358 |
/* %--------------------% */ |
| 359 |
|
| 360 |
|
| 361 |
/* %---------------------% */ |
| 362 |
/* | Intrinsic Functions | */ |
| 363 |
/* %---------------------% */ |
| 364 |
|
| 365 |
|
| 366 |
/* %-----------------------% */ |
| 367 |
/* | Executable Statements | */ |
| 368 |
/* %-----------------------% */ |
| 369 |
|
| 370 |
/* %------------------------% */ |
| 371 |
/* | Set default parameters | */ |
| 372 |
/* %------------------------% */ |
| 373 |
|
| 374 |
/* Parameter adjustments */ |
| 375 |
--workd; |
| 376 |
--resid; |
| 377 |
z_dim1 = *ldz; |
| 378 |
z_offset = 1 + z_dim1; |
| 379 |
z__ -= z_offset; |
| 380 |
--d__; |
| 381 |
--select; |
| 382 |
v_dim1 = *ldv; |
| 383 |
v_offset = 1 + v_dim1; |
| 384 |
v -= v_offset; |
| 385 |
--iparam; |
| 386 |
--ipntr; |
| 387 |
--workl; |
| 388 |
|
| 389 |
/* Function Body */ |
| 390 |
msglvl = debug_1.mseupd; |
| 391 |
mode = iparam[7]; |
| 392 |
nconv = iparam[5]; |
| 393 |
*info = 0; |
| 394 |
|
| 395 |
/* %--------------% */ |
| 396 |
/* | Quick return | */ |
| 397 |
/* %--------------% */ |
| 398 |
|
| 399 |
if (nconv == 0) { |
| 400 |
goto L9000; |
| 401 |
} |
| 402 |
ierr = 0; |
| 403 |
|
| 404 |
if (nconv <= 0) { |
| 405 |
ierr = -14; |
| 406 |
} |
| 407 |
if (*n <= 0) { |
| 408 |
ierr = -1; |
| 409 |
} |
| 410 |
if (*nev <= 0) { |
| 411 |
ierr = -2; |
| 412 |
} |
| 413 |
if (*ncv <= *nev || *ncv > *n) { |
| 414 |
ierr = -3; |
| 415 |
} |
| 416 |
if (s_cmp(which, "LM", (ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, "SM", ( |
| 417 |
ftnlen)2, (ftnlen)2) != 0 && s_cmp(which, "LA", (ftnlen)2, ( |
| 418 |
ftnlen)2) != 0 && s_cmp(which, "SA", (ftnlen)2, (ftnlen)2) != 0 && |
| 419 |
s_cmp(which, "BE", (ftnlen)2, (ftnlen)2) != 0) { |
| 420 |
ierr = -5; |
| 421 |
} |
| 422 |
if (*(unsigned char *)bmat != 'I' && *(unsigned char *)bmat != 'G') { |
| 423 |
ierr = -6; |
| 424 |
} |
| 425 |
if (*(unsigned char *)howmny != 'A' && *(unsigned char *)howmny != 'P' && |
| 426 |
*(unsigned char *)howmny != 'S' && *rvec) { |
| 427 |
ierr = -15; |
| 428 |
} |
| 429 |
if (*rvec && *(unsigned char *)howmny == 'S') { |
| 430 |
ierr = -16; |
| 431 |
} |
| 432 |
|
| 433 |
/* Computing 2nd power */ |
| 434 |
i__1 = *ncv; |
| 435 |
if (*rvec && *lworkl < i__1 * i__1 + (*ncv << 3)) { |
| 436 |
ierr = -7; |
| 437 |
} |
| 438 |
|
| 439 |
if (mode == 1 || mode == 2) { |
| 440 |
s_copy(type__, "REGULR", (ftnlen)6, (ftnlen)6); |
| 441 |
} else if (mode == 3) { |
| 442 |
s_copy(type__, "SHIFTI", (ftnlen)6, (ftnlen)6); |
| 443 |
} else if (mode == 4) { |
| 444 |
s_copy(type__, "BUCKLE", (ftnlen)6, (ftnlen)6); |
| 445 |
} else if (mode == 5) { |
| 446 |
s_copy(type__, "CAYLEY", (ftnlen)6, (ftnlen)6); |
| 447 |
} else { |
| 448 |
ierr = -10; |
| 449 |
} |
| 450 |
if (mode == 1 && *(unsigned char *)bmat == 'G') { |
| 451 |
ierr = -11; |
| 452 |
} |
| 453 |
if (*nev == 1 && s_cmp(which, "BE", (ftnlen)2, (ftnlen)2) == 0) { |
| 454 |
ierr = -12; |
| 455 |
} |
| 456 |
|
| 457 |
/* %------------% */ |
| 458 |
/* | Error Exit | */ |
| 459 |
/* %------------% */ |
| 460 |
|
| 461 |
if (ierr != 0) { |
| 462 |
*info = ierr; |
| 463 |
goto L9000; |
| 464 |
} |
| 465 |
|
| 466 |
/* %-------------------------------------------------------% */ |
| 467 |
/* | Pointer into WORKL for address of H, RITZ, BOUNDS, Q | */ |
| 468 |
/* | etc... and the remaining workspace. | */ |
| 469 |
/* | Also update pointer to be used on output. | */ |
| 470 |
/* | Memory is laid out as follows: | */ |
| 471 |
/* | workl(1:2*ncv) := generated tridiagonal matrix H | */ |
| 472 |
/* | The subdiagonal is stored in workl(2:ncv). | */ |
| 473 |
/* | The dead spot is workl(1) but upon exiting | */ |
| 474 |
/* | dsaupd stores the B-norm of the last residual | */ |
| 475 |
/* | vector in workl(1). We use this !!! | */ |
| 476 |
/* | workl(2*ncv+1:2*ncv+ncv) := ritz values | */ |
| 477 |
/* | The wanted values are in the first NCONV spots. | */ |
| 478 |
/* | workl(3*ncv+1:3*ncv+ncv) := computed Ritz estimates | */ |
| 479 |
/* | The wanted values are in the first NCONV spots. | */ |
| 480 |
/* | NOTE: workl(1:4*ncv) is set by dsaupd and is not | */ |
| 481 |
/* | modified by dseupd . | */ |
| 482 |
/* %-------------------------------------------------------% */ |
| 483 |
|
| 484 |
/* %-------------------------------------------------------% */ |
| 485 |
/* | The following is used and set by dseupd . | */ |
| 486 |
/* | workl(4*ncv+1:4*ncv+ncv) := used as workspace during | */ |
| 487 |
/* | computation of the eigenvectors of H. Stores | */ |
| 488 |
/* | the diagonal of H. Upon EXIT contains the NCV | */ |
| 489 |
/* | Ritz values of the original system. The first | */ |
| 490 |
/* | NCONV spots have the wanted values. If MODE = | */ |
| 491 |
/* | 1 or 2 then will equal workl(2*ncv+1:3*ncv). | */ |
| 492 |
/* | workl(5*ncv+1:5*ncv+ncv) := used as workspace during | */ |
| 493 |
/* | computation of the eigenvectors of H. Stores | */ |
| 494 |
/* | the subdiagonal of H. Upon EXIT contains the | */ |
| 495 |
/* | NCV corresponding Ritz estimates of the | */ |
| 496 |
/* | original system. The first NCONV spots have the | */ |
| 497 |
/* | wanted values. If MODE = 1,2 then will equal | */ |
| 498 |
/* | workl(3*ncv+1:4*ncv). | */ |
| 499 |
/* | workl(6*ncv+1:6*ncv+ncv*ncv) := orthogonal Q that is | */ |
| 500 |
/* | the eigenvector matrix for H as returned by | */ |
| 501 |
/* | dsteqr . Not referenced if RVEC = .False. | */ |
| 502 |
/* | Ordering follows that of workl(4*ncv+1:5*ncv) | */ |
| 503 |
/* | workl(6*ncv+ncv*ncv+1:6*ncv+ncv*ncv+2*ncv) := | */ |
| 504 |
/* | Workspace. Needed by dsteqr and by dseupd . | */ |
| 505 |
/* | GRAND total of NCV*(NCV+8) locations. | */ |
| 506 |
/* %-------------------------------------------------------% */ |
| 507 |
|
| 508 |
|
| 509 |
ih = ipntr[5]; |
| 510 |
ritz = ipntr[6]; |
| 511 |
bounds = ipntr[7]; |
| 512 |
ldh = *ncv; |
| 513 |
ldq = *ncv; |
| 514 |
ihd = bounds + ldh; |
| 515 |
ihb = ihd + ldh; |
| 516 |
iq = ihb + ldh; |
| 517 |
iw = iq + ldh * *ncv; |
| 518 |
next = iw + (*ncv << 1); |
| 519 |
ipntr[4] = next; |
| 520 |
ipntr[8] = ihd; |
| 521 |
ipntr[9] = ihb; |
| 522 |
ipntr[10] = iq; |
| 523 |
|
| 524 |
/* %----------------------------------------% */ |
| 525 |
/* | irz points to the Ritz values computed | */ |
| 526 |
/* | by _seigt before exiting _saup2. | */ |
| 527 |
/* | ibd points to the Ritz estimates | */ |
| 528 |
/* | computed by _seigt before exiting | */ |
| 529 |
/* | _saup2. | */ |
| 530 |
/* %----------------------------------------% */ |
| 531 |
|
| 532 |
irz = ipntr[11] + *ncv; |
| 533 |
ibd = irz + *ncv; |
| 534 |
|
| 535 |
|
| 536 |
/* %---------------------------------% */ |
| 537 |
/* | Set machine dependent constant. | */ |
| 538 |
/* %---------------------------------% */ |
| 539 |
|
| 540 |
eps23 = dlamch_("Epsilon-Machine", (ftnlen)15); |
| 541 |
eps23 = pow_dd(&eps23, &c_b21); |
| 542 |
|
| 543 |
/* %---------------------------------------% */ |
| 544 |
/* | RNORM is B-norm of the RESID(1:N). | */ |
| 545 |
/* | BNORM2 is the 2 norm of B*RESID(1:N). | */ |
| 546 |
/* | Upon exit of dsaupd WORKD(1:N) has | */ |
| 547 |
/* | B*RESID(1:N). | */ |
| 548 |
/* %---------------------------------------% */ |
| 549 |
|
| 550 |
rnorm = workl[ih]; |
| 551 |
if (*(unsigned char *)bmat == 'I') { |
| 552 |
bnorm2 = rnorm; |
| 553 |
} else if (*(unsigned char *)bmat == 'G') { |
| 554 |
bnorm2 = dnrm2_(n, &workd[1], &c__1); |
| 555 |
} |
| 556 |
|
| 557 |
if (msglvl > 2) { |
| 558 |
dvout_(&debug_1.logfil, ncv, &workl[irz], &debug_1.ndigit, "_seupd: " |
| 559 |
"Ritz values passed in from _SAUPD.", (ftnlen)42); |
| 560 |
dvout_(&debug_1.logfil, ncv, &workl[ibd], &debug_1.ndigit, "_seupd: " |
| 561 |
"Ritz estimates passed in from _SAUPD.", (ftnlen)45); |
| 562 |
} |
| 563 |
|
| 564 |
if (*rvec) { |
| 565 |
|
| 566 |
reord = FALSE_; |
| 567 |
|
| 568 |
/* %---------------------------------------------------% */ |
| 569 |
/* | Use the temporary bounds array to store indices | */ |
| 570 |
/* | These will be used to mark the select array later | */ |
| 571 |
/* %---------------------------------------------------% */ |
| 572 |
|
| 573 |
i__1 = *ncv; |
| 574 |
for (j = 1; j <= i__1; ++j) { |
| 575 |
workl[bounds + j - 1] = (doublereal) j; |
| 576 |
select[j] = FALSE_; |
| 577 |
/* L10: */ |
| 578 |
} |
| 579 |
|
| 580 |
/* %-------------------------------------% */ |
| 581 |
/* | Select the wanted Ritz values. | */ |
| 582 |
/* | Sort the Ritz values so that the | */ |
| 583 |
/* | wanted ones appear at the tailing | */ |
| 584 |
/* | NEV positions of workl(irr) and | */ |
| 585 |
/* | workl(iri). Move the corresponding | */ |
| 586 |
/* | error estimates in workl(bound) | */ |
| 587 |
/* | accordingly. | */ |
| 588 |
/* %-------------------------------------% */ |
| 589 |
|
| 590 |
np = *ncv - *nev; |
| 591 |
ishift = 0; |
| 592 |
dsgets_(&ishift, which, nev, &np, &workl[irz], &workl[bounds], &workl[ |
| 593 |
1], (ftnlen)2); |
| 594 |
|
| 595 |
if (msglvl > 2) { |
| 596 |
dvout_(&debug_1.logfil, ncv, &workl[irz], &debug_1.ndigit, "_seu" |
| 597 |
"pd: Ritz values after calling _SGETS.", (ftnlen)41); |
| 598 |
dvout_(&debug_1.logfil, ncv, &workl[bounds], &debug_1.ndigit, |
| 599 |
"_seupd: Ritz value indices after calling _SGETS.", ( |
| 600 |
ftnlen)48); |
| 601 |
} |
| 602 |
|
| 603 |
/* %-----------------------------------------------------% */ |
| 604 |
/* | Record indices of the converged wanted Ritz values | */ |
| 605 |
/* | Mark the select array for possible reordering | */ |
| 606 |
/* %-----------------------------------------------------% */ |
| 607 |
|
| 608 |
numcnv = 0; |
| 609 |
i__1 = *ncv; |
| 610 |
for (j = 1; j <= i__1; ++j) { |
| 611 |
/* Computing MAX */ |
| 612 |
d__2 = eps23, d__3 = (d__1 = workl[irz + *ncv - j], abs(d__1)); |
| 613 |
temp1 = max(d__2,d__3); |
| 614 |
jj = (integer) workl[bounds + *ncv - j]; |
| 615 |
if (numcnv < nconv && workl[ibd + jj - 1] <= *tol * temp1) { |
| 616 |
select[jj] = TRUE_; |
| 617 |
++numcnv; |
| 618 |
if (jj > *nev) { |
| 619 |
reord = TRUE_; |
| 620 |
} |
| 621 |
} |
| 622 |
/* L11: */ |
| 623 |
} |
| 624 |
|
| 625 |
/* %-----------------------------------------------------------% */ |
| 626 |
/* | Check the count (numcnv) of converged Ritz values with | */ |
| 627 |
/* | the number (nconv) reported by _saupd. If these two | */ |
| 628 |
/* | are different then there has probably been an error | */ |
| 629 |
/* | caused by incorrect passing of the _saupd data. | */ |
| 630 |
/* %-----------------------------------------------------------% */ |
| 631 |
|
| 632 |
if (msglvl > 2) { |
| 633 |
ivout_(&debug_1.logfil, &c__1, &numcnv, &debug_1.ndigit, "_seupd" |
| 634 |
": Number of specified eigenvalues", (ftnlen)39); |
| 635 |
ivout_(&debug_1.logfil, &c__1, &nconv, &debug_1.ndigit, "_seupd:" |
| 636 |
" Number of \"converged\" eigenvalues", (ftnlen)41); |
| 637 |
} |
| 638 |
|
| 639 |
if (numcnv != nconv) { |
| 640 |
*info = -17; |
| 641 |
goto L9000; |
| 642 |
} |
| 643 |
|
| 644 |
/* %-----------------------------------------------------------% */ |
| 645 |
/* | Call LAPACK routine _steqr to compute the eigenvalues and | */ |
| 646 |
/* | eigenvectors of the final symmetric tridiagonal matrix H. | */ |
| 647 |
/* | Initialize the eigenvector matrix Q to the identity. | */ |
| 648 |
/* %-----------------------------------------------------------% */ |
| 649 |
|
| 650 |
i__1 = *ncv - 1; |
| 651 |
dcopy_(&i__1, &workl[ih + 1], &c__1, &workl[ihb], &c__1); |
| 652 |
dcopy_(ncv, &workl[ih + ldh], &c__1, &workl[ihd], &c__1); |
| 653 |
|
| 654 |
dsteqr_("Identity", ncv, &workl[ihd], &workl[ihb], &workl[iq], &ldq, & |
| 655 |
workl[iw], &ierr, (ftnlen)8); |
| 656 |
|
| 657 |
if (ierr != 0) { |
| 658 |
*info = -8; |
| 659 |
goto L9000; |
| 660 |
} |
| 661 |
|
| 662 |
if (msglvl > 1) { |
| 663 |
dcopy_(ncv, &workl[iq + *ncv - 1], &ldq, &workl[iw], &c__1); |
| 664 |
dvout_(&debug_1.logfil, ncv, &workl[ihd], &debug_1.ndigit, "_seu" |
| 665 |
"pd: NCV Ritz values of the final H matrix", (ftnlen)45); |
| 666 |
dvout_(&debug_1.logfil, ncv, &workl[iw], &debug_1.ndigit, "_seup" |
| 667 |
"d: last row of the eigenvector matrix for H", (ftnlen)48); |
| 668 |
} |
| 669 |
|
| 670 |
if (reord) { |
| 671 |
|
| 672 |
/* %---------------------------------------------% */ |
| 673 |
/* | Reordered the eigenvalues and eigenvectors | */ |
| 674 |
/* | computed by _steqr so that the "converged" | */ |
| 675 |
/* | eigenvalues appear in the first NCONV | */ |
| 676 |
/* | positions of workl(ihd), and the associated | */ |
| 677 |
/* | eigenvectors appear in the first NCONV | */ |
| 678 |
/* | columns. | */ |
| 679 |
/* %---------------------------------------------% */ |
| 680 |
|
| 681 |
leftptr = 1; |
| 682 |
rghtptr = *ncv; |
| 683 |
|
| 684 |
if (*ncv == 1) { |
| 685 |
goto L30; |
| 686 |
} |
| 687 |
|
| 688 |
L20: |
| 689 |
if (select[leftptr]) { |
| 690 |
|
| 691 |
/* %-------------------------------------------% */ |
| 692 |
/* | Search, from the left, for the first Ritz | */ |
| 693 |
/* | value that has not converged. | */ |
| 694 |
/* %-------------------------------------------% */ |
| 695 |
|
| 696 |
++leftptr; |
| 697 |
|
| 698 |
} else if (! select[rghtptr]) { |
| 699 |
|
| 700 |
/* %----------------------------------------------% */ |
| 701 |
/* | Search, from the right, the first Ritz value | */ |
| 702 |
/* | that has converged. | */ |
| 703 |
/* %----------------------------------------------% */ |
| 704 |
|
| 705 |
--rghtptr; |
| 706 |
|
| 707 |
} else { |
| 708 |
|
| 709 |
/* %----------------------------------------------% */ |
| 710 |
/* | Swap the Ritz value on the left that has not | */ |
| 711 |
/* | converged with the Ritz value on the right | */ |
| 712 |
/* | that has converged. Swap the associated | */ |
| 713 |
/* | eigenvector of the tridiagonal matrix H as | */ |
| 714 |
/* | well. | */ |
| 715 |
/* %----------------------------------------------% */ |
| 716 |
|
| 717 |
temp = workl[ihd + leftptr - 1]; |
| 718 |
workl[ihd + leftptr - 1] = workl[ihd + rghtptr - 1]; |
| 719 |
workl[ihd + rghtptr - 1] = temp; |
| 720 |
dcopy_(ncv, &workl[iq + *ncv * (leftptr - 1)], &c__1, &workl[ |
| 721 |
iw], &c__1); |
| 722 |
dcopy_(ncv, &workl[iq + *ncv * (rghtptr - 1)], &c__1, &workl[ |
| 723 |
iq + *ncv * (leftptr - 1)], &c__1); |
| 724 |
dcopy_(ncv, &workl[iw], &c__1, &workl[iq + *ncv * (rghtptr - |
| 725 |
1)], &c__1); |
| 726 |
++leftptr; |
| 727 |
--rghtptr; |
| 728 |
|
| 729 |
} |
| 730 |
|
| 731 |
if (leftptr < rghtptr) { |
| 732 |
goto L20; |
| 733 |
} |
| 734 |
|
| 735 |
L30: |
| 736 |
; |
| 737 |
} |
| 738 |
|
| 739 |
if (msglvl > 2) { |
| 740 |
dvout_(&debug_1.logfil, ncv, &workl[ihd], &debug_1.ndigit, "_seu" |
| 741 |
"pd: The eigenvalues of H--reordered", (ftnlen)39); |
| 742 |
} |
| 743 |
|
| 744 |
/* %----------------------------------------% */ |
| 745 |
/* | Load the converged Ritz values into D. | */ |
| 746 |
/* %----------------------------------------% */ |
| 747 |
|
| 748 |
dcopy_(&nconv, &workl[ihd], &c__1, &d__[1], &c__1); |
| 749 |
|
| 750 |
} else { |
| 751 |
|
| 752 |
/* %-----------------------------------------------------% */ |
| 753 |
/* | Ritz vectors not required. Load Ritz values into D. | */ |
| 754 |
/* %-----------------------------------------------------% */ |
| 755 |
|
| 756 |
dcopy_(&nconv, &workl[ritz], &c__1, &d__[1], &c__1); |
| 757 |
dcopy_(ncv, &workl[ritz], &c__1, &workl[ihd], &c__1); |
| 758 |
|
| 759 |
} |
| 760 |
|
| 761 |
/* %------------------------------------------------------------------% */ |
| 762 |
/* | Transform the Ritz values and possibly vectors and corresponding | */ |
| 763 |
/* | Ritz estimates of OP to those of A*x=lambda*B*x. The Ritz values | */ |
| 764 |
/* | (and corresponding data) are returned in ascending order. | */ |
| 765 |
/* %------------------------------------------------------------------% */ |
| 766 |
|
| 767 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0) { |
| 768 |
|
| 769 |
/* %---------------------------------------------------------% */ |
| 770 |
/* | Ascending sort of wanted Ritz values, vectors and error | */ |
| 771 |
/* | bounds. Not necessary if only Ritz values are desired. | */ |
| 772 |
/* %---------------------------------------------------------% */ |
| 773 |
|
| 774 |
if (*rvec) { |
| 775 |
dsesrt_("LA", rvec, &nconv, &d__[1], ncv, &workl[iq], &ldq, ( |
| 776 |
ftnlen)2); |
| 777 |
} else { |
| 778 |
dcopy_(ncv, &workl[bounds], &c__1, &workl[ihb], &c__1); |
| 779 |
} |
| 780 |
|
| 781 |
} else { |
| 782 |
|
| 783 |
/* %-------------------------------------------------------------% */ |
| 784 |
/* | * Make a copy of all the Ritz values. | */ |
| 785 |
/* | * Transform the Ritz values back to the original system. | */ |
| 786 |
/* | For TYPE = 'SHIFTI' the transformation is | */ |
| 787 |
/* | lambda = 1/theta + sigma | */ |
| 788 |
/* | For TYPE = 'BUCKLE' the transformation is | */ |
| 789 |
/* | lambda = sigma * theta / ( theta - 1 ) | */ |
| 790 |
/* | For TYPE = 'CAYLEY' the transformation is | */ |
| 791 |
/* | lambda = sigma * (theta + 1) / (theta - 1 ) | */ |
| 792 |
/* | where the theta are the Ritz values returned by dsaupd . | */ |
| 793 |
/* | NOTES: | */ |
| 794 |
/* | *The Ritz vectors are not affected by the transformation. | */ |
| 795 |
/* | They are only reordered. | */ |
| 796 |
/* %-------------------------------------------------------------% */ |
| 797 |
|
| 798 |
dcopy_(ncv, &workl[ihd], &c__1, &workl[iw], &c__1); |
| 799 |
if (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0) { |
| 800 |
i__1 = *ncv; |
| 801 |
for (k = 1; k <= i__1; ++k) { |
| 802 |
workl[ihd + k - 1] = 1. / workl[ihd + k - 1] + *sigma; |
| 803 |
/* L40: */ |
| 804 |
} |
| 805 |
} else if (s_cmp(type__, "BUCKLE", (ftnlen)6, (ftnlen)6) == 0) { |
| 806 |
i__1 = *ncv; |
| 807 |
for (k = 1; k <= i__1; ++k) { |
| 808 |
workl[ihd + k - 1] = *sigma * workl[ihd + k - 1] / (workl[ihd |
| 809 |
+ k - 1] - 1.); |
| 810 |
/* L50: */ |
| 811 |
} |
| 812 |
} else if (s_cmp(type__, "CAYLEY", (ftnlen)6, (ftnlen)6) == 0) { |
| 813 |
i__1 = *ncv; |
| 814 |
for (k = 1; k <= i__1; ++k) { |
| 815 |
workl[ihd + k - 1] = *sigma * (workl[ihd + k - 1] + 1.) / ( |
| 816 |
workl[ihd + k - 1] - 1.); |
| 817 |
/* L60: */ |
| 818 |
} |
| 819 |
} |
| 820 |
|
| 821 |
/* %-------------------------------------------------------------% */ |
| 822 |
/* | * Store the wanted NCONV lambda values into D. | */ |
| 823 |
/* | * Sort the NCONV wanted lambda in WORKL(IHD:IHD+NCONV-1) | */ |
| 824 |
/* | into ascending order and apply sort to the NCONV theta | */ |
| 825 |
/* | values in the transformed system. We will need this to | */ |
| 826 |
/* | compute Ritz estimates in the original system. | */ |
| 827 |
/* | * Finally sort the lambda`s into ascending order and apply | */ |
| 828 |
/* | to Ritz vectors if wanted. Else just sort lambda`s into | */ |
| 829 |
/* | ascending order. | */ |
| 830 |
/* | NOTES: | */ |
| 831 |
/* | *workl(iw:iw+ncv-1) contain the theta ordered so that they | */ |
| 832 |
/* | match the ordering of the lambda. We`ll use them again for | */ |
| 833 |
/* | Ritz vector purification. | */ |
| 834 |
/* %-------------------------------------------------------------% */ |
| 835 |
|
| 836 |
dcopy_(&nconv, &workl[ihd], &c__1, &d__[1], &c__1); |
| 837 |
dsortr_("LA", &c_true, &nconv, &workl[ihd], &workl[iw], (ftnlen)2); |
| 838 |
if (*rvec) { |
| 839 |
dsesrt_("LA", rvec, &nconv, &d__[1], ncv, &workl[iq], &ldq, ( |
| 840 |
ftnlen)2); |
| 841 |
} else { |
| 842 |
dcopy_(ncv, &workl[bounds], &c__1, &workl[ihb], &c__1); |
| 843 |
d__1 = bnorm2 / rnorm; |
| 844 |
dscal_(ncv, &d__1, &workl[ihb], &c__1); |
| 845 |
dsortr_("LA", &c_true, &nconv, &d__[1], &workl[ihb], (ftnlen)2); |
| 846 |
} |
| 847 |
|
| 848 |
} |
| 849 |
|
| 850 |
/* %------------------------------------------------% */ |
| 851 |
/* | Compute the Ritz vectors. Transform the wanted | */ |
| 852 |
/* | eigenvectors of the symmetric tridiagonal H by | */ |
| 853 |
/* | the Lanczos basis matrix V. | */ |
| 854 |
/* %------------------------------------------------% */ |
| 855 |
|
| 856 |
if (*rvec && *(unsigned char *)howmny == 'A') { |
| 857 |
|
| 858 |
/* %----------------------------------------------------------% */ |
| 859 |
/* | Compute the QR factorization of the matrix representing | */ |
| 860 |
/* | the wanted invariant subspace located in the first NCONV | */ |
| 861 |
/* | columns of workl(iq,ldq). | */ |
| 862 |
/* %----------------------------------------------------------% */ |
| 863 |
|
| 864 |
dgeqr2_(ncv, &nconv, &workl[iq], &ldq, &workl[iw + *ncv], &workl[ihb], |
| 865 |
&ierr); |
| 866 |
|
| 867 |
/* %--------------------------------------------------------% */ |
| 868 |
/* | * Postmultiply V by Q. | */ |
| 869 |
/* | * Copy the first NCONV columns of VQ into Z. | */ |
| 870 |
/* | The N by NCONV matrix Z is now a matrix representation | */ |
| 871 |
/* | of the approximate invariant subspace associated with | */ |
| 872 |
/* | the Ritz values in workl(ihd). | */ |
| 873 |
/* %--------------------------------------------------------% */ |
| 874 |
|
| 875 |
dorm2r_("Right", "Notranspose", n, ncv, &nconv, &workl[iq], &ldq, & |
| 876 |
workl[iw + *ncv], &v[v_offset], ldv, &workd[*n + 1], &ierr, ( |
| 877 |
ftnlen)5, (ftnlen)11); |
| 878 |
dlacpy_("All", n, &nconv, &v[v_offset], ldv, &z__[z_offset], ldz, ( |
| 879 |
ftnlen)3); |
| 880 |
|
| 881 |
/* %-----------------------------------------------------% */ |
| 882 |
/* | In order to compute the Ritz estimates for the Ritz | */ |
| 883 |
/* | values in both systems, need the last row of the | */ |
| 884 |
/* | eigenvector matrix. Remember, it`s in factored form | */ |
| 885 |
/* %-----------------------------------------------------% */ |
| 886 |
|
| 887 |
i__1 = *ncv - 1; |
| 888 |
for (j = 1; j <= i__1; ++j) { |
| 889 |
workl[ihb + j - 1] = 0.; |
| 890 |
/* L65: */ |
| 891 |
} |
| 892 |
workl[ihb + *ncv - 1] = 1.; |
| 893 |
dorm2r_("Left", "Transpose", ncv, &c__1, &nconv, &workl[iq], &ldq, & |
| 894 |
workl[iw + *ncv], &workl[ihb], ncv, &temp, &ierr, (ftnlen)4, ( |
| 895 |
ftnlen)9); |
| 896 |
|
| 897 |
} else if (*rvec && *(unsigned char *)howmny == 'S') { |
| 898 |
|
| 899 |
/* Not yet implemented. See remark 2 above. */ |
| 900 |
|
| 901 |
} |
| 902 |
|
| 903 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) == 0 && *rvec) { |
| 904 |
|
| 905 |
i__1 = *ncv; |
| 906 |
for (j = 1; j <= i__1; ++j) { |
| 907 |
workl[ihb + j - 1] = rnorm * (d__1 = workl[ihb + j - 1], abs(d__1) |
| 908 |
); |
| 909 |
/* L70: */ |
| 910 |
} |
| 911 |
|
| 912 |
} else if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) != 0 && *rvec) { |
| 913 |
|
| 914 |
/* %-------------------------------------------------% */ |
| 915 |
/* | * Determine Ritz estimates of the theta. | */ |
| 916 |
/* | If RVEC = .true. then compute Ritz estimates | */ |
| 917 |
/* | of the theta. | */ |
| 918 |
/* | If RVEC = .false. then copy Ritz estimates | */ |
| 919 |
/* | as computed by dsaupd . | */ |
| 920 |
/* | * Determine Ritz estimates of the lambda. | */ |
| 921 |
/* %-------------------------------------------------% */ |
| 922 |
|
| 923 |
dscal_(ncv, &bnorm2, &workl[ihb], &c__1); |
| 924 |
if (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0) { |
| 925 |
|
| 926 |
i__1 = *ncv; |
| 927 |
for (k = 1; k <= i__1; ++k) { |
| 928 |
/* Computing 2nd power */ |
| 929 |
d__2 = workl[iw + k - 1]; |
| 930 |
workl[ihb + k - 1] = (d__1 = workl[ihb + k - 1], abs(d__1)) / |
| 931 |
(d__2 * d__2); |
| 932 |
/* L80: */ |
| 933 |
} |
| 934 |
|
| 935 |
} else if (s_cmp(type__, "BUCKLE", (ftnlen)6, (ftnlen)6) == 0) { |
| 936 |
|
| 937 |
i__1 = *ncv; |
| 938 |
for (k = 1; k <= i__1; ++k) { |
| 939 |
/* Computing 2nd power */ |
| 940 |
d__2 = workl[iw + k - 1] - 1.; |
| 941 |
workl[ihb + k - 1] = *sigma * (d__1 = workl[ihb + k - 1], abs( |
| 942 |
d__1)) / (d__2 * d__2); |
| 943 |
/* L90: */ |
| 944 |
} |
| 945 |
|
| 946 |
} else if (s_cmp(type__, "CAYLEY", (ftnlen)6, (ftnlen)6) == 0) { |
| 947 |
|
| 948 |
i__1 = *ncv; |
| 949 |
for (k = 1; k <= i__1; ++k) { |
| 950 |
workl[ihb + k - 1] = (d__1 = workl[ihb + k - 1] / workl[iw + |
| 951 |
k - 1] * (workl[iw + k - 1] - 1.), abs(d__1)); |
| 952 |
/* L100: */ |
| 953 |
} |
| 954 |
|
| 955 |
} |
| 956 |
|
| 957 |
} |
| 958 |
|
| 959 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) != 0 && msglvl > 1) { |
| 960 |
dvout_(&debug_1.logfil, &nconv, &d__[1], &debug_1.ndigit, "_seupd: U" |
| 961 |
"ntransformed converged Ritz values", (ftnlen)43); |
| 962 |
dvout_(&debug_1.logfil, &nconv, &workl[ihb], &debug_1.ndigit, "_seup" |
| 963 |
"d: Ritz estimates of the untransformed Ritz values", (ftnlen) |
| 964 |
55); |
| 965 |
} else if (msglvl > 1) { |
| 966 |
dvout_(&debug_1.logfil, &nconv, &d__[1], &debug_1.ndigit, "_seupd: C" |
| 967 |
"onverged Ritz values", (ftnlen)29); |
| 968 |
dvout_(&debug_1.logfil, &nconv, &workl[ihb], &debug_1.ndigit, "_seup" |
| 969 |
"d: Associated Ritz estimates", (ftnlen)33); |
| 970 |
} |
| 971 |
|
| 972 |
/* %-------------------------------------------------% */ |
| 973 |
/* | Ritz vector purification step. Formally perform | */ |
| 974 |
/* | one of inverse subspace iteration. Only used | */ |
| 975 |
/* | for MODE = 3,4,5. See reference 7 | */ |
| 976 |
/* %-------------------------------------------------% */ |
| 977 |
|
| 978 |
if (*rvec && (s_cmp(type__, "SHIFTI", (ftnlen)6, (ftnlen)6) == 0 || s_cmp( |
| 979 |
type__, "CAYLEY", (ftnlen)6, (ftnlen)6) == 0)) { |
| 980 |
|
| 981 |
i__1 = nconv - 1; |
| 982 |
for (k = 0; k <= i__1; ++k) { |
| 983 |
workl[iw + k] = workl[iq + k * ldq + *ncv - 1] / workl[iw + k]; |
| 984 |
/* L110: */ |
| 985 |
} |
| 986 |
|
| 987 |
} else if (*rvec && s_cmp(type__, "BUCKLE", (ftnlen)6, (ftnlen)6) == 0) { |
| 988 |
|
| 989 |
i__1 = nconv - 1; |
| 990 |
for (k = 0; k <= i__1; ++k) { |
| 991 |
workl[iw + k] = workl[iq + k * ldq + *ncv - 1] / (workl[iw + k] - |
| 992 |
1.); |
| 993 |
/* L120: */ |
| 994 |
} |
| 995 |
|
| 996 |
} |
| 997 |
|
| 998 |
if (s_cmp(type__, "REGULR", (ftnlen)6, (ftnlen)6) != 0) { |
| 999 |
dger_(n, &nconv, &c_b110, &resid[1], &c__1, &workl[iw], &c__1, &z__[ |
| 1000 |
z_offset], ldz); |
| 1001 |
} |
| 1002 |
|
| 1003 |
L9000: |
| 1004 |
|
| 1005 |
return 0; |
| 1006 |
|
| 1007 |
/* %---------------% */ |
| 1008 |
/* | End of dseupd | */ |
| 1009 |
/* %---------------% */ |
| 1010 |
|
| 1011 |
} /* dseupd_ */ |
| 1012 |
|