1 SUBROUTINE dlar1va(N, B1, BN, LAMBDA, D, L, LD, LLD,
2 $ PIVMIN, GAPTOL, Z, WANTNC, NEGCNT, ZTZ, MINGMA,
3 $ R, ISUPPZ, NRMINV, RESID, RQCORR, WORK )
13 INTEGER B1, BN, N, NEGCNT, R
14 DOUBLE PRECISION GAPTOL, LAMBDA, MINGMA, NRMINV, PIVMIN, RESID,
19 DOUBLE PRECISION D( * ), L( * ), LD( * ), LLD( * ),
21 DOUBLE PRECISION Z( * )
139 PARAMETER ( BLKLEN = 16 )
140 DOUBLE PRECISION ZERO, ONE
141 parameter( zero = 0.0d0, one = 1.0d0 )
145 LOGICAL SAWNAN1, SAWNAN2
146 INTEGER BI, I, INDLPL, INDP, INDS, INDUMN, NB, NEG1,
147 $ neg2, nx, r1, r2, to
148 DOUBLE PRECISION ABSZCUR, ABSZPREV, DMINUS, DPLUS, EPS,
153 DOUBLE PRECISION DLAMCH
154 EXTERNAL disnan, dlamch
157 INTRINSIC abs,
max,
min, dble
161 eps = dlamch(
'Precision' )
182 work( inds+b1-1 ) = lld( b1-1 )
191 s = work( inds+b1-1 ) - lambda
194 work( indlpl+i ) = ld( i ) / dplus
195 IF(dplus.LT.zero) neg1 = neg1 + 1
196 work( inds+i ) = s*work( indlpl+i )*l( i )
197 s = work( inds+i ) - lambda
199 sawnan1 = disnan( s )
200 IF( sawnan1 )
GOTO 60
203 work( indlpl+i ) = ld( i ) / dplus
204 work( inds+i ) = s*work( indlpl+i )*l( i )
205 s = work( inds+i ) - lambda
207 sawnan1 = disnan( s )
213 s = work( inds+b1-1 ) - lambda
216 IF(abs(dplus).LT.pivmin) dplus = -pivmin
217 work( indlpl+i ) = ld( i ) / dplus
218 IF(dplus.LT.zero) neg1 = neg1 + 1
219 work( inds+i ) = s*work( indlpl+i )*l( i )
220 IF( work( indlpl+i ).EQ.zero )
221 $ work( inds+i ) = lld( i )
222 s = work( inds+i ) - lambda
226 IF(abs(dplus).LT.pivmin) dplus = -pivmin
227 work( indlpl+i ) = ld( i ) / dplus
228 work( inds+i ) = s*work( indlpl+i )*l( i )
229 IF( work( indlpl+i ).EQ.zero )
230 $ work( inds+i ) = lld( i )
231 s = work( inds+i ) - lambda
240 work( indp+bn-1 ) = d( bn ) - lambda
241 DO 80 i = bn - 1, r1, -1
242 dminus = lld( i ) + work( indp+i )
243 tmp = d( i ) / dminus
244 IF(dminus.LT.zero) neg2 = neg2 + 1
245 work( indumn+i ) = l( i )*tmp
246 work( indp+i-1 ) = work( indp+i )*tmp - lambda
248 tmp = work( indp+r1-1 )
249 sawnan2 = disnan( tmp )
253 DO 100 i = bn-1, r1, -1
254 dminus = lld( i ) + work( indp+i )
255 IF(abs(dminus).LT.pivmin) dminus = -pivmin
256 tmp = d( i ) / dminus
257 IF(dminus.LT.zero) neg2 = neg2 + 1
258 work( indumn+i ) = l( i )*tmp
259 work( indp+i-1 ) = work( indp+i )*tmp - lambda
261 $ work( indp+i-1 ) = d( i ) - lambda
268 mingma = work( inds+r1-1 ) + work( indp+r1-1 )
269 IF( mingma.LT.zero ) neg1 = neg1 + 1
275 IF( abs(mingma).EQ.zero )
276 $ mingma = eps*work( inds+r1-1 )
278 DO 110 i = r1, r2 - 1
279 tmp = work( inds+i ) + work( indp+i )
281 $ tmp = eps*work( inds+i )
282 IF( abs( tmp ).LE.abs( mingma ) )
THEN
297 nb = int((r-b1)/blklen)
299 IF( .NOT.sawnan1 )
THEN
300 DO 210 bi = r-1, nx, -blklen
302 DO 205 i = bi, to, -1
303 z( i ) = -( work(indlpl+i)*z(i+1) )
304 ztz = ztz + z( i )*z( i )
306 IF( abs(z(to)).LT.eps .AND.
307 $ abs(z(to+1)).LT.eps )
THEN
312 DO 215 i = nx-1, b1, -1
313 z( i ) = -( work(indlpl+i)*z(i+1) )
314 ztz = ztz + z( i )*z( i )
319 DO 230 bi = r-1, nx, -blklen
321 DO 225 i = bi, to, -1
322 IF( z( i+1 ).EQ.zero )
THEN
323 z( i ) = -( ld( i+1 ) / ld( i ) )*z( i+2 )
325 z( i ) = -( work( indlpl+i )*z( i+1 ) )
327 ztz = ztz + z( i )*z( i )
329 IF( abs(z(to)).LT.eps .AND.
330 $ abs(z(to+1)).LT.eps )
THEN
335 DO 235 i = nx-1, b1, -1
336 IF( z( i+1 ).EQ.zero )
THEN
337 z( i ) = -( ld( i+1 ) / ld( i ) )*z( i+2 )
339 z( i ) = -( work( indlpl+i )*z( i+1 ) )
341 ztz = ztz + z( i )*z( i )
345 DO 245 i= b1, (isuppz(1)-1)
350 IF( .NOT.sawnan2 )
THEN
351 DO 260 bi = r+1, bn, blklen
355 z(i) = -(work(indumn+i-1)*z(i-1))
356 ztz = ztz + z( i )*z( i )
358 IF( abs(z(to)).LE.eps .AND.
359 $ abs(z(to-1)).LE.eps )
THEN
365 z(i) = -(work(indumn+i-1)*z(i-1))
366 ztz = ztz + z( i )*z( i )
373 DO 280 bi = r+1, bn, blklen
378 abszprev = abs(zprev)
379 IF( zprev.NE.zero )
THEN
380 z(i)= -(work(indumn+i-1)*zprev)
382 z(i)= -(ld(i-2)/ld(i-1))*z(i-2)
385 ztz = ztz + abszcur**2
387 IF( abszcur.LT.eps .AND.
388 $ abszprev.LT.eps )
THEN
395 abszprev = abs(zprev)
396 IF( zprev.NE.zero )
THEN
397 z(i)= -(work(indumn+i-1)*zprev)
399 z(i)= -(ld(i-2)/ld(i-1))*z(i-2)
402 ztz = ztz + abszcur**2
408 DO 290 i= isuppz(2)+1,bn
416 resid = abs( mingma )*nrminv