| 1 |
/* ./src_f77/cneigh.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_CNEIGH; |
| 15 |
|
| 16 |
#define debug_1 debug_CNEIGH |
| 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_CNEIGH; |
| 25 |
|
| 26 |
#define timing_1 timing_CNEIGH |
| 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 logical c_true = TRUE_; |
| 33 |
static integer c__1 = 1; |
| 34 |
|
| 35 |
/* \BeginDoc */ |
| 36 |
|
| 37 |
/* \Name: cneigh */ |
| 38 |
|
| 39 |
/* \Description: */ |
| 40 |
/* Compute the eigenvalues of the current upper Hessenberg matrix */ |
| 41 |
/* and the corresponding Ritz estimates given the current residual norm. */ |
| 42 |
|
| 43 |
/* \Usage: */ |
| 44 |
/* call cneigh */ |
| 45 |
/* ( RNORM, N, H, LDH, RITZ, BOUNDS, Q, LDQ, WORKL, RWORK, IERR ) */ |
| 46 |
|
| 47 |
/* \Arguments */ |
| 48 |
/* RNORM Real scalar. (INPUT) */ |
| 49 |
/* Residual norm corresponding to the current upper Hessenberg */ |
| 50 |
/* matrix H. */ |
| 51 |
|
| 52 |
/* N Integer. (INPUT) */ |
| 53 |
/* Size of the matrix H. */ |
| 54 |
|
| 55 |
/* H Complex N by N array. (INPUT) */ |
| 56 |
/* H contains the current upper Hessenberg matrix. */ |
| 57 |
|
| 58 |
/* LDH Integer. (INPUT) */ |
| 59 |
/* Leading dimension of H exactly as declared in the calling */ |
| 60 |
/* program. */ |
| 61 |
|
| 62 |
/* RITZ Complex array of length N. (OUTPUT) */ |
| 63 |
/* On output, RITZ(1:N) contains the eigenvalues of H. */ |
| 64 |
|
| 65 |
/* BOUNDS Complex array of length N. (OUTPUT) */ |
| 66 |
/* On output, BOUNDS contains the Ritz estimates associated with */ |
| 67 |
/* the eigenvalues held in RITZ. This is equal to RNORM */ |
| 68 |
/* times the last components of the eigenvectors corresponding */ |
| 69 |
/* to the eigenvalues in RITZ. */ |
| 70 |
|
| 71 |
/* Q Complex N by N array. (WORKSPACE) */ |
| 72 |
/* Workspace needed to store the eigenvectors of H. */ |
| 73 |
|
| 74 |
/* LDQ Integer. (INPUT) */ |
| 75 |
/* Leading dimension of Q exactly as declared in the calling */ |
| 76 |
/* program. */ |
| 77 |
|
| 78 |
/* WORKL Complex work array of length N**2 + 3*N. (WORKSPACE) */ |
| 79 |
/* Private (replicated) array on each PE or array allocated on */ |
| 80 |
/* the front end. This is needed to keep the full Schur form */ |
| 81 |
/* of H and also in the calculation of the eigenvectors of H. */ |
| 82 |
|
| 83 |
/* RWORK Real work array of length N (WORKSPACE) */ |
| 84 |
/* Private (replicated) array on each PE or array allocated on */ |
| 85 |
/* the front end. */ |
| 86 |
|
| 87 |
/* IERR Integer. (OUTPUT) */ |
| 88 |
/* Error exit flag from clahqr or ctrevc. */ |
| 89 |
|
| 90 |
/* \EndDoc */ |
| 91 |
|
| 92 |
/* ----------------------------------------------------------------------- */ |
| 93 |
|
| 94 |
/* \BeginLib */ |
| 95 |
|
| 96 |
/* \Local variables: */ |
| 97 |
/* xxxxxx Complex */ |
| 98 |
|
| 99 |
/* \Routines called: */ |
| 100 |
/* ivout ARPACK utility routine that prints integers. */ |
| 101 |
/* second ARPACK utility routine for timing. */ |
| 102 |
/* cmout ARPACK utility routine that prints matrices */ |
| 103 |
/* cvout ARPACK utility routine that prints vectors. */ |
| 104 |
/* svout ARPACK utility routine that prints vectors. */ |
| 105 |
/* clacpy LAPACK matrix copy routine. */ |
| 106 |
/* clahqr LAPACK routine to compute the Schur form of an */ |
| 107 |
/* upper Hessenberg matrix. */ |
| 108 |
/* claset LAPACK matrix initialization routine. */ |
| 109 |
/* ctrevc LAPACK routine to compute the eigenvectors of a matrix */ |
| 110 |
/* in upper triangular form */ |
| 111 |
/* ccopy Level 1 BLAS that copies one vector to another. */ |
| 112 |
/* csscal Level 1 BLAS that scales a complex vector by a real number. */ |
| 113 |
/* scnrm2 Level 1 BLAS that computes the norm of a vector. */ |
| 114 |
|
| 115 |
|
| 116 |
/* \Author */ |
| 117 |
/* Danny Sorensen Phuong Vu */ |
| 118 |
/* Richard Lehoucq CRPC / Rice University */ |
| 119 |
/* Dept. of Computational & Houston, Texas */ |
| 120 |
/* Applied Mathematics */ |
| 121 |
/* Rice University */ |
| 122 |
/* Houston, Texas */ |
| 123 |
|
| 124 |
/* \SCCS Information: @(#) */ |
| 125 |
/* FILE: neigh.F SID: 2.2 DATE OF SID: 4/20/96 RELEASE: 2 */ |
| 126 |
|
| 127 |
/* \Remarks */ |
| 128 |
/* None */ |
| 129 |
|
| 130 |
/* \EndLib */ |
| 131 |
|
| 132 |
/* ----------------------------------------------------------------------- */ |
| 133 |
|
| 134 |
/* Subroutine */ int cneigh_(real *rnorm, integer *n, realcomplex *h__, integer * |
| 135 |
ldh, realcomplex *ritz, realcomplex *bounds, realcomplex *q, integer *ldq, |
| 136 |
realcomplex *workl, real *rwork, integer *ierr) |
| 137 |
{ |
| 138 |
/* System generated locals */ |
| 139 |
integer h_dim1, h_offset, q_dim1, q_offset, i__1; |
| 140 |
real r__1; |
| 141 |
|
| 142 |
/* Local variables */ |
| 143 |
static integer j; |
| 144 |
static real t0, t1; |
| 145 |
static realcomplex vl[1]; |
| 146 |
static real temp; |
| 147 |
extern /* Subroutine */ int ccopy_(integer *, realcomplex *, integer *, |
| 148 |
realcomplex *, integer *), cmout_(integer *, integer *, integer *, |
| 149 |
realcomplex *, integer *, integer *, char *, ftnlen), cvout_(integer * |
| 150 |
, integer *, realcomplex *, integer *, char *, ftnlen); |
| 151 |
extern doublereal scnrm2_(integer *, realcomplex *, integer *); |
| 152 |
extern /* Subroutine */ int csscal_(integer *, real *, realcomplex *, integer |
| 153 |
*), clahqr_(logical *, logical *, integer *, integer *, integer *, |
| 154 |
realcomplex *, integer *, realcomplex *, integer *, integer *, realcomplex *, |
| 155 |
integer *, integer *), clacpy_(char *, integer *, integer *, |
| 156 |
realcomplex *, integer *, realcomplex *, integer *, ftnlen); |
| 157 |
static logical select[1]; |
| 158 |
static integer msglvl; |
| 159 |
extern /* Subroutine */ int ctrevc_(char *, char *, logical *, integer *, |
| 160 |
realcomplex *, integer *, realcomplex *, integer *, realcomplex *, integer *, |
| 161 |
integer *, integer *, realcomplex *, real *, integer *, ftnlen, |
| 162 |
ftnlen), second_(real *), claset_(char *, integer *, integer *, |
| 163 |
realcomplex *, realcomplex *, realcomplex *, integer *, ftnlen); |
| 164 |
|
| 165 |
|
| 166 |
/* %----------------------------------------------------% */ |
| 167 |
/* | Include files for debugging and timing information | */ |
| 168 |
/* %----------------------------------------------------% */ |
| 169 |
|
| 170 |
|
| 171 |
/* \SCCS Information: @(#) */ |
| 172 |
/* FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 173 |
|
| 174 |
/* %---------------------------------% */ |
| 175 |
/* | See debug.doc for documentation | */ |
| 176 |
/* %---------------------------------% */ |
| 177 |
|
| 178 |
/* %------------------% */ |
| 179 |
/* | Scalar Arguments | */ |
| 180 |
/* %------------------% */ |
| 181 |
|
| 182 |
/* %--------------------------------% */ |
| 183 |
/* | See stat.doc for documentation | */ |
| 184 |
/* %--------------------------------% */ |
| 185 |
|
| 186 |
/* \SCCS Information: @(#) */ |
| 187 |
/* FILE: stat.h SID: 2.2 DATE OF SID: 11/16/95 RELEASE: 2 */ |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
/* %-----------------% */ |
| 192 |
/* | Array Arguments | */ |
| 193 |
/* %-----------------% */ |
| 194 |
|
| 195 |
|
| 196 |
/* %------------% */ |
| 197 |
/* | Parameters | */ |
| 198 |
/* %------------% */ |
| 199 |
|
| 200 |
|
| 201 |
/* %------------------------% */ |
| 202 |
/* | Local Scalars & Arrays | */ |
| 203 |
/* %------------------------% */ |
| 204 |
|
| 205 |
|
| 206 |
/* %----------------------% */ |
| 207 |
/* | External Subroutines | */ |
| 208 |
/* %----------------------% */ |
| 209 |
|
| 210 |
|
| 211 |
/* %--------------------% */ |
| 212 |
/* | External Functions | */ |
| 213 |
/* %--------------------% */ |
| 214 |
|
| 215 |
|
| 216 |
/* %-----------------------% */ |
| 217 |
/* | Executable Statements | */ |
| 218 |
/* %-----------------------% */ |
| 219 |
|
| 220 |
/* %-------------------------------% */ |
| 221 |
/* | Initialize timing statistics | */ |
| 222 |
/* | & message level for debugging | */ |
| 223 |
/* %-------------------------------% */ |
| 224 |
|
| 225 |
/* Parameter adjustments */ |
| 226 |
--rwork; |
| 227 |
--workl; |
| 228 |
--bounds; |
| 229 |
--ritz; |
| 230 |
h_dim1 = *ldh; |
| 231 |
h_offset = 1 + h_dim1; |
| 232 |
h__ -= h_offset; |
| 233 |
q_dim1 = *ldq; |
| 234 |
q_offset = 1 + q_dim1; |
| 235 |
q -= q_offset; |
| 236 |
|
| 237 |
/* Function Body */ |
| 238 |
second_(&t0); |
| 239 |
msglvl = debug_1.mceigh; |
| 240 |
|
| 241 |
if (msglvl > 2) { |
| 242 |
cmout_(&debug_1.logfil, n, n, &h__[h_offset], ldh, &debug_1.ndigit, |
| 243 |
"_neigh: Entering upper Hessenberg matrix H ", (ftnlen)43); |
| 244 |
} |
| 245 |
|
| 246 |
/* %----------------------------------------------------------% */ |
| 247 |
/* | 1. Compute the eigenvalues, the last components of the | */ |
| 248 |
/* | corresponding Schur vectors and the full Schur form T | */ |
| 249 |
/* | of the current upper Hessenberg matrix H. | */ |
| 250 |
/* | clahqr returns the full Schur form of H | */ |
| 251 |
/* | in WORKL(1:N**2), and the Schur vectors in q. | */ |
| 252 |
/* %----------------------------------------------------------% */ |
| 253 |
|
| 254 |
clacpy_("All", n, n, &h__[h_offset], ldh, &workl[1], n, (ftnlen)3); |
| 255 |
claset_("All", n, n, &c_b2, &c_b1, &q[q_offset], ldq, (ftnlen)3); |
| 256 |
clahqr_(&c_true, &c_true, n, &c__1, n, &workl[1], ldh, &ritz[1], &c__1, n, |
| 257 |
&q[q_offset], ldq, ierr); |
| 258 |
if (*ierr != 0) { |
| 259 |
goto L9000; |
| 260 |
} |
| 261 |
|
| 262 |
ccopy_(n, &q[*n - 1 + q_dim1], ldq, &bounds[1], &c__1); |
| 263 |
if (msglvl > 1) { |
| 264 |
cvout_(&debug_1.logfil, n, &bounds[1], &debug_1.ndigit, "_neigh: las" |
| 265 |
"t row of the Schur matrix for H", (ftnlen)42); |
| 266 |
} |
| 267 |
|
| 268 |
/* %----------------------------------------------------------% */ |
| 269 |
/* | 2. Compute the eigenvectors of the full Schur form T and | */ |
| 270 |
/* | apply the Schur vectors to get the corresponding | */ |
| 271 |
/* | eigenvectors. | */ |
| 272 |
/* %----------------------------------------------------------% */ |
| 273 |
|
| 274 |
ctrevc_("Right", "Back", select, n, &workl[1], n, vl, n, &q[q_offset], |
| 275 |
ldq, n, n, &workl[*n * *n + 1], &rwork[1], ierr, (ftnlen)5, ( |
| 276 |
ftnlen)4); |
| 277 |
|
| 278 |
if (*ierr != 0) { |
| 279 |
goto L9000; |
| 280 |
} |
| 281 |
|
| 282 |
/* %------------------------------------------------% */ |
| 283 |
/* | Scale the returning eigenvectors so that their | */ |
| 284 |
/* | Euclidean norms are all one. LAPACK subroutine | */ |
| 285 |
/* | ctrevc returns each eigenvector normalized so | */ |
| 286 |
/* | that the element of largest magnitude has | */ |
| 287 |
/* | magnitude 1; here the magnitude of a complex | */ |
| 288 |
/* | number (x,y) is taken to be |x| + |y|. | */ |
| 289 |
/* %------------------------------------------------% */ |
| 290 |
|
| 291 |
i__1 = *n; |
| 292 |
for (j = 1; j <= i__1; ++j) { |
| 293 |
temp = scnrm2_(n, &q[j * q_dim1 + 1], &c__1); |
| 294 |
r__1 = 1.f / temp; |
| 295 |
csscal_(n, &r__1, &q[j * q_dim1 + 1], &c__1); |
| 296 |
/* L10: */ |
| 297 |
} |
| 298 |
|
| 299 |
if (msglvl > 1) { |
| 300 |
ccopy_(n, &q[*n + q_dim1], ldq, &workl[1], &c__1); |
| 301 |
cvout_(&debug_1.logfil, n, &workl[1], &debug_1.ndigit, "_neigh: Last" |
| 302 |
" row of the eigenvector matrix for H", (ftnlen)48); |
| 303 |
} |
| 304 |
|
| 305 |
/* %----------------------------% */ |
| 306 |
/* | Compute the Ritz estimates | */ |
| 307 |
/* %----------------------------% */ |
| 308 |
|
| 309 |
ccopy_(n, &q[*n + q_dim1], n, &bounds[1], &c__1); |
| 310 |
csscal_(n, rnorm, &bounds[1], &c__1); |
| 311 |
|
| 312 |
if (msglvl > 2) { |
| 313 |
cvout_(&debug_1.logfil, n, &ritz[1], &debug_1.ndigit, "_neigh: The e" |
| 314 |
"igenvalues of H", (ftnlen)28); |
| 315 |
cvout_(&debug_1.logfil, n, &bounds[1], &debug_1.ndigit, "_neigh: Rit" |
| 316 |
"z estimates for the eigenvalues of H", (ftnlen)47); |
| 317 |
} |
| 318 |
|
| 319 |
second_(&t1); |
| 320 |
timing_1.tceigh += t1 - t0; |
| 321 |
|
| 322 |
L9000: |
| 323 |
return 0; |
| 324 |
|
| 325 |
/* %---------------% */ |
| 326 |
/* | End of cneigh | */ |
| 327 |
/* %---------------% */ |
| 328 |
|
| 329 |
} /* cneigh_ */ |
| 330 |
|