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.

dlarrv.f 43 kB

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