184 SUBROUTINE stbrfs( 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 REAL AB( LDAB, * ), B( LDB, * ), BERR( * ),
198 $ ferr( * ), work( * ), x( ldx, * )
205 parameter( zero = 0.0e+0 )
207 parameter( one = 1.0e+0 )
210 LOGICAL NOTRAN, NOUNIT, UPPER
212 INTEGER I, J, K, KASE, NZ
213 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
223 INTRINSIC abs, max, min
228 EXTERNAL lsame, slamch
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(
'STBRFS', -info )
266 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
283 eps = slamch(
'Epsilon' )
284 safmin = slamch(
'Safe minimum' )
285 safe1 = real( nz )*safmin
295 CALL scopy( n, x( 1, j ), 1, work( n+1 ), 1 )
296 CALL stbmv( uplo, trans, diag, n, kd, ab, ldab, work( n+1 ),
298 CALL saxpy( 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 ) ) + real( nz )*eps*work( i )
435 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
442 CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork,
450 CALL stbsv( uplo, transt, diag, n, kd, ab, ldab,
453 work( n+i ) = work( i )*work( n+i )
460 work( n+i ) = work( i )*work( n+i )
462 CALL stbsv( uplo, trans, diag, n, kd, ab, ldab,
472 lstres = max( lstres, abs( x( i, j ) ) )
475 $ ferr( j ) = ferr( j ) / lstres