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

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