Télécharger dnaupd.eso

Retour à la liste

Numérotation des lignes :

  1. C DNAUPD SOURCE BP208322 15/10/13 21:15:45 8670
  2. c\BeginDoc
  3. c
  4. c\Name: dnaupd
  5. c
  6. c\Description:
  7. c Reverse communication interface for the Implicitly Restarted Arnoldi
  8. c iteration. This subroutine computes approximations to a few eigenpairs
  9. c of a linear operator "OP" with respect to a semi-inner product defined by
  10. c a symmetric positive semi-definite real matrix B. B may be the identity
  11. c matrix. NOTE: If the linear operator "OP" is real and symmetric
  12. c with respect to the real positive semi-definite symmetric matrix B,
  13. c i.e. B*OP = (OP`)*B, then subroutine dsaupd should be used instead.
  14. c
  15. c The computed approximate eigenvalues are called Ritz values and
  16. c the corresponding approximate eigenvectors are called Ritz vectors.
  17. c
  18. c dnaupd is usually called iteratively to solve one of the
  19. c following problems:
  20. c
  21. c Mode 1: A*x = lambda*x.
  22. c ===> OP = A and B = I.
  23. c
  24. c Mode 2: A*x = lambda*M*x, M symmetric positive definite
  25. c ===> OP = inv[M]*A and B = M.
  26. c ===> (If M can be factored see remark 3 below)
  27. c
  28. c Mode 3: A*x = lambda*M*x, M symmetric semi-definite
  29. c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
  30. c ===> shift-and-invert mode (in real arithmetic)
  31. c If OP*x = amu*x, then
  32. c amu = 1/2 * [ 1/(lambda-sigma) + 1/(lambda-conjg(sigma)) ].
  33. c Note: If sigma is real, i.e. imaginary part of sigma is zero;
  34. c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
  35. c amu == 1/(lambda-sigma).
  36. c
  37. c Mode 4: A*x = lambda*M*x, M symmetric semi-definite
  38. c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
  39. c ===> shift-and-invert mode (in real arithmetic)
  40. c If OP*x = amu*x, then
  41. c amu = 1/2i * [ 1/(lambda-sigma) - 1/(lambda-conjg(sigma)) ].
  42. c
  43. c Both mode 3 and 4 give the same enhancement to eigenvalues close to
  44. c the (complex) shift sigma. However, as lambda goes to infinity,
  45. c the operator OP in mode 4 dampens the eigenvalues more strongly than
  46. c does OP defined in mode 3.
  47. c
  48. c NOTE: The action of w <- inv[A - sigma*M]*v or w <- inv[M]*v
  49. c should be accomplished either by a direct method
  50. c using a sparse matrix factorization and solving
  51. c
  52. c [A - sigma*M]*w = v or M*w = v,
  53. c
  54. c or through an iterative method for solving these
  55. c systems. If an iterative method is used, the
  56. c convergence test must be more stringent than
  57. c the accuracy requirements for the eigenvalue
  58. c approximations.
  59. c
  60. c\Usage:
  61. c call dnaupd
  62. c ( IDO, BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, LDV, IPARAM,
  63. c IPNTR, WORKD, WORKL, LWORKL, INFO )
  64. c
  65. c\Arguments
  66. c IDO Integer. (INPUT/OUTPUT)
  67. c Reverse communication flag. IDO must be zero on the first
  68. c call to dnaupd . IDO will be set internally to
  69. c indicate the type of operation to be performed. Control is
  70. c then given back to the calling routine which has the
  71. c responsibility to carry out the requested operation and call
  72. c dnaupd with the result. The operand is given in
  73. c WORKD(IPNTR(1)), the result must be put in WORKD(IPNTR(2)).
  74. c -------------------------------------------------------------
  75. c IDO = 0: first call to the reverse communication interface
  76. c IDO = -1: compute Y = OP * X where
  77. c IPNTR(1) is the pointer into WORKD for X,
  78. c IPNTR(2) is the pointer into WORKD for Y.
  79. c This is for the initialization phase to force the
  80. c starting vector into the range of OP.
  81. c IDO = 1: compute Y = OP * X where
  82. c IPNTR(1) is the pointer into WORKD for X,
  83. c IPNTR(2) is the pointer into WORKD for Y.
  84. c In mode 3 and 4, the vector B * X is already
  85. c available in WORKD(ipntr(3)). It does not
  86. c need to be recomputed in forming OP * X.
  87. c IDO = 2: compute Y = B * X where
  88. c IPNTR(1) is the pointer into WORKD for X,
  89. c IPNTR(2) is the pointer into WORKD for Y.
  90. c IDO = 3: compute the IPARAM(8) real and imaginary parts
  91. c of the shifts where INPTR(14) is the pointer
  92. c into WORKL for placing the shifts. See Remark
  93. c 5 below.
  94. c IDO = 99: done
  95. c -------------------------------------------------------------
  96. c
  97. c BMAT Character*1. (INPUT)
  98. c BMAT specifies the type of the matrix B that defines the
  99. c semi-inner product for the operator OP.
  100. c BMAT = 'I' -> standard eigenvalue problem A*x = lambda*x
  101. c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*B*x
  102. c
  103. c N Integer. (INPUT)
  104. c Dimension of the eigenproblem.
  105. c
  106. c WHICH Character*2. (INPUT)
  107. c 'LM' -> want the NEV eigenvalues of largest magnitude.
  108. c 'SM' -> want the NEV eigenvalues of smallest magnitude.
  109. c 'LR' -> want the NEV eigenvalues of largest real part.
  110. c 'SR' -> want the NEV eigenvalues of smallest real part.
  111. c 'LI' -> want the NEV eigenvalues of largest imaginary part.
  112. c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
  113. c
  114. c NEV Integer. (INPUT)
  115. c Number of eigenvalues of OP to be computed. 0 < NEV < N-1.
  116. c
  117. c TOL Double precision scalar. (INPUT/OUTPUT)
  118. c Stopping criterion: the relative accuracy of the Ritz value
  119. c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I))
  120. c where ABS(RITZ(I)) is the magnitude when RITZ(I) is complex.
  121. c DEFAULT = DLAMCH ('EPS') (machine precision as computed
  122. c by the LAPACK auxiliary subroutine DLAMCH ).
  123. c
  124. c RESID Double precision array of length N. (INPUT/OUTPUT)
  125. c On INPUT:
  126. c If INFO .EQ. 0, a random initial residual vector is used.
  127. c If INFO .NE. 0, RESID contains the initial residual vector,
  128. c possibly from a previous run.
  129. c On OUTPUT:
  130. c RESID contains the final residual vector.
  131. c
  132. c NCV Integer. (INPUT)
  133. c Number of columns of the matrix V. NCV must satisfy the two
  134. c inequalities 2 <= NCV-NEV and NCV <= N.
  135. c This will indicate how many Arnoldi vectors are generated
  136. c at each iteration. After the startup phase in which NEV
  137. c Arnoldi vectors are generated, the algorithm generates
  138. c approximately NCV-NEV Arnoldi vectors at each subsequent update
  139. c iteration. Most of the cost in generating each Arnoldi vector is
  140. c in the matrix-vector operation OP*x.
  141. c NOTE: 2 <= NCV-NEV in order that complex conjugate pairs of Ritz
  142. c values are kept together. (See remark 4 below)
  143. c
  144. c V REAL*8 array N by NCV. (OUTPUT)
  145. c Contains the final set of Arnoldi basis vectors.
  146. c
  147. c LDV Integer. (INPUT)
  148. c Leading dimension of V exactly as declared in the calling program.
  149. c
  150. c IPARAM Integer array of length 11. (INPUT/OUTPUT)
  151. c IPARAM(1) = ISHIFT: method for selecting the implicit shifts.
  152. c The shifts selected at each iteration are used to restart
  153. c the Arnoldi iteration in an implicit fashion.
  154. c -------------------------------------------------------------
  155. c ISHIFT = 0: the shifts are provided by the user via
  156. c reverse communication. The real and imaginary
  157. c parts of the NCV eigenvalues of the Hessenberg
  158. c matrix H are returned in the part of the WORKL
  159. c array corresponding to RITZR and RITZI. See remark
  160. c 5 below.
  161. c ISHIFT = 1: exact shifts with respect to the current
  162. c Hessenberg matrix H. This is equivalent to
  163. c restarting the iteration with a starting vector
  164. c that is a linear combination of approximate Schur
  165. c vectors associated with the "wanted" Ritz values.
  166. c -------------------------------------------------------------
  167. c
  168. c IPARAM(2) = No longer referenced.
  169. c
  170. c IPARAM(3) = MXITER
  171. c On INPUT: maximum number of Arnoldi update iterations allowed.
  172. c On OUTPUT: actual number of Arnoldi update iterations taken.
  173. c
  174. c IPARAM(4) = NB: blocksize to be used in the recurrence.
  175. c The code currently works only for NB = 1.
  176. c
  177. c IPARAM(5) = NCONV: number of "converged" Ritz values.
  178. c This represents the number of Ritz values that satisfy
  179. c the convergence criterion.
  180. c
  181. c IPARAM(6) = IUPD
  182. c No longer referenced. Implicit restarting is ALWAYS used.
  183. c
  184. c IPARAM(7) = MODE
  185. c On INPUT determines what type of eigenproblem is being solved.
  186. c Must be 1,2,3,4; See under \Description of dnaupd for the
  187. c four modes available.
  188. c
  189. c IPARAM(8) = NP
  190. c When ido = 3 and the user provides shifts through reverse
  191. c communication (IPARAM(1)=0), dnaupd returns NP, the number
  192. c of shifts the user is to provide. 0 < NP <=NCV-NEV. See Remark
  193. c 5 below.
  194. c
  195. c IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO,
  196. c OUTPUT: NUMOP = total number of OP*x operations,
  197. c NUMOPB = total number of B*x operations if BMAT='G',
  198. c NUMREO = total number of steps of re-orthogonalization.
  199. c
  200. c IPNTR Integer array of length 14. (OUTPUT)
  201. c Pointer to mark the starting locations in the WORKD and WORKL
  202. c arrays for matrices/vectors used by the Arnoldi iteration.
  203. c -------------------------------------------------------------
  204. c IPNTR(1): pointer to the current operand vector X in WORKD.
  205. c IPNTR(2): pointer to the current result vector Y in WORKD.
  206. c IPNTR(3): pointer to the vector B * X in WORKD when used in
  207. c the shift-and-invert mode.
  208. c IPNTR(4): pointer to the next available location in WORKL
  209. c that is untouched by the program.
  210. c IPNTR(5): pointer to the NCV by NCV upper Hessenberg matrix
  211. c H in WORKL.
  212. c IPNTR(6): pointer to the real part of the ritz value array
  213. c RITZR in WORKL.
  214. c IPNTR(7): pointer to the imaginary part of the ritz value array
  215. c RITZI in WORKL.
  216. c IPNTR(8): pointer to the Ritz estimates in array WORKL associated
  217. c with the Ritz values located in RITZR and RITZI in WORKL.
  218. c
  219. c IPNTR(14): pointer to the NP shifts in WORKL. See Remark 5 below.
  220. c
  221. c Note: IPNTR(9:13) is only referenced by dneupd . See Remark 2 below.
  222. c
  223. c IPNTR(9): pointer to the real part of the NCV RITZ values of the
  224. c original system.
  225. c IPNTR(10): pointer to the imaginary part of the NCV RITZ values of
  226. c the original system.
  227. c IPNTR(11): pointer to the NCV corresponding error bounds.
  228. c IPNTR(12): pointer to the NCV by NCV upper quasi-triangular
  229. c Schur matrix for H.
  230. c IPNTR(13): pointer to the NCV by NCV matrix of eigenvectors
  231. c of the upper Hessenberg matrix H. Only referenced by
  232. c dneupd if RVEC = .TRUE. See Remark 2 below.
  233. c -------------------------------------------------------------
  234. c
  235. c WORKD Double precision work array of length 3*N. (REVERSE COMMUNICATION)
  236. c Distributed array to be used in the basic Arnoldi iteration
  237. c for reverse communication. The user should not use WORKD
  238. c as temporary workspace during the iteration. Upon termination
  239. c WORKD(1:N) contains B*RESID(1:N). If an invariant subspace
  240. c associated with the converged Ritz values is desired, see remark
  241. c 2 below, subroutine dneupd uses this output.
  242. c See Data Distribution Note below.
  243. c
  244. c WORKL Double precision work array of length LWORKL. (OUTPUT/WORKSPACE)
  245. c Private (replicated) array on each PE or array allocated on
  246. c the front end. See Data Distribution Note below.
  247. c
  248. c LWORKL Integer. (INPUT)
  249. c LWORKL must be at least 3*NCV**2 + 6*NCV.
  250. c
  251. c INFO Integer. (INPUT/OUTPUT)
  252. c If INFO .EQ. 0, a randomly initial residual vector is used.
  253. c If INFO .NE. 0, RESID contains the initial residual vector,
  254. c possibly from a previous run.
  255. c Error flag on output.
  256. c = 0: Normal exit.
  257. c = 1: Maximum number of iterations taken.
  258. c All possible eigenvalues of OP has been found. IPARAM(5)
  259. c returns the number of wanted converged Ritz values.
  260. c = 2: No longer an informational error. Deprecated starting
  261. c with release 2 of ARPACK.
  262. c = 3: No shifts could be applied during a cycle of the
  263. c Implicitly restarted Arnoldi iteration. One possibility
  264. c is to increase the size of NCV relative to NEV.
  265. c See remark 4 below.
  266. c = -1: N must be positive.
  267. c = -2: NEV must be positive.
  268. c = -3: NCV-NEV >= 2 and less than or equal to N.
  269. c = -4: The maximum number of Arnoldi update iteration
  270. c must be greater than zero.
  271. c = -5: WHICH must be one of 'LM', 'SM', 'LR', 'SR', 'LI', 'SI'
  272. c = -6: BMAT must be one of 'I' or 'G'.
  273. c = -7: Length of private work array is not sufficient.
  274. c = -8: Error return from LAPACK eigenvalue calculation;
  275. c = -9: Starting vector is zero.
  276. c = -10: IPARAM(7) must be 1,2,3,4.
  277. c = -11: IPARAM(7) = 1 and BMAT = 'G' are incompatable.
  278. c = -12: IPARAM(1) must be equal to 0 or 1.
  279. c = -9999: Could not build an Arnoldi factorization.
  280. c IPARAM(5) returns the size of the current Arnoldi
  281. c factorization.
  282. c
  283. c\Remarks
  284. c 1. The computed Ritz values are approximate eigenvalues of OP. The
  285. c selection of WHICH should be made with this in mind when
  286. c Mode = 3 and 4. After convergence, approximate eigenvalues of the
  287. c original problem may be obtained with the ARPACK subroutine dneupd .
  288. c
  289. c 2. If a basis for the invariant subspace corresponding to the converged Ritz
  290. c values is needed, the user must call dneupd immediately following
  291. c completion of dnaupd . This is new starting with release 2 of ARPACK.
  292. c
  293. c 3. If M can be factored into a Cholesky factorization M = LL`
  294. c then Mode = 2 should not be selected. Instead one should use
  295. c Mode = 1 with OP = inv(L)*A*inv(L`). Appropriate triangular
  296. c linear systems should be solved with L and L` rather
  297. c than computing inverses. After convergence, an approximate
  298. c eigenvector z of the original problem is recovered by solving
  299. c L`z = x where x is a Ritz vector of OP.
  300. c
  301. c 4. At present there is no a-priori analysis to guide the selection
  302. c of NCV relative to NEV. The only formal requrement is that NCV > NEV + 2.
  303. c However, it is recommended that NCV .ge. 2*NEV+1. If many problems of
  304. c the same type are to be solved, one should experiment with increasing
  305. c NCV while keeping NEV fixed for a given test problem. This will
  306. c usually decrease the required number of OP*x operations but it
  307. c also increases the work and storage required to maintain the orthogonal
  308. c basis vectors. The optimal "cross-over" with respect to CPU time
  309. c is problem dependent and must be determined empirically.
  310. c See Chapter 8 of Reference 2 for further information.
  311. c
  312. c 5. When IPARAM(1) = 0, and IDO = 3, the user needs to provide the
  313. c NP = IPARAM(8) real and imaginary parts of the shifts in locations
  314. c real part imaginary part
  315. c ----------------------- --------------
  316. c 1 WORKL(IPNTR(14)) WORKL(IPNTR(14)+NP)
  317. c 2 WORKL(IPNTR(14)+1) WORKL(IPNTR(14)+NP+1)
  318. c . .
  319. c . .
  320. c . .
  321. c NP WORKL(IPNTR(14)+NP-1) WORKL(IPNTR(14)+2*NP-1).
  322. c
  323. c Only complex conjugate pairs of shifts may be applied and the pairs
  324. c must be placed in consecutive locations. The real part of the
  325. c eigenvalues of the current upper Hessenberg matrix are located in
  326. c WORKL(IPNTR(6)) through WORKL(IPNTR(6)+NCV-1) and the imaginary part
  327. c in WORKL(IPNTR(7)) through WORKL(IPNTR(7)+NCV-1). They are ordered
  328. c according to the order defined by WHICH. The complex conjugate
  329. c pairs are kept together and the associated Ritz estimates are located in
  330. c WORKL(IPNTR(8)), WORKL(IPNTR(8)+1), ... , WORKL(IPNTR(8)+NCV-1).
  331. c
  332. c-----------------------------------------------------------------------
  333. c
  334. c\Data Distribution Note:
  335. c
  336. c Fortran-D syntax:
  337. c ================
  338. c Double precision resid(n), v(ldv,ncv), workd(3*n), workl(lworkl)
  339. c decompose d1(n), d2(n,ncv)
  340. c align resid(i) with d1(i)
  341. c align v(i,j) with d2(i,j)
  342. c align workd(i) with d1(i) range (1:n)
  343. c align workd(i) with d1(i-n) range (n+1:2*n)
  344. c align workd(i) with d1(i-2*n) range (2*n+1:3*n)
  345. c distribute d1(block), d2(block,:)
  346. c replicated workl(lworkl)
  347. c
  348. c Cray MPP syntax:
  349. c ===============
  350. c Double precision resid(n), v(ldv,ncv), workd(n,3), workl(lworkl)
  351. c shared resid(block), v(block,:), workd(block,:)
  352. c replicated workl(lworkl)
  353. c
  354. c CM2/CM5 syntax:
  355. c ==============
  356. c
  357. c-----------------------------------------------------------------------
  358. c
  359. c include 'ex-nonsym.doc'
  360. c
  361. c-----------------------------------------------------------------------
  362. c
  363. c\BeginLib
  364. c
  365. c\Local variables:
  366. c xxxxxx real
  367. c
  368. c\References:
  369. c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
  370. c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
  371. c pp 357-385.
  372. c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
  373. c Restarted Arnoldi Iteration", Rice University Technical Report
  374. c TR95-13, Department of Computational and Applied Mathematics.
  375. c 3. B.N. Parlett & Y. Saad, "Complex Shift and Invert Strategies for
  376. c Real Matrices", Linear Algebra and its Applications, vol 88/89,
  377. c pp 575-595, (1987).
  378. c
  379. c\Routines called:
  380. c dnaup2 ARPACK routine that implements the Implicitly Restarted
  381. c Arnoldi Iteration.
  382. c ivout ARPACK utility routine that prints integers.
  383. c arscnd ARPACK utility routine for timing.
  384. c dvout ARPACK utility routine that prints vectors.
  385. c dlamch LAPACK routine that determines machine constants.
  386. c
  387. c\Author
  388. c Danny Sorensen Phuong Vu
  389. c Richard Lehoucq CRPC / Rice University
  390. c Dept. of Computational & Houston, Texas
  391. c Applied Mathematics
  392. c Rice University
  393. c Houston, Texas
  394. c
  395. c\Revision history:
  396. c 12/16/93: Version '1.1'
  397. c
  398. c\SCCS Information: @(#)
  399. c FILE: naupd.F SID: 2.8 DATE OF SID: 04/10/01 RELEASE: 2
  400. c
  401. c\Remarks
  402. c
  403. c\EndLib
  404. c
  405. c-----------------------------------------------------------------------
  406. c
  407. subroutine dnaupd
  408. & ( ido, bmat, n, which, nev, tol, resid, ncv, v, ldv, iparam,
  409. & ipntr, workd, workl, lworkl, info )
  410. c
  411. c %----------------------------------------------------%
  412. c | Include files for debugging and timing information |
  413. -INC TARTRAK
  414. c %----------------------------------------------------%
  415. c
  416. c
  417. c %------------------%
  418. c | Scalar Arguments |
  419. c %------------------%
  420. c
  421. character bmat*1, which*2
  422. integer ido, info, ldv, lworkl, n, ncv, nev
  423. REAL*8
  424. & tol
  425. c
  426. c %-----------------%
  427. c | Array Arguments |
  428. c %-----------------%
  429. c
  430. integer iparam(11), ipntr(14)
  431. REAL*8
  432. & resid(n), v(ldv,ncv), workd(3*n), workl(lworkl)
  433. c
  434. c %------------%
  435. c | Parameters |
  436. c %------------%
  437. c
  438. REAL*8
  439. & one, zero
  440. parameter (one = 1.0D+0 , zero = 0.0D+0 )
  441. c
  442. c %---------------%
  443. c | Local Scalars |
  444. c %---------------%
  445. c
  446. integer bounds, ierr, ih, iq, ishift, iupd, iw,
  447. & ldh, ldq, levec, mode, msglvl, mxiter, nb,
  448. & nev0, next, np, ritzi, ritzr, j
  449. save bounds, ih, iq, ishift, iupd, iw, ldh, ldq,
  450. & levec, mode, msglvl, mxiter, nb, nev0, next,
  451. & np, ritzi, ritzr
  452. c
  453. c %----------------------%
  454. c | External Subroutines |
  455. c %----------------------%
  456. c
  457. external dnaup2 , dvout , ivout, arscnd, dstatn
  458. c
  459. c %--------------------%
  460. c | External Functions |
  461. c %--------------------%
  462. c
  463. REAL*8
  464. external dlamch
  465. c
  466. c %-----------------------%
  467. c | Executable Statements |
  468. c %-----------------------%
  469. c
  470. if (ido .eq. 0) then
  471. c
  472. c %-------------------------------%
  473. c | Initialize timing statistics |
  474. c | & message level for debugging |
  475. c %-------------------------------%
  476. c
  477. call dstatn
  478. * call arscnd (t0)
  479. msglvl = mnaupd
  480. c
  481. c %----------------%
  482. c | Error checking |
  483. c %----------------%
  484. c
  485. ierr = 0
  486. ishift = iparam(1)
  487. c levec = iparam(2)
  488. mxiter = iparam(3)
  489. c nb = iparam(4)
  490. nb = 1
  491. c
  492. c %--------------------------------------------%
  493. c | Revision 2 performs only implicit restart. |
  494. c %--------------------------------------------%
  495. c
  496. iupd = 1
  497. mode = iparam(7)
  498. c
  499. if (n .le. 0) then
  500. ierr = -1
  501. else if (nev .le. 0) then
  502. ierr = -2
  503. else if (ncv .le. nev+1 .or. ncv .gt. n) then
  504. ierr = -3
  505. else if (mxiter .le. 0) then
  506. ierr = -4
  507. else if (which .ne. 'LM' .and.
  508. & which .ne. 'SM' .and.
  509. & which .ne. 'LR' .and.
  510. & which .ne. 'SR' .and.
  511. & which .ne. 'LI' .and.
  512. & which .ne. 'SI') then
  513. ierr = -5
  514. else if (bmat .ne. 'I' .and. bmat .ne. 'G') then
  515. ierr = -6
  516. else if (lworkl .lt. 3*ncv**2 + 6*ncv) then
  517. ierr = -7
  518. else if (mode .lt. 1 .or. mode .gt. 4) then
  519. ierr = -10
  520. else if (mode .eq. 1 .and. bmat .eq. 'G') then
  521. ierr = -11
  522. else if (ishift .lt. 0 .or. ishift .gt. 1) then
  523. ierr = -12
  524. end if
  525. c
  526. c %------------%
  527. c | Error Exit |
  528. c %------------%
  529. c
  530. if (ierr .ne. 0) then
  531. info = ierr
  532. ido = 99
  533. go to 9000
  534. end if
  535. c
  536. c %------------------------%
  537. c | Set default parameters |
  538. c %------------------------%
  539. c
  540. if (nb .le. 0) nb = 1
  541. if (tol .le. zero) tol = dlamch ('EpsMach')
  542. c
  543. c %----------------------------------------------%
  544. c | NP is the number of additional steps to |
  545. c | extend the length NEV Lanczos factorization. |
  546. c | NEV0 is the local variable designating the |
  547. c | size of the invariant subspace desired. |
  548. c %----------------------------------------------%
  549. c
  550. np = ncv - nev
  551. nev0 = nev
  552. c
  553. c %-----------------------------%
  554. c | Zero out internal workspace |
  555. c %-----------------------------%
  556. c
  557. do 10 j = 1, 3*ncv**2 + 6*ncv
  558. workl(j) = zero
  559. 10 continue
  560. c
  561. c %-------------------------------------------------------------%
  562. c | Pointer into WORKL for address of H, RITZ, BOUNDS, Q |
  563. c | etc... and the remaining workspace. |
  564. c | Also update pointer to be used on output. |
  565. c | Memory is laid out as follows: |
  566. c | workl(1:ncv*ncv) := generated Hessenberg matrix |
  567. c | workl(ncv*ncv+1:ncv*ncv+2*ncv) := real and imaginary |
  568. c | parts of ritz values |
  569. c | workl(ncv*ncv+2*ncv+1:ncv*ncv+3*ncv) := error bounds |
  570. c | workl(ncv*ncv+3*ncv+1:2*ncv*ncv+3*ncv) := rotation matrix Q |
  571. c | workl(2*ncv*ncv+3*ncv+1:3*ncv*ncv+6*ncv) := workspace |
  572. c | The final workspace is needed by subroutine dneigh called |
  573. c | by dnaup2 . Subroutine dneigh calls LAPACK routines for |
  574. c | calculating eigenvalues and the last row of the eigenvector |
  575. c | matrix. |
  576. c %-------------------------------------------------------------%
  577. c
  578. ldh = ncv
  579. ldq = ncv
  580. ih = 1
  581. ritzr = ih + ldh*ncv
  582. ritzi = ritzr + ncv
  583. bounds = ritzi + ncv
  584. iq = bounds + ncv
  585. iw = iq + ldq*ncv
  586. next = iw + ncv**2 + 3*ncv
  587. c
  588. ipntr(4) = next
  589. ipntr(5) = ih
  590. ipntr(6) = ritzr
  591. ipntr(7) = ritzi
  592. ipntr(8) = bounds
  593. ipntr(14) = iw
  594. c
  595. end if
  596. c
  597. c %-------------------------------------------------------%
  598. c | Carry out the Implicitly restarted Arnoldi Iteration. |
  599. c %-------------------------------------------------------%
  600. c
  601. call dnaup2
  602. & ( ido, bmat, n, which, nev0, np, tol, resid, mode, iupd,
  603. & ishift, mxiter, v, ldv, workl(ih), ldh, workl(ritzr),
  604. & workl(ritzi), workl(bounds), workl(iq), ldq, workl(iw),
  605. & ipntr, workd, info )
  606. c
  607. c %--------------------------------------------------%
  608. c | ido .ne. 99 implies use of reverse communication |
  609. c | to compute operations involving OP or shifts. |
  610. c %--------------------------------------------------%
  611. c
  612. if (ido .eq. 3) iparam(8) = np
  613. if (ido .ne. 99) go to 9000
  614. c
  615. iparam(3) = mxiter
  616. iparam(5) = np
  617. iparam(9) = nopx
  618. iparam(10) = nbx
  619. iparam(11) = nrorth
  620. c
  621. c %------------------------------------%
  622. c | Exit if there was an informational |
  623. c | error within dnaup2 . |
  624. c %------------------------------------%
  625. c
  626. if (info .lt. 0) go to 9000
  627. if (info .eq. 2) info = 3
  628. c
  629. if (msglvl .gt. 0) then
  630. call ivout (logfil, 1, mxiter, ndigit,
  631. & '_naupd: Number of update iterations taken')
  632. call ivout (logfil, 1, np, ndigit,
  633. & '_naupd: Number of wanted "converged" Ritz values')
  634. call dvout (logfil, np, workl(ritzr), ndigit,
  635. & '_naupd: Real part of the final Ritz values')
  636. call dvout (logfil, np, workl(ritzi), ndigit,
  637. & '_naupd: Imaginary part of the final Ritz values')
  638. call dvout (logfil, np, workl(bounds), ndigit,
  639. & '_naupd: Associated Ritz estimates')
  640. end if
  641. c
  642. * call arscnd (t1)
  643. tnaupd = t1 - t0
  644. c
  645. if (msglvl .gt. 0) then
  646. c
  647. c %--------------------------------------------------------%
  648. c | Version Number & Version Date are defined in version.h |
  649. c %--------------------------------------------------------%
  650. c
  651. write (6,1000)
  652. write (6,1100) mxiter, nopx, nbx, nrorth, nitref, nrstrt,
  653. & tmvopx, tmvbx, tnaupd, tnaup2, tnaitr, titref,
  654. & tgetv0, tneigh, tngets, tnapps, tnconv, trvec
  655. 1000 format (//,
  656. & 5x, '=============================================',/
  657. & 5x, '= Nonsymmetric implicit Arnoldi update code =',/
  658. & 5x, '= Version Number: ', ' 2.4' , 21x, ' =',/
  659. & 5x, '= Version Date: ', ' 07/31/96' , 16x, ' =',/
  660. & 5x, '=============================================',/
  661. & 5x, '= Summary of timing statistics =',/
  662. & 5x, '=============================================',//)
  663. 1100 format (
  664. & 5x, 'Total number update iterations = ', i5,/
  665. & 5x, 'Total number of OP*x operations = ', i5,/
  666. & 5x, 'Total number of B*x operations = ', i5,/
  667. & 5x, 'Total number of reorthogonalization steps = ', i5,/
  668. & 5x, 'Total number of iterative refinement steps = ', i5,/
  669. & 5x, 'Total number of restart steps = ', i5,/
  670. & 5x, 'Total time in user OP*x operation = ', f12.6,/
  671. & 5x, 'Total time in user B*x operation = ', f12.6,/
  672. & 5x, 'Total time in Arnoldi update routine = ', f12.6,/
  673. & 5x, 'Total time in naup2 routine = ', f12.6,/
  674. & 5x, 'Total time in basic Arnoldi iteration loop = ', f12.6,/
  675. & 5x, 'Total time in reorthogonalization phase = ', f12.6,/
  676. & 5x, 'Total time in (re)start vector generation = ', f12.6,/
  677. & 5x, 'Total time in Hessenberg eig. subproblem = ', f12.6,/
  678. & 5x, 'Total time in getting the shifts = ', f12.6,/
  679. & 5x, 'Total time in applying the shifts = ', f12.6,/
  680. & 5x, 'Total time in convergence testing = ', f12.6,/
  681. & 5x, 'Total time in computing final Ritz vectors = ', f12.6/)
  682. end if
  683. c
  684. 9000 continue
  685. c
  686. return
  687. c
  688. c %---------------%
  689. c | End of dnaupd |
  690. c %---------------%
  691. c
  692. end
  693.  
  694.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales