184 SUBROUTINE dtbrfs( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, B,
185 $ LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO )
192 CHARACTER DIAG, TRANS, UPLO
193 INTEGER INFO, KD, LDAB, LDB, LDX, N, NRHS
197 DOUBLE PRECISION AB( LDAB, * ), B( LDB, * ), BERR( * ),
198 $ ferr( * ), work( * ), x( ldx, * )
204 DOUBLE PRECISION ZERO
205 parameter( zero = 0.0d+0 )
207 parameter( one = 1.0d+0 )
210 LOGICAL NOTRAN, NOUNIT, UPPER
212 INTEGER I, J, K, KASE, NZ
213 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
223 INTRINSIC abs, max, min
227 DOUBLE PRECISION DLAMCH
228 EXTERNAL lsame, dlamch
235 upper = lsame( uplo,
'U' )
236 notran = lsame( trans,
'N' )
237 nounit = lsame( diag,
'N' )
239 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
241 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
242 $ lsame( trans,
'C' ) )
THEN
244 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
246 ELSE IF( n.LT.0 )
THEN
248 ELSE IF( kd.LT.0 )
THEN
250 ELSE IF( nrhs.LT.0 )
THEN
252 ELSE IF( ldab.LT.kd+1 )
THEN
254 ELSE IF( ldb.LT.max( 1, n ) )
THEN
256 ELSE IF( ldx.LT.max( 1, n ) )
THEN
260 CALL xerbla(
'DTBRFS', -info )
266 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
283 eps = dlamch(
'Epsilon' )
284 safmin = dlamch(
'Safe minimum' )
295 CALL dcopy( n, x( 1, j ), 1, work( n+1 ), 1 )
296 CALL dtbmv( uplo, trans, diag, n, kd, ab, ldab, work( n+1 ),
298 CALL daxpy( n, -one, b( 1, j ), 1, work( n+1 ), 1 )
310 work( i ) = abs( b( i, j ) )
320 xk = abs( x( k, j ) )
321 DO 30 i = max( 1, k-kd ), k
322 work( i ) = work( i ) +
323 $ abs( ab( kd+1+i-k, k ) )*xk
328 xk = abs( x( k, j ) )
329 DO 50 i = max( 1, k-kd ), k - 1
330 work( i ) = work( i ) +
331 $ abs( ab( kd+1+i-k, k ) )*xk
333 work( k ) = work( k ) + xk
339 xk = abs( x( k, j ) )
340 DO 70 i = k, min( n, k+kd )
341 work( i ) = work( i ) + abs( ab( 1+i-k, k ) )*xk
346 xk = abs( x( k, j ) )
347 DO 90 i = k + 1, min( n, k+kd )
348 work( i ) = work( i ) + abs( ab( 1+i-k, k ) )*xk
350 work( k ) = work( k ) + xk
362 DO 110 i = max( 1, k-kd ), k
363 s = s + abs( ab( kd+1+i-k, k ) )*
366 work( k ) = work( k ) + s
371 DO 130 i = max( 1, k-kd ), k - 1
372 s = s + abs( ab( kd+1+i-k, k ) )*
375 work( k ) = work( k ) + s
382 DO 150 i = k, min( n, k+kd )
383 s = s + abs( ab( 1+i-k, k ) )*abs( x( i, j ) )
385 work( k ) = work( k ) + s
390 DO 170 i = k + 1, min( n, k+kd )
391 s = s + abs( ab( 1+i-k, k ) )*abs( x( i, j ) )
393 work( k ) = work( k ) + s
400 IF( work( i ).GT.safe2 )
THEN
401 s = max( s, abs( work( n+i ) ) / work( i ) )
403 s = max( s, ( abs( work( n+i ) )+safe1 ) /
404 $ ( work( i )+safe1 ) )
432 IF( work( i ).GT.safe2 )
THEN
433 work( i ) = abs( work( n+i ) ) + nz*eps*work( i )
435 work( i ) = abs( work( n+i ) ) + nz*eps*work( i ) + safe1
441 CALL dlacn2( n, work( 2*n+1 ), work( n+1 ), iwork,
449 CALL dtbsv( uplo, transt, diag, n, kd, ab, ldab,
452 work( n+i ) = work( i )*work( n+i )
459 work( n+i ) = work( i )*work( n+i )
461 CALL dtbsv( uplo, trans, diag, n, kd, ab, ldab,
471 lstres = max( lstres, abs( x( i, j ) ) )
474 $ ferr( j ) = ferr( j ) / lstres