200 SUBROUTINE sgbrfs( TRANS, N, KL, KU, NRHS, AB, LDAB, AFB,
202 $ IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK,
211 INTEGER INFO, KL, KU, LDAB, LDAFB, LDB, LDX, N, NRHS
214 INTEGER IPIV( * ), IWORK( * )
215 REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
216 $ BERR( * ), FERR( * ), WORK( * ), X( LDX, * )
223 PARAMETER ( ITMAX = 5 )
225 parameter( zero = 0.0e+0 )
227 parameter( one = 1.0e+0 )
229 parameter( two = 2.0e+0 )
231 parameter( three = 3.0e+0 )
236 INTEGER COUNT, I, J, K, KASE, KK, NZ
237 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
247 INTRINSIC abs, max, min
252 EXTERNAL LSAME, SLAMCH
259 notran = lsame( trans,
'N' )
260 IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
261 $ lsame( trans,
'C' ) )
THEN
263 ELSE IF( n.LT.0 )
THEN
265 ELSE IF( kl.LT.0 )
THEN
267 ELSE IF( ku.LT.0 )
THEN
269 ELSE IF( nrhs.LT.0 )
THEN
271 ELSE IF( ldab.LT.kl+ku+1 )
THEN
273 ELSE IF( ldafb.LT.2*kl+ku+1 )
THEN
275 ELSE IF( ldb.LT.max( 1, n ) )
THEN
277 ELSE IF( ldx.LT.max( 1, n ) )
THEN
281 CALL xerbla(
'SGBRFS', -info )
287 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
303 nz = min( kl+ku+2, n+1 )
304 eps = slamch(
'Epsilon' )
305 safmin = slamch(
'Safe minimum' )
306 safe1 = real( nz )*safmin
322 CALL scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
323 CALL sgbmv( trans, n, n, kl, ku, -one, ab, ldab, x( 1, j ),
325 $ one, work( n+1 ), 1 )
337 work( i ) = abs( b( i, j ) )
345 xk = abs( x( k, j ) )
346 DO 40 i = max( 1, k-ku ), min( n, k+kl )
347 work( i ) = work( i ) + abs( ab( kk+i, k ) )*xk
354 DO 60 i = max( 1, k-ku ), min( n, k+kl )
355 s = s + abs( ab( kk+i, k ) )*abs( x( i, j ) )
357 work( k ) = work( k ) + s
362 IF( work( i ).GT.safe2 )
THEN
363 s = max( s, abs( work( n+i ) ) / work( i ) )
365 s = max( s, ( abs( work( n+i ) )+safe1 ) /
366 $ ( work( i )+safe1 ) )
377 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
378 $ count.LE.itmax )
THEN
382 CALL sgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv,
383 $ work( n+1 ), n, info )
384 CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
413 IF( work( i ).GT.safe2 )
THEN
414 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
416 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
423 CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork,
431 CALL sgbtrs( transt, n, kl, ku, 1, afb, ldafb, ipiv,
432 $ work( n+1 ), n, info )
434 work( n+i ) = work( n+i )*work( i )
441 work( n+i ) = work( n+i )*work( i )
443 CALL sgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv,
444 $ work( n+1 ), n, info )
453 lstres = max( lstres, abs( x( i, j ) ) )
456 $ ferr( j ) = ferr( j ) / lstres
subroutine sgbrfs(trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, b, ldb, x, ldx, ferr, berr, work, iwork, info)
SGBRFS