You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

zlarrv.f 44 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053
  1. *> \brief \b ZLARRV computes the eigenvectors of the tridiagonal matrix T = L D LT given L, D and the eigenvalues of L D LT.
  2. *
  3. * =========== DOCUMENTATION ===========
  4. *
  5. * Online html documentation available at
  6. * http://www.netlib.org/lapack/explore-html/
  7. *
  8. *> \htmlonly
  9. *> Download ZLARRV + dependencies
  10. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlarrv.f">
  11. *> [TGZ]</a>
  12. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlarrv.f">
  13. *> [ZIP]</a>
  14. *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlarrv.f">
  15. *> [TXT]</a>
  16. *> \endhtmlonly
  17. *
  18. * Definition:
  19. * ===========
  20. *
  21. * SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN,
  22. * ISPLIT, M, DOL, DOU, MINRGP,
  23. * RTOL1, RTOL2, W, WERR, WGAP,
  24. * IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ,
  25. * WORK, IWORK, INFO )
  26. *
  27. * .. Scalar Arguments ..
  28. * INTEGER DOL, DOU, INFO, LDZ, M, N
  29. * DOUBLE PRECISION MINRGP, PIVMIN, RTOL1, RTOL2, VL, VU
  30. * ..
  31. * .. Array Arguments ..
  32. * INTEGER IBLOCK( * ), INDEXW( * ), ISPLIT( * ),
  33. * $ ISUPPZ( * ), IWORK( * )
  34. * DOUBLE PRECISION D( * ), GERS( * ), L( * ), W( * ), WERR( * ),
  35. * $ WGAP( * ), WORK( * )
  36. * COMPLEX*16 Z( LDZ, * )
  37. * ..
  38. *
  39. *
  40. *> \par Purpose:
  41. * =============
  42. *>
  43. *> \verbatim
  44. *>
  45. *> ZLARRV computes the eigenvectors of the tridiagonal matrix
  46. *> T = L D L**T given L, D and APPROXIMATIONS to the eigenvalues of L D L**T.
  47. *> The input eigenvalues should have been computed by DLARRE.
  48. *> \endverbatim
  49. *
  50. * Arguments:
  51. * ==========
  52. *
  53. *> \param[in] N
  54. *> \verbatim
  55. *> N is INTEGER
  56. *> The order of the matrix. N >= 0.
  57. *> \endverbatim
  58. *>
  59. *> \param[in] VL
  60. *> \verbatim
  61. *> VL is DOUBLE PRECISION
  62. *> Lower bound of the interval that contains the desired
  63. *> eigenvalues. VL < VU. Needed to compute gaps on the left or right
  64. *> end of the extremal eigenvalues in the desired RANGE.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] VU
  68. *> \verbatim
  69. *> VU is DOUBLE PRECISION
  70. *> Upper bound of the interval that contains the desired
  71. *> eigenvalues. VL < VU. Needed to compute gaps on the left or right
  72. *> end of the extremal eigenvalues in the desired RANGE.
  73. *> \endverbatim
  74. *>
  75. *> \param[in,out] D
  76. *> \verbatim
  77. *> D is DOUBLE PRECISION array, dimension (N)
  78. *> On entry, the N diagonal elements of the diagonal matrix D.
  79. *> On exit, D may be overwritten.
  80. *> \endverbatim
  81. *>
  82. *> \param[in,out] L
  83. *> \verbatim
  84. *> L is DOUBLE PRECISION array, dimension (N)
  85. *> On entry, the (N-1) subdiagonal elements of the unit
  86. *> bidiagonal matrix L are in elements 1 to N-1 of L
  87. *> (if the matrix is not split.) At the end of each block
  88. *> is stored the corresponding shift as given by DLARRE.
  89. *> On exit, L is overwritten.
  90. *> \endverbatim
  91. *>
  92. *> \param[in] PIVMIN
  93. *> \verbatim
  94. *> PIVMIN is DOUBLE PRECISION
  95. *> The minimum pivot allowed in the Sturm sequence.
  96. *> \endverbatim
  97. *>
  98. *> \param[in] ISPLIT
  99. *> \verbatim
  100. *> ISPLIT is INTEGER array, dimension (N)
  101. *> The splitting points, at which T breaks up into blocks.
  102. *> The first block consists of rows/columns 1 to
  103. *> ISPLIT( 1 ), the second of rows/columns ISPLIT( 1 )+1
  104. *> through ISPLIT( 2 ), etc.
  105. *> \endverbatim
  106. *>
  107. *> \param[in] M
  108. *> \verbatim
  109. *> M is INTEGER
  110. *> The total number of input eigenvalues. 0 <= M <= N.
  111. *> \endverbatim
  112. *>
  113. *> \param[in] DOL
  114. *> \verbatim
  115. *> DOL is INTEGER
  116. *> \endverbatim
  117. *>
  118. *> \param[in] DOU
  119. *> \verbatim
  120. *> DOU is INTEGER
  121. *> If the user wants to compute only selected eigenvectors from all
  122. *> the eigenvalues supplied, he can specify an index range DOL:DOU.
  123. *> Or else the setting DOL=1, DOU=M should be applied.
  124. *> Note that DOL and DOU refer to the order in which the eigenvalues
  125. *> are stored in W.
  126. *> If the user wants to compute only selected eigenpairs, then
  127. *> the columns DOL-1 to DOU+1 of the eigenvector space Z contain the
  128. *> computed eigenvectors. All other columns of Z are set to zero.
  129. *> \endverbatim
  130. *>
  131. *> \param[in] MINRGP
  132. *> \verbatim
  133. *> MINRGP is DOUBLE PRECISION
  134. *> \endverbatim
  135. *>
  136. *> \param[in] RTOL1
  137. *> \verbatim
  138. *> RTOL1 is DOUBLE PRECISION
  139. *> \endverbatim
  140. *>
  141. *> \param[in] RTOL2
  142. *> \verbatim
  143. *> RTOL2 is DOUBLE PRECISION
  144. *> Parameters for bisection.
  145. *> An interval [LEFT,RIGHT] has converged if
  146. *> RIGHT-LEFT.LT.MAX( RTOL1*GAP, RTOL2*MAX(|LEFT|,|RIGHT|) )
  147. *> \endverbatim
  148. *>
  149. *> \param[in,out] W
  150. *> \verbatim
  151. *> W is DOUBLE PRECISION array, dimension (N)
  152. *> The first M elements of W contain the APPROXIMATE eigenvalues for
  153. *> which eigenvectors are to be computed. The eigenvalues
  154. *> should be grouped by split-off block and ordered from
  155. *> smallest to largest within the block ( The output array
  156. *> W from DLARRE is expected here ). Furthermore, they are with
  157. *> respect to the shift of the corresponding root representation
  158. *> for their block. On exit, W holds the eigenvalues of the
  159. *> UNshifted matrix.
  160. *> \endverbatim
  161. *>
  162. *> \param[in,out] WERR
  163. *> \verbatim
  164. *> WERR is DOUBLE PRECISION array, dimension (N)
  165. *> The first M elements contain the semiwidth of the uncertainty
  166. *> interval of the corresponding eigenvalue in W
  167. *> \endverbatim
  168. *>
  169. *> \param[in,out] WGAP
  170. *> \verbatim
  171. *> WGAP is DOUBLE PRECISION array, dimension (N)
  172. *> The separation from the right neighbor eigenvalue in W.
  173. *> \endverbatim
  174. *>
  175. *> \param[in] IBLOCK
  176. *> \verbatim
  177. *> IBLOCK is INTEGER array, dimension (N)
  178. *> The indices of the blocks (submatrices) associated with the
  179. *> corresponding eigenvalues in W; IBLOCK(i)=1 if eigenvalue
  180. *> W(i) belongs to the first block from the top, =2 if W(i)
  181. *> belongs to the second block, etc.
  182. *> \endverbatim
  183. *>
  184. *> \param[in] INDEXW
  185. *> \verbatim
  186. *> INDEXW is INTEGER array, dimension (N)
  187. *> The indices of the eigenvalues within each block (submatrix);
  188. *> for example, INDEXW(i)= 10 and IBLOCK(i)=2 imply that the
  189. *> i-th eigenvalue W(i) is the 10-th eigenvalue in the second block.
  190. *> \endverbatim
  191. *>
  192. *> \param[in] GERS
  193. *> \verbatim
  194. *> GERS is DOUBLE PRECISION array, dimension (2*N)
  195. *> The N Gerschgorin intervals (the i-th Gerschgorin interval
  196. *> is (GERS(2*i-1), GERS(2*i)). The Gerschgorin intervals should
  197. *> be computed from the original UNshifted matrix.
  198. *> \endverbatim
  199. *>
  200. *> \param[out] Z
  201. *> \verbatim
  202. *> Z is COMPLEX*16 array, dimension (LDZ, max(1,M) )
  203. *> If INFO = 0, the first M columns of Z contain the
  204. *> orthonormal eigenvectors of the matrix T
  205. *> corresponding to the input eigenvalues, with the i-th
  206. *> column of Z holding the eigenvector associated with W(i).
  207. *> Note: the user must ensure that at least max(1,M) columns are
  208. *> supplied in the array Z.
  209. *> \endverbatim
  210. *>
  211. *> \param[in] LDZ
  212. *> \verbatim
  213. *> LDZ is INTEGER
  214. *> The leading dimension of the array Z. LDZ >= 1, and if
  215. *> JOBZ = 'V', LDZ >= max(1,N).
  216. *> \endverbatim
  217. *>
  218. *> \param[out] ISUPPZ
  219. *> \verbatim
  220. *> ISUPPZ is INTEGER array, dimension ( 2*max(1,M) )
  221. *> The support of the eigenvectors in Z, i.e., the indices
  222. *> indicating the nonzero elements in Z. The I-th eigenvector
  223. *> is nonzero only in elements ISUPPZ( 2*I-1 ) through
  224. *> ISUPPZ( 2*I ).
  225. *> \endverbatim
  226. *>
  227. *> \param[out] WORK
  228. *> \verbatim
  229. *> WORK is DOUBLE PRECISION array, dimension (12*N)
  230. *> \endverbatim
  231. *>
  232. *> \param[out] IWORK
  233. *> \verbatim
  234. *> IWORK is INTEGER array, dimension (7*N)
  235. *> \endverbatim
  236. *>
  237. *> \param[out] INFO
  238. *> \verbatim
  239. *> INFO is INTEGER
  240. *> = 0: successful exit
  241. *>
  242. *> > 0: A problem occurred in ZLARRV.
  243. *> < 0: One of the called subroutines signaled an internal problem.
  244. *> Needs inspection of the corresponding parameter IINFO
  245. *> for further information.
  246. *>
  247. *> =-1: Problem in DLARRB when refining a child's eigenvalues.
  248. *> =-2: Problem in DLARRF when computing the RRR of a child.
  249. *> When a child is inside a tight cluster, it can be difficult
  250. *> to find an RRR. A partial remedy from the user's point of
  251. *> view is to make the parameter MINRGP smaller and recompile.
  252. *> However, as the orthogonality of the computed vectors is
  253. *> proportional to 1/MINRGP, the user should be aware that
  254. *> he might be trading in precision when he decreases MINRGP.
  255. *> =-3: Problem in DLARRB when refining a single eigenvalue
  256. *> after the Rayleigh correction was rejected.
  257. *> = 5: The Rayleigh Quotient Iteration failed to converge to
  258. *> full accuracy in MAXITR steps.
  259. *> \endverbatim
  260. *
  261. * Authors:
  262. * ========
  263. *
  264. *> \author Univ. of Tennessee
  265. *> \author Univ. of California Berkeley
  266. *> \author Univ. of Colorado Denver
  267. *> \author NAG Ltd.
  268. *
  269. *> \date June 2016
  270. *
  271. *> \ingroup complex16OTHERauxiliary
  272. *
  273. *> \par Contributors:
  274. * ==================
  275. *>
  276. *> Beresford Parlett, University of California, Berkeley, USA \n
  277. *> Jim Demmel, University of California, Berkeley, USA \n
  278. *> Inderjit Dhillon, University of Texas, Austin, USA \n
  279. *> Osni Marques, LBNL/NERSC, USA \n
  280. *> Christof Voemel, University of California, Berkeley, USA
  281. *
  282. * =====================================================================
  283. SUBROUTINE ZLARRV( N, VL, VU, D, L, PIVMIN,
  284. $ ISPLIT, M, DOL, DOU, MINRGP,
  285. $ RTOL1, RTOL2, W, WERR, WGAP,
  286. $ IBLOCK, INDEXW, GERS, Z, LDZ, ISUPPZ,
  287. $ WORK, IWORK, INFO )
  288. *
  289. * -- LAPACK auxiliary routine (version 3.7.0) --
  290. * -- LAPACK is a software package provided by Univ. of Tennessee, --
  291. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  292. * June 2016
  293. *
  294. * .. Scalar Arguments ..
  295. INTEGER DOL, DOU, INFO, LDZ, M, N
  296. DOUBLE PRECISION MINRGP, PIVMIN, RTOL1, RTOL2, VL, VU
  297. * ..
  298. * .. Array Arguments ..
  299. INTEGER IBLOCK( * ), INDEXW( * ), ISPLIT( * ),
  300. $ ISUPPZ( * ), IWORK( * )
  301. DOUBLE PRECISION D( * ), GERS( * ), L( * ), W( * ), WERR( * ),
  302. $ WGAP( * ), WORK( * )
  303. COMPLEX*16 Z( LDZ, * )
  304. * ..
  305. *
  306. * =====================================================================
  307. *
  308. * .. Parameters ..
  309. INTEGER MAXITR
  310. PARAMETER ( MAXITR = 10 )
  311. COMPLEX*16 CZERO
  312. PARAMETER ( CZERO = ( 0.0D0, 0.0D0 ) )
  313. DOUBLE PRECISION ZERO, ONE, TWO, THREE, FOUR, HALF
  314. PARAMETER ( ZERO = 0.0D0, ONE = 1.0D0,
  315. $ TWO = 2.0D0, THREE = 3.0D0,
  316. $ FOUR = 4.0D0, HALF = 0.5D0)
  317. * ..
  318. * .. Local Scalars ..
  319. LOGICAL ESKIP, NEEDBS, STP2II, TRYRQC, USEDBS, USEDRQ
  320. INTEGER DONE, I, IBEGIN, IDONE, IEND, II, IINDC1,
  321. $ IINDC2, IINDR, IINDWK, IINFO, IM, IN, INDEIG,
  322. $ INDLD, INDLLD, INDWRK, ISUPMN, ISUPMX, ITER,
  323. $ ITMP1, J, JBLK, K, MINIWSIZE, MINWSIZE, NCLUS,
  324. $ NDEPTH, NEGCNT, NEWCLS, NEWFST, NEWFTT, NEWLST,
  325. $ NEWSIZ, OFFSET, OLDCLS, OLDFST, OLDIEN, OLDLST,
  326. $ OLDNCL, P, PARITY, Q, WBEGIN, WEND, WINDEX,
  327. $ WINDMN, WINDPL, ZFROM, ZTO, ZUSEDL, ZUSEDU,
  328. $ ZUSEDW
  329. INTEGER INDIN1, INDIN2
  330. DOUBLE PRECISION BSTRES, BSTW, EPS, FUDGE, GAP, GAPTOL, GL, GU,
  331. $ LAMBDA, LEFT, LGAP, MINGMA, NRMINV, RESID,
  332. $ RGAP, RIGHT, RQCORR, RQTOL, SAVGAP, SGNDEF,
  333. $ SIGMA, SPDIAM, SSIGMA, TAU, TMP, TOL, ZTZ
  334. * ..
  335. * .. External Functions ..
  336. DOUBLE PRECISION DLAMCH
  337. EXTERNAL DLAMCH
  338. * ..
  339. * .. External Subroutines ..
  340. EXTERNAL DCOPY, DLARRB, DLARRF, ZDSCAL, ZLAR1V,
  341. $ ZLASET
  342. * ..
  343. * .. Intrinsic Functions ..
  344. INTRINSIC ABS, DBLE, MAX, MIN
  345. INTRINSIC DCMPLX
  346. * ..
  347. * .. Executable Statements ..
  348. * ..
  349. INFO = 0
  350. * The first N entries of WORK are reserved for the eigenvalues
  351. INDLD = N+1
  352. INDLLD= 2*N+1
  353. INDIN1 = 3*N + 1
  354. INDIN2 = 4*N + 1
  355. INDWRK = 5*N + 1
  356. MINWSIZE = 12 * N
  357. DO 5 I= 1,MINWSIZE
  358. WORK( I ) = ZERO
  359. 5 CONTINUE
  360. * IWORK(IINDR+1:IINDR+N) hold the twist indices R for the
  361. * factorization used to compute the FP vector
  362. IINDR = 0
  363. * IWORK(IINDC1+1:IINC2+N) are used to store the clusters of the current
  364. * layer and the one above.
  365. IINDC1 = N
  366. IINDC2 = 2*N
  367. IINDWK = 3*N + 1
  368. MINIWSIZE = 7 * N
  369. DO 10 I= 1,MINIWSIZE
  370. IWORK( I ) = 0
  371. 10 CONTINUE
  372. ZUSEDL = 1
  373. IF(DOL.GT.1) THEN
  374. * Set lower bound for use of Z
  375. ZUSEDL = DOL-1
  376. ENDIF
  377. ZUSEDU = M
  378. IF(DOU.LT.M) THEN
  379. * Set lower bound for use of Z
  380. ZUSEDU = DOU+1
  381. ENDIF
  382. * The width of the part of Z that is used
  383. ZUSEDW = ZUSEDU - ZUSEDL + 1
  384. CALL ZLASET( 'Full', N, ZUSEDW, CZERO, CZERO,
  385. $ Z(1,ZUSEDL), LDZ )
  386. EPS = DLAMCH( 'Precision' )
  387. RQTOL = TWO * EPS
  388. *
  389. * Set expert flags for standard code.
  390. TRYRQC = .TRUE.
  391. IF((DOL.EQ.1).AND.(DOU.EQ.M)) THEN
  392. ELSE
  393. * Only selected eigenpairs are computed. Since the other evalues
  394. * are not refined by RQ iteration, bisection has to compute to full
  395. * accuracy.
  396. RTOL1 = FOUR * EPS
  397. RTOL2 = FOUR * EPS
  398. ENDIF
  399. * The entries WBEGIN:WEND in W, WERR, WGAP correspond to the
  400. * desired eigenvalues. The support of the nonzero eigenvector
  401. * entries is contained in the interval IBEGIN:IEND.
  402. * Remark that if k eigenpairs are desired, then the eigenvectors
  403. * are stored in k contiguous columns of Z.
  404. * DONE is the number of eigenvectors already computed
  405. DONE = 0
  406. IBEGIN = 1
  407. WBEGIN = 1
  408. DO 170 JBLK = 1, IBLOCK( M )
  409. IEND = ISPLIT( JBLK )
  410. SIGMA = L( IEND )
  411. * Find the eigenvectors of the submatrix indexed IBEGIN
  412. * through IEND.
  413. WEND = WBEGIN - 1
  414. 15 CONTINUE
  415. IF( WEND.LT.M ) THEN
  416. IF( IBLOCK( WEND+1 ).EQ.JBLK ) THEN
  417. WEND = WEND + 1
  418. GO TO 15
  419. END IF
  420. END IF
  421. IF( WEND.LT.WBEGIN ) THEN
  422. IBEGIN = IEND + 1
  423. GO TO 170
  424. ELSEIF( (WEND.LT.DOL).OR.(WBEGIN.GT.DOU) ) THEN
  425. IBEGIN = IEND + 1
  426. WBEGIN = WEND + 1
  427. GO TO 170
  428. END IF
  429. * Find local spectral diameter of the block
  430. GL = GERS( 2*IBEGIN-1 )
  431. GU = GERS( 2*IBEGIN )
  432. DO 20 I = IBEGIN+1 , IEND
  433. GL = MIN( GERS( 2*I-1 ), GL )
  434. GU = MAX( GERS( 2*I ), GU )
  435. 20 CONTINUE
  436. SPDIAM = GU - GL
  437. * OLDIEN is the last index of the previous block
  438. OLDIEN = IBEGIN - 1
  439. * Calculate the size of the current block
  440. IN = IEND - IBEGIN + 1
  441. * The number of eigenvalues in the current block
  442. IM = WEND - WBEGIN + 1
  443. * This is for a 1x1 block
  444. IF( IBEGIN.EQ.IEND ) THEN
  445. DONE = DONE+1
  446. Z( IBEGIN, WBEGIN ) = DCMPLX( ONE, ZERO )
  447. ISUPPZ( 2*WBEGIN-1 ) = IBEGIN
  448. ISUPPZ( 2*WBEGIN ) = IBEGIN
  449. W( WBEGIN ) = W( WBEGIN ) + SIGMA
  450. WORK( WBEGIN ) = W( WBEGIN )
  451. IBEGIN = IEND + 1
  452. WBEGIN = WBEGIN + 1
  453. GO TO 170
  454. END IF
  455. * The desired (shifted) eigenvalues are stored in W(WBEGIN:WEND)
  456. * Note that these can be approximations, in this case, the corresp.
  457. * entries of WERR give the size of the uncertainty interval.
  458. * The eigenvalue approximations will be refined when necessary as
  459. * high relative accuracy is required for the computation of the
  460. * corresponding eigenvectors.
  461. CALL DCOPY( IM, W( WBEGIN ), 1,
  462. $ WORK( WBEGIN ), 1 )
  463. * We store in W the eigenvalue approximations w.r.t. the original
  464. * matrix T.
  465. DO 30 I=1,IM
  466. W(WBEGIN+I-1) = W(WBEGIN+I-1)+SIGMA
  467. 30 CONTINUE
  468. * NDEPTH is the current depth of the representation tree
  469. NDEPTH = 0
  470. * PARITY is either 1 or 0
  471. PARITY = 1
  472. * NCLUS is the number of clusters for the next level of the
  473. * representation tree, we start with NCLUS = 1 for the root
  474. NCLUS = 1
  475. IWORK( IINDC1+1 ) = 1
  476. IWORK( IINDC1+2 ) = IM
  477. * IDONE is the number of eigenvectors already computed in the current
  478. * block
  479. IDONE = 0
  480. * loop while( IDONE.LT.IM )
  481. * generate the representation tree for the current block and
  482. * compute the eigenvectors
  483. 40 CONTINUE
  484. IF( IDONE.LT.IM ) THEN
  485. * This is a crude protection against infinitely deep trees
  486. IF( NDEPTH.GT.M ) THEN
  487. INFO = -2
  488. RETURN
  489. ENDIF
  490. * breadth first processing of the current level of the representation
  491. * tree: OLDNCL = number of clusters on current level
  492. OLDNCL = NCLUS
  493. * reset NCLUS to count the number of child clusters
  494. NCLUS = 0
  495. *
  496. PARITY = 1 - PARITY
  497. IF( PARITY.EQ.0 ) THEN
  498. OLDCLS = IINDC1
  499. NEWCLS = IINDC2
  500. ELSE
  501. OLDCLS = IINDC2
  502. NEWCLS = IINDC1
  503. END IF
  504. * Process the clusters on the current level
  505. DO 150 I = 1, OLDNCL
  506. J = OLDCLS + 2*I
  507. * OLDFST, OLDLST = first, last index of current cluster.
  508. * cluster indices start with 1 and are relative
  509. * to WBEGIN when accessing W, WGAP, WERR, Z
  510. OLDFST = IWORK( J-1 )
  511. OLDLST = IWORK( J )
  512. IF( NDEPTH.GT.0 ) THEN
  513. * Retrieve relatively robust representation (RRR) of cluster
  514. * that has been computed at the previous level
  515. * The RRR is stored in Z and overwritten once the eigenvectors
  516. * have been computed or when the cluster is refined
  517. IF((DOL.EQ.1).AND.(DOU.EQ.M)) THEN
  518. * Get representation from location of the leftmost evalue
  519. * of the cluster
  520. J = WBEGIN + OLDFST - 1
  521. ELSE
  522. IF(WBEGIN+OLDFST-1.LT.DOL) THEN
  523. * Get representation from the left end of Z array
  524. J = DOL - 1
  525. ELSEIF(WBEGIN+OLDFST-1.GT.DOU) THEN
  526. * Get representation from the right end of Z array
  527. J = DOU
  528. ELSE
  529. J = WBEGIN + OLDFST - 1
  530. ENDIF
  531. ENDIF
  532. DO 45 K = 1, IN - 1
  533. D( IBEGIN+K-1 ) = DBLE( Z( IBEGIN+K-1,
  534. $ J ) )
  535. L( IBEGIN+K-1 ) = DBLE( Z( IBEGIN+K-1,
  536. $ J+1 ) )
  537. 45 CONTINUE
  538. D( IEND ) = DBLE( Z( IEND, J ) )
  539. SIGMA = DBLE( Z( IEND, J+1 ) )
  540. * Set the corresponding entries in Z to zero
  541. CALL ZLASET( 'Full', IN, 2, CZERO, CZERO,
  542. $ Z( IBEGIN, J), LDZ )
  543. END IF
  544. * Compute DL and DLL of current RRR
  545. DO 50 J = IBEGIN, IEND-1
  546. TMP = D( J )*L( J )
  547. WORK( INDLD-1+J ) = TMP
  548. WORK( INDLLD-1+J ) = TMP*L( J )
  549. 50 CONTINUE
  550. IF( NDEPTH.GT.0 ) THEN
  551. * P and Q are index of the first and last eigenvalue to compute
  552. * within the current block
  553. P = INDEXW( WBEGIN-1+OLDFST )
  554. Q = INDEXW( WBEGIN-1+OLDLST )
  555. * Offset for the arrays WORK, WGAP and WERR, i.e., the P-OFFSET
  556. * through the Q-OFFSET elements of these arrays are to be used.
  557. * OFFSET = P-OLDFST
  558. OFFSET = INDEXW( WBEGIN ) - 1
  559. * perform limited bisection (if necessary) to get approximate
  560. * eigenvalues to the precision needed.
  561. CALL DLARRB( IN, D( IBEGIN ),
  562. $ WORK(INDLLD+IBEGIN-1),
  563. $ P, Q, RTOL1, RTOL2, OFFSET,
  564. $ WORK(WBEGIN),WGAP(WBEGIN),WERR(WBEGIN),
  565. $ WORK( INDWRK ), IWORK( IINDWK ),
  566. $ PIVMIN, SPDIAM, IN, IINFO )
  567. IF( IINFO.NE.0 ) THEN
  568. INFO = -1
  569. RETURN
  570. ENDIF
  571. * We also recompute the extremal gaps. W holds all eigenvalues
  572. * of the unshifted matrix and must be used for computation
  573. * of WGAP, the entries of WORK might stem from RRRs with
  574. * different shifts. The gaps from WBEGIN-1+OLDFST to
  575. * WBEGIN-1+OLDLST are correctly computed in DLARRB.
  576. * However, we only allow the gaps to become greater since
  577. * this is what should happen when we decrease WERR
  578. IF( OLDFST.GT.1) THEN
  579. WGAP( WBEGIN+OLDFST-2 ) =
  580. $ MAX(WGAP(WBEGIN+OLDFST-2),
  581. $ W(WBEGIN+OLDFST-1)-WERR(WBEGIN+OLDFST-1)
  582. $ - W(WBEGIN+OLDFST-2)-WERR(WBEGIN+OLDFST-2) )
  583. ENDIF
  584. IF( WBEGIN + OLDLST -1 .LT. WEND ) THEN
  585. WGAP( WBEGIN+OLDLST-1 ) =
  586. $ MAX(WGAP(WBEGIN+OLDLST-1),
  587. $ W(WBEGIN+OLDLST)-WERR(WBEGIN+OLDLST)
  588. $ - W(WBEGIN+OLDLST-1)-WERR(WBEGIN+OLDLST-1) )
  589. ENDIF
  590. * Each time the eigenvalues in WORK get refined, we store
  591. * the newly found approximation with all shifts applied in W
  592. DO 53 J=OLDFST,OLDLST
  593. W(WBEGIN+J-1) = WORK(WBEGIN+J-1)+SIGMA
  594. 53 CONTINUE
  595. END IF
  596. * Process the current node.
  597. NEWFST = OLDFST
  598. DO 140 J = OLDFST, OLDLST
  599. IF( J.EQ.OLDLST ) THEN
  600. * we are at the right end of the cluster, this is also the
  601. * boundary of the child cluster
  602. NEWLST = J
  603. ELSE IF ( WGAP( WBEGIN + J -1).GE.
  604. $ MINRGP* ABS( WORK(WBEGIN + J -1) ) ) THEN
  605. * the right relative gap is big enough, the child cluster
  606. * (NEWFST,..,NEWLST) is well separated from the following
  607. NEWLST = J
  608. ELSE
  609. * inside a child cluster, the relative gap is not
  610. * big enough.
  611. GOTO 140
  612. END IF
  613. * Compute size of child cluster found
  614. NEWSIZ = NEWLST - NEWFST + 1
  615. * NEWFTT is the place in Z where the new RRR or the computed
  616. * eigenvector is to be stored
  617. IF((DOL.EQ.1).AND.(DOU.EQ.M)) THEN
  618. * Store representation at location of the leftmost evalue
  619. * of the cluster
  620. NEWFTT = WBEGIN + NEWFST - 1
  621. ELSE
  622. IF(WBEGIN+NEWFST-1.LT.DOL) THEN
  623. * Store representation at the left end of Z array
  624. NEWFTT = DOL - 1
  625. ELSEIF(WBEGIN+NEWFST-1.GT.DOU) THEN
  626. * Store representation at the right end of Z array
  627. NEWFTT = DOU
  628. ELSE
  629. NEWFTT = WBEGIN + NEWFST - 1
  630. ENDIF
  631. ENDIF
  632. IF( NEWSIZ.GT.1) THEN
  633. *
  634. * Current child is not a singleton but a cluster.
  635. * Compute and store new representation of child.
  636. *
  637. *
  638. * Compute left and right cluster gap.
  639. *
  640. * LGAP and RGAP are not computed from WORK because
  641. * the eigenvalue approximations may stem from RRRs
  642. * different shifts. However, W hold all eigenvalues
  643. * of the unshifted matrix. Still, the entries in WGAP
  644. * have to be computed from WORK since the entries
  645. * in W might be of the same order so that gaps are not
  646. * exhibited correctly for very close eigenvalues.
  647. IF( NEWFST.EQ.1 ) THEN
  648. LGAP = MAX( ZERO,
  649. $ W(WBEGIN)-WERR(WBEGIN) - VL )
  650. ELSE
  651. LGAP = WGAP( WBEGIN+NEWFST-2 )
  652. ENDIF
  653. RGAP = WGAP( WBEGIN+NEWLST-1 )
  654. *
  655. * Compute left- and rightmost eigenvalue of child
  656. * to high precision in order to shift as close
  657. * as possible and obtain as large relative gaps
  658. * as possible
  659. *
  660. DO 55 K =1,2
  661. IF(K.EQ.1) THEN
  662. P = INDEXW( WBEGIN-1+NEWFST )
  663. ELSE
  664. P = INDEXW( WBEGIN-1+NEWLST )
  665. ENDIF
  666. OFFSET = INDEXW( WBEGIN ) - 1
  667. CALL DLARRB( IN, D(IBEGIN),
  668. $ WORK( INDLLD+IBEGIN-1 ),P,P,
  669. $ RQTOL, RQTOL, OFFSET,
  670. $ WORK(WBEGIN),WGAP(WBEGIN),
  671. $ WERR(WBEGIN),WORK( INDWRK ),
  672. $ IWORK( IINDWK ), PIVMIN, SPDIAM,
  673. $ IN, IINFO )
  674. 55 CONTINUE
  675. *
  676. IF((WBEGIN+NEWLST-1.LT.DOL).OR.
  677. $ (WBEGIN+NEWFST-1.GT.DOU)) THEN
  678. * if the cluster contains no desired eigenvalues
  679. * skip the computation of that branch of the rep. tree
  680. *
  681. * We could skip before the refinement of the extremal
  682. * eigenvalues of the child, but then the representation
  683. * tree could be different from the one when nothing is
  684. * skipped. For this reason we skip at this place.
  685. IDONE = IDONE + NEWLST - NEWFST + 1
  686. GOTO 139
  687. ENDIF
  688. *
  689. * Compute RRR of child cluster.
  690. * Note that the new RRR is stored in Z
  691. *
  692. * DLARRF needs LWORK = 2*N
  693. CALL DLARRF( IN, D( IBEGIN ), L( IBEGIN ),
  694. $ WORK(INDLD+IBEGIN-1),
  695. $ NEWFST, NEWLST, WORK(WBEGIN),
  696. $ WGAP(WBEGIN), WERR(WBEGIN),
  697. $ SPDIAM, LGAP, RGAP, PIVMIN, TAU,
  698. $ WORK( INDIN1 ), WORK( INDIN2 ),
  699. $ WORK( INDWRK ), IINFO )
  700. * In the complex case, DLARRF cannot write
  701. * the new RRR directly into Z and needs an intermediate
  702. * workspace
  703. DO 56 K = 1, IN-1
  704. Z( IBEGIN+K-1, NEWFTT ) =
  705. $ DCMPLX( WORK( INDIN1+K-1 ), ZERO )
  706. Z( IBEGIN+K-1, NEWFTT+1 ) =
  707. $ DCMPLX( WORK( INDIN2+K-1 ), ZERO )
  708. 56 CONTINUE
  709. Z( IEND, NEWFTT ) =
  710. $ DCMPLX( WORK( INDIN1+IN-1 ), ZERO )
  711. IF( IINFO.EQ.0 ) THEN
  712. * a new RRR for the cluster was found by DLARRF
  713. * update shift and store it
  714. SSIGMA = SIGMA + TAU
  715. Z( IEND, NEWFTT+1 ) = DCMPLX( SSIGMA, ZERO )
  716. * WORK() are the midpoints and WERR() the semi-width
  717. * Note that the entries in W are unchanged.
  718. DO 116 K = NEWFST, NEWLST
  719. FUDGE =
  720. $ THREE*EPS*ABS(WORK(WBEGIN+K-1))
  721. WORK( WBEGIN + K - 1 ) =
  722. $ WORK( WBEGIN + K - 1) - TAU
  723. FUDGE = FUDGE +
  724. $ FOUR*EPS*ABS(WORK(WBEGIN+K-1))
  725. * Fudge errors
  726. WERR( WBEGIN + K - 1 ) =
  727. $ WERR( WBEGIN + K - 1 ) + FUDGE
  728. * Gaps are not fudged. Provided that WERR is small
  729. * when eigenvalues are close, a zero gap indicates
  730. * that a new representation is needed for resolving
  731. * the cluster. A fudge could lead to a wrong decision
  732. * of judging eigenvalues 'separated' which in
  733. * reality are not. This could have a negative impact
  734. * on the orthogonality of the computed eigenvectors.
  735. 116 CONTINUE
  736. NCLUS = NCLUS + 1
  737. K = NEWCLS + 2*NCLUS
  738. IWORK( K-1 ) = NEWFST
  739. IWORK( K ) = NEWLST
  740. ELSE
  741. INFO = -2
  742. RETURN
  743. ENDIF
  744. ELSE
  745. *
  746. * Compute eigenvector of singleton
  747. *
  748. ITER = 0
  749. *
  750. TOL = FOUR * LOG(DBLE(IN)) * EPS
  751. *
  752. K = NEWFST
  753. WINDEX = WBEGIN + K - 1
  754. WINDMN = MAX(WINDEX - 1,1)
  755. WINDPL = MIN(WINDEX + 1,M)
  756. LAMBDA = WORK( WINDEX )
  757. DONE = DONE + 1
  758. * Check if eigenvector computation is to be skipped
  759. IF((WINDEX.LT.DOL).OR.
  760. $ (WINDEX.GT.DOU)) THEN
  761. ESKIP = .TRUE.
  762. GOTO 125
  763. ELSE
  764. ESKIP = .FALSE.
  765. ENDIF
  766. LEFT = WORK( WINDEX ) - WERR( WINDEX )
  767. RIGHT = WORK( WINDEX ) + WERR( WINDEX )
  768. INDEIG = INDEXW( WINDEX )
  769. * Note that since we compute the eigenpairs for a child,
  770. * all eigenvalue approximations are w.r.t the same shift.
  771. * In this case, the entries in WORK should be used for
  772. * computing the gaps since they exhibit even very small
  773. * differences in the eigenvalues, as opposed to the
  774. * entries in W which might "look" the same.
  775. IF( K .EQ. 1) THEN
  776. * In the case RANGE='I' and with not much initial
  777. * accuracy in LAMBDA and VL, the formula
  778. * LGAP = MAX( ZERO, (SIGMA - VL) + LAMBDA )
  779. * can lead to an overestimation of the left gap and
  780. * thus to inadequately early RQI 'convergence'.
  781. * Prevent this by forcing a small left gap.
  782. LGAP = EPS*MAX(ABS(LEFT),ABS(RIGHT))
  783. ELSE
  784. LGAP = WGAP(WINDMN)
  785. ENDIF
  786. IF( K .EQ. IM) THEN
  787. * In the case RANGE='I' and with not much initial
  788. * accuracy in LAMBDA and VU, the formula
  789. * can lead to an overestimation of the right gap and
  790. * thus to inadequately early RQI 'convergence'.
  791. * Prevent this by forcing a small right gap.
  792. RGAP = EPS*MAX(ABS(LEFT),ABS(RIGHT))
  793. ELSE
  794. RGAP = WGAP(WINDEX)
  795. ENDIF
  796. GAP = MIN( LGAP, RGAP )
  797. IF(( K .EQ. 1).OR.(K .EQ. IM)) THEN
  798. * The eigenvector support can become wrong
  799. * because significant entries could be cut off due to a
  800. * large GAPTOL parameter in LAR1V. Prevent this.
  801. GAPTOL = ZERO
  802. ELSE
  803. GAPTOL = GAP * EPS
  804. ENDIF
  805. ISUPMN = IN
  806. ISUPMX = 1
  807. * Update WGAP so that it holds the minimum gap
  808. * to the left or the right. This is crucial in the
  809. * case where bisection is used to ensure that the
  810. * eigenvalue is refined up to the required precision.
  811. * The correct value is restored afterwards.
  812. SAVGAP = WGAP(WINDEX)
  813. WGAP(WINDEX) = GAP
  814. * We want to use the Rayleigh Quotient Correction
  815. * as often as possible since it converges quadratically
  816. * when we are close enough to the desired eigenvalue.
  817. * However, the Rayleigh Quotient can have the wrong sign
  818. * and lead us away from the desired eigenvalue. In this
  819. * case, the best we can do is to use bisection.
  820. USEDBS = .FALSE.
  821. USEDRQ = .FALSE.
  822. * Bisection is initially turned off unless it is forced
  823. NEEDBS = .NOT.TRYRQC
  824. 120 CONTINUE
  825. * Check if bisection should be used to refine eigenvalue
  826. IF(NEEDBS) THEN
  827. * Take the bisection as new iterate
  828. USEDBS = .TRUE.
  829. ITMP1 = IWORK( IINDR+WINDEX )
  830. OFFSET = INDEXW( WBEGIN ) - 1
  831. CALL DLARRB( IN, D(IBEGIN),
  832. $ WORK(INDLLD+IBEGIN-1),INDEIG,INDEIG,
  833. $ ZERO, TWO*EPS, OFFSET,
  834. $ WORK(WBEGIN),WGAP(WBEGIN),
  835. $ WERR(WBEGIN),WORK( INDWRK ),
  836. $ IWORK( IINDWK ), PIVMIN, SPDIAM,
  837. $ ITMP1, IINFO )
  838. IF( IINFO.NE.0 ) THEN
  839. INFO = -3
  840. RETURN
  841. ENDIF
  842. LAMBDA = WORK( WINDEX )
  843. * Reset twist index from inaccurate LAMBDA to
  844. * force computation of true MINGMA
  845. IWORK( IINDR+WINDEX ) = 0
  846. ENDIF
  847. * Given LAMBDA, compute the eigenvector.
  848. CALL ZLAR1V( IN, 1, IN, LAMBDA, D( IBEGIN ),
  849. $ L( IBEGIN ), WORK(INDLD+IBEGIN-1),
  850. $ WORK(INDLLD+IBEGIN-1),
  851. $ PIVMIN, GAPTOL, Z( IBEGIN, WINDEX ),
  852. $ .NOT.USEDBS, NEGCNT, ZTZ, MINGMA,
  853. $ IWORK( IINDR+WINDEX ), ISUPPZ( 2*WINDEX-1 ),
  854. $ NRMINV, RESID, RQCORR, WORK( INDWRK ) )
  855. IF(ITER .EQ. 0) THEN
  856. BSTRES = RESID
  857. BSTW = LAMBDA
  858. ELSEIF(RESID.LT.BSTRES) THEN
  859. BSTRES = RESID
  860. BSTW = LAMBDA
  861. ENDIF
  862. ISUPMN = MIN(ISUPMN,ISUPPZ( 2*WINDEX-1 ))
  863. ISUPMX = MAX(ISUPMX,ISUPPZ( 2*WINDEX ))
  864. ITER = ITER + 1
  865. * sin alpha <= |resid|/gap
  866. * Note that both the residual and the gap are
  867. * proportional to the matrix, so ||T|| doesn't play
  868. * a role in the quotient
  869. *
  870. * Convergence test for Rayleigh-Quotient iteration
  871. * (omitted when Bisection has been used)
  872. *
  873. IF( RESID.GT.TOL*GAP .AND. ABS( RQCORR ).GT.
  874. $ RQTOL*ABS( LAMBDA ) .AND. .NOT. USEDBS)
  875. $ THEN
  876. * We need to check that the RQCORR update doesn't
  877. * move the eigenvalue away from the desired one and
  878. * towards a neighbor. -> protection with bisection
  879. IF(INDEIG.LE.NEGCNT) THEN
  880. * The wanted eigenvalue lies to the left
  881. SGNDEF = -ONE
  882. ELSE
  883. * The wanted eigenvalue lies to the right
  884. SGNDEF = ONE
  885. ENDIF
  886. * We only use the RQCORR if it improves the
  887. * the iterate reasonably.
  888. IF( ( RQCORR*SGNDEF.GE.ZERO )
  889. $ .AND.( LAMBDA + RQCORR.LE. RIGHT)
  890. $ .AND.( LAMBDA + RQCORR.GE. LEFT)
  891. $ ) THEN
  892. USEDRQ = .TRUE.
  893. * Store new midpoint of bisection interval in WORK
  894. IF(SGNDEF.EQ.ONE) THEN
  895. * The current LAMBDA is on the left of the true
  896. * eigenvalue
  897. LEFT = LAMBDA
  898. * We prefer to assume that the error estimate
  899. * is correct. We could make the interval not
  900. * as a bracket but to be modified if the RQCORR
  901. * chooses to. In this case, the RIGHT side should
  902. * be modified as follows:
  903. * RIGHT = MAX(RIGHT, LAMBDA + RQCORR)
  904. ELSE
  905. * The current LAMBDA is on the right of the true
  906. * eigenvalue
  907. RIGHT = LAMBDA
  908. * See comment about assuming the error estimate is
  909. * correct above.
  910. * LEFT = MIN(LEFT, LAMBDA + RQCORR)
  911. ENDIF
  912. WORK( WINDEX ) =
  913. $ HALF * (RIGHT + LEFT)
  914. * Take RQCORR since it has the correct sign and
  915. * improves the iterate reasonably
  916. LAMBDA = LAMBDA + RQCORR
  917. * Update width of error interval
  918. WERR( WINDEX ) =
  919. $ HALF * (RIGHT-LEFT)
  920. ELSE
  921. NEEDBS = .TRUE.
  922. ENDIF
  923. IF(RIGHT-LEFT.LT.RQTOL*ABS(LAMBDA)) THEN
  924. * The eigenvalue is computed to bisection accuracy
  925. * compute eigenvector and stop
  926. USEDBS = .TRUE.
  927. GOTO 120
  928. ELSEIF( ITER.LT.MAXITR ) THEN
  929. GOTO 120
  930. ELSEIF( ITER.EQ.MAXITR ) THEN
  931. NEEDBS = .TRUE.
  932. GOTO 120
  933. ELSE
  934. INFO = 5
  935. RETURN
  936. END IF
  937. ELSE
  938. STP2II = .FALSE.
  939. IF(USEDRQ .AND. USEDBS .AND.
  940. $ BSTRES.LE.RESID) THEN
  941. LAMBDA = BSTW
  942. STP2II = .TRUE.
  943. ENDIF
  944. IF (STP2II) THEN
  945. * improve error angle by second step
  946. CALL ZLAR1V( IN, 1, IN, LAMBDA,
  947. $ D( IBEGIN ), L( IBEGIN ),
  948. $ WORK(INDLD+IBEGIN-1),
  949. $ WORK(INDLLD+IBEGIN-1),
  950. $ PIVMIN, GAPTOL, Z( IBEGIN, WINDEX ),
  951. $ .NOT.USEDBS, NEGCNT, ZTZ, MINGMA,
  952. $ IWORK( IINDR+WINDEX ),
  953. $ ISUPPZ( 2*WINDEX-1 ),
  954. $ NRMINV, RESID, RQCORR, WORK( INDWRK ) )
  955. ENDIF
  956. WORK( WINDEX ) = LAMBDA
  957. END IF
  958. *
  959. * Compute FP-vector support w.r.t. whole matrix
  960. *
  961. ISUPPZ( 2*WINDEX-1 ) = ISUPPZ( 2*WINDEX-1 )+OLDIEN
  962. ISUPPZ( 2*WINDEX ) = ISUPPZ( 2*WINDEX )+OLDIEN
  963. ZFROM = ISUPPZ( 2*WINDEX-1 )
  964. ZTO = ISUPPZ( 2*WINDEX )
  965. ISUPMN = ISUPMN + OLDIEN
  966. ISUPMX = ISUPMX + OLDIEN
  967. * Ensure vector is ok if support in the RQI has changed
  968. IF(ISUPMN.LT.ZFROM) THEN
  969. DO 122 II = ISUPMN,ZFROM-1
  970. Z( II, WINDEX ) = ZERO
  971. 122 CONTINUE
  972. ENDIF
  973. IF(ISUPMX.GT.ZTO) THEN
  974. DO 123 II = ZTO+1,ISUPMX
  975. Z( II, WINDEX ) = ZERO
  976. 123 CONTINUE
  977. ENDIF
  978. CALL ZDSCAL( ZTO-ZFROM+1, NRMINV,
  979. $ Z( ZFROM, WINDEX ), 1 )
  980. 125 CONTINUE
  981. * Update W
  982. W( WINDEX ) = LAMBDA+SIGMA
  983. * Recompute the gaps on the left and right
  984. * But only allow them to become larger and not
  985. * smaller (which can only happen through "bad"
  986. * cancellation and doesn't reflect the theory
  987. * where the initial gaps are underestimated due
  988. * to WERR being too crude.)
  989. IF(.NOT.ESKIP) THEN
  990. IF( K.GT.1) THEN
  991. WGAP( WINDMN ) = MAX( WGAP(WINDMN),
  992. $ W(WINDEX)-WERR(WINDEX)
  993. $ - W(WINDMN)-WERR(WINDMN) )
  994. ENDIF
  995. IF( WINDEX.LT.WEND ) THEN
  996. WGAP( WINDEX ) = MAX( SAVGAP,
  997. $ W( WINDPL )-WERR( WINDPL )
  998. $ - W( WINDEX )-WERR( WINDEX) )
  999. ENDIF
  1000. ENDIF
  1001. IDONE = IDONE + 1
  1002. ENDIF
  1003. * here ends the code for the current child
  1004. *
  1005. 139 CONTINUE
  1006. * Proceed to any remaining child nodes
  1007. NEWFST = J + 1
  1008. 140 CONTINUE
  1009. 150 CONTINUE
  1010. NDEPTH = NDEPTH + 1
  1011. GO TO 40
  1012. END IF
  1013. IBEGIN = IEND + 1
  1014. WBEGIN = WEND + 1
  1015. 170 CONTINUE
  1016. *
  1017. RETURN
  1018. *
  1019. * End of ZLARRV
  1020. *
  1021. END