203 SUBROUTINE cgbrfs( TRANS, N, KL, KU, NRHS, AB, LDAB, AFB, LDAFB,
204 $ IPIV, B, LDB, X, LDX, FERR, BERR, WORK, RWORK,
213 INTEGER INFO, KL, KU, LDAB, LDAFB, LDB, LDX, N, NRHS
217 REAL BERR( * ), FERR( * ), RWORK( * )
218 COMPLEX AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
219 $ work( * ), x( ldx, * )
226 PARAMETER ( ITMAX = 5 )
228 parameter( zero = 0.0e+0 )
230 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
232 parameter( two = 2.0e+0 )
234 parameter( three = 3.0e+0 )
238 CHARACTER TRANSN, TRANST
239 INTEGER COUNT, I, J, K, KASE, KK, NZ
240 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
250 INTRINSIC abs, aimag, max, min, real
255 EXTERNAL lsame, slamch
261 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
268 notran = lsame( trans,
'N' )
269 IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
270 $ lsame( trans,
'C' ) )
THEN
272 ELSE IF( n.LT.0 )
THEN
274 ELSE IF( kl.LT.0 )
THEN
276 ELSE IF( ku.LT.0 )
THEN
278 ELSE IF( nrhs.LT.0 )
THEN
280 ELSE IF( ldab.LT.kl+ku+1 )
THEN
282 ELSE IF( ldafb.LT.2*kl+ku+1 )
THEN
284 ELSE IF( ldb.LT.max( 1, n ) )
THEN
286 ELSE IF( ldx.LT.max( 1, n ) )
THEN
290 CALL xerbla(
'CGBRFS', -info )
296 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
314 nz = min( kl+ku+2, n+1 )
315 eps = slamch(
'Epsilon' )
316 safmin = slamch(
'Safe minimum' )
333 CALL ccopy( n, b( 1, j ), 1, work, 1 )
334 CALL cgbmv( trans, n, n, kl, ku, -cone, ab, ldab, x( 1, j ), 1,
347 rwork( i ) = cabs1( b( i, j ) )
355 xk = cabs1( x( k, j ) )
356 DO 40 i = max( 1, k-ku ), min( n, k+kl )
357 rwork( i ) = rwork( i ) + cabs1( ab( kk+i, k ) )*xk
364 DO 60 i = max( 1, k-ku ), min( n, k+kl )
365 s = s + cabs1( ab( kk+i, k ) )*cabs1( x( i, j ) )
367 rwork( k ) = rwork( k ) + s
372 IF( rwork( i ).GT.safe2 )
THEN
373 s = max( s, cabs1( work( i ) ) / rwork( i ) )
375 s = max( s, ( cabs1( work( i ) )+safe1 ) /
376 $ ( rwork( i )+safe1 ) )
387 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
388 $ count.LE.itmax )
THEN
392 CALL cgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv, work, n,
394 CALL caxpy( n, cone, work, 1, x( 1, j ), 1 )
423 IF( rwork( i ).GT.safe2 )
THEN
424 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
426 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
433 CALL clacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
439 CALL cgbtrs( transt, n, kl, ku, 1, afb, ldafb, ipiv,
442 work( i ) = rwork( i )*work( i )
449 work( i ) = rwork( i )*work( i )
451 CALL cgbtrs( transn, n, kl, ku, 1, afb, ldafb, ipiv,
461 lstres = max( lstres, cabs1( x( i, j ) ) )
464 $ ferr( j ) = ferr( j ) / lstres
subroutine xerbla(srname, info)
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgbmv(trans, m, n, kl, ku, alpha, a, lda, x, incx, beta, y, incy)
CGBMV
subroutine cgbrfs(trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
CGBRFS
subroutine cgbtrs(trans, n, kl, ku, nrhs, ab, ldab, ipiv, b, ldb, info)
CGBTRS
subroutine clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...