163 SUBROUTINE dptrfs( N, NRHS, D, E, DF, EF, B, LDB, X, LDX, FERR,
172 INTEGER info, ldb, ldx, n, nrhs
175 DOUBLE PRECISION b( ldb, * ), berr( * ), d( * ), df( * ),
176 $ e( * ), ef( * ), ferr( * ), work( * ),
184 parameter( itmax = 5 )
185 DOUBLE PRECISION zero
186 parameter( zero = 0.0d+0 )
188 parameter( one = 1.0d+0 )
190 parameter( two = 2.0d+0 )
191 DOUBLE PRECISION three
192 parameter( three = 3.0d+0 )
195 INTEGER count, i, ix, j, nz
196 DOUBLE PRECISION bi, cx, dx, eps, ex, lstres, s, safe1, safe2,
217 ELSE IF( nrhs.LT.0 )
THEN
219 ELSE IF( ldb.LT.max( 1, n ) )
THEN
221 ELSE IF( ldx.LT.max( 1, n ) )
THEN
225 CALL
xerbla(
'DPTRFS', -info )
231 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
243 safmin =
dlamch(
'Safe minimum' )
262 dx = d( 1 )*x( 1, j )
263 work( n+1 ) = bi - dx
264 work( 1 ) = abs( bi ) + abs( dx )
267 dx = d( 1 )*x( 1, j )
268 ex = e( 1 )*x( 2, j )
269 work( n+1 ) = bi - dx - ex
270 work( 1 ) = abs( bi ) + abs( dx ) + abs( ex )
273 cx = e( i-1 )*x( i-1, j )
274 dx = d( i )*x( i, j )
275 ex = e( i )*x( i+1, j )
276 work( n+i ) = bi - cx - dx - ex
277 work( i ) = abs( bi ) + abs( cx ) + abs( dx ) + abs( ex )
280 cx = e( n-1 )*x( n-1, j )
281 dx = d( n )*x( n, j )
282 work( n+n ) = bi - cx - dx
283 work( n ) = abs( bi ) + abs( cx ) + abs( dx )
297 IF( work( i ).GT.safe2 )
THEN
298 s = max( s, abs( work( n+i ) ) / work( i ) )
300 s = max( s, ( abs( work( n+i ) )+safe1 ) /
301 $ ( work( i )+safe1 ) )
312 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
313 $ count.LE.itmax )
THEN
317 CALL
dpttrs( n, 1, df, ef, work( n+1 ), n, info )
318 CALL
daxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
343 IF( work( i ).GT.safe2 )
THEN
344 work( i ) = abs( work( n+i ) ) + nz*eps*work( i )
346 work( i ) = abs( work( n+i ) ) + nz*eps*work( i ) + safe1
350 ferr( j ) = work( ix )
365 work( i ) = one + work( i-1 )*abs( ef( i-1 ) )
370 work( n ) = work( n ) / df( n )
371 DO 70 i = n - 1, 1, -1
372 work( i ) = work( i ) / df( i ) + work( i+1 )*abs( ef( i ) )
378 ferr( j ) = ferr( j )*abs( work( ix ) )
384 lstres = max( lstres, abs( x( i, j ) ) )
387 $ ferr( j ) = ferr( j ) / lstres