185 SUBROUTINE spbrfs( UPLO, N, KD, NRHS, AB, LDAB, AFB, LDAFB, B,
186 $ LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO )
194 INTEGER INFO, KD, LDAB, LDAFB, LDB, LDX, N, NRHS
198 REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
199 $ berr( * ), ferr( * ), work( * ), x( ldx, * )
206 parameter( itmax = 5 )
208 parameter( zero = 0.0e+0 )
210 parameter( one = 1.0e+0 )
212 parameter( two = 2.0e+0 )
214 parameter( three = 3.0e+0 )
218 INTEGER COUNT, I, J, K, KASE, L, NZ
219 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
229 INTRINSIC abs, max, min
234 EXTERNAL lsame, slamch
241 upper = lsame( uplo,
'U' )
242 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
244 ELSE IF( n.LT.0 )
THEN
246 ELSE IF( kd.LT.0 )
THEN
248 ELSE IF( nrhs.LT.0 )
THEN
250 ELSE IF( ldab.LT.kd+1 )
THEN
252 ELSE IF( ldafb.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(
'SPBRFS', -info )
266 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
276 nz = min( n+1, 2*kd+2 )
277 eps = slamch(
'Epsilon' )
278 safmin = slamch(
'Safe minimum' )
279 safe1 = real( nz )*safmin
294 CALL scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
295 CALL ssbmv( uplo, n, kd, -one, ab, ldab, x( 1, j ), 1, one,
308 work( i ) = abs( b( i, j ) )
316 xk = abs( x( k, j ) )
318 DO 40 i = max( 1, k-kd ), k - 1
319 work( i ) = work( i ) + abs( ab( l+i, k ) )*xk
320 s = s + abs( ab( l+i, k ) )*abs( x( i, j ) )
322 work( k ) = work( k ) + abs( ab( kd+1, k ) )*xk + s
327 xk = abs( x( k, j ) )
328 work( k ) = work( k ) + abs( ab( 1, k ) )*xk
330 DO 60 i = k + 1, min( n, k+kd )
331 work( i ) = work( i ) + abs( ab( l+i, k ) )*xk
332 s = s + abs( ab( l+i, k ) )*abs( x( i, j ) )
334 work( k ) = work( k ) + s
339 IF( work( i ).GT.safe2 )
THEN
340 s = max( s, abs( work( n+i ) ) / work( i ) )
342 s = max( s, ( abs( work( n+i ) )+safe1 ) /
343 $ ( work( i )+safe1 ) )
354 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
355 $ count.LE.itmax )
THEN
359 CALL spbtrs( uplo, n, kd, 1, afb, ldafb, work( n+1 ), n,
361 CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
390 IF( work( i ).GT.safe2 )
THEN
391 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
393 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
400 CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork,
408 CALL spbtrs( uplo, n, kd, 1, afb, ldafb, work( n+1 ),
412 work( n+i ) = work( n+i )*work( i )
414 ELSE IF( kase.EQ.2 )
THEN
419 work( n+i ) = work( n+i )*work( i )
421 CALL spbtrs( uplo, n, kd, 1, afb, ldafb, work( n+1 ),
432 lstres = max( lstres, abs( x( i, j ) ) )
435 $ ferr( j ) = ferr( j ) / lstres