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

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