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.

clarrv.f 44 kB

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