186 SUBROUTINE ctbrfs( UPLO, TRANS, DIAG, N, KD, NRHS, AB, LDAB, B,
187 $ LDB, X, LDX, FERR, BERR, WORK, RWORK, INFO )
194 CHARACTER DIAG, TRANS, UPLO
195 INTEGER INFO, KD, LDAB, LDB, LDX, N, NRHS
198 REAL BERR( * ), FERR( * ), RWORK( * )
199 COMPLEX AB( LDAB, * ), B( LDB, * ), WORK( * ),
207 parameter( zero = 0.0e+0 )
209 parameter( one = ( 1.0e+0, 0.0e+0 ) )
212 LOGICAL NOTRAN, NOUNIT, UPPER
213 CHARACTER TRANSN, TRANST
214 INTEGER I, J, K, KASE, NZ
215 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
225 INTRINSIC abs, aimag, max, min, real
230 EXTERNAL lsame, slamch
236 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
243 upper = lsame( uplo,
'U' )
244 notran = lsame( trans,
'N' )
245 nounit = lsame( diag,
'N' )
247 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
249 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
250 $ lsame( trans,
'C' ) )
THEN
252 ELSE IF( .NOT.nounit .AND. .NOT.lsame( diag,
'U' ) )
THEN
254 ELSE IF( n.LT.0 )
THEN
256 ELSE IF( kd.LT.0 )
THEN
258 ELSE IF( nrhs.LT.0 )
THEN
260 ELSE IF( ldab.LT.kd+1 )
THEN
262 ELSE IF( ldb.LT.max( 1, n ) )
THEN
264 ELSE IF( ldx.LT.max( 1, n ) )
THEN
268 CALL xerbla(
'CTBRFS', -info )
274 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
293 eps = slamch(
'Epsilon' )
294 safmin = slamch(
'Safe minimum' )
305 CALL ccopy( n, x( 1, j ), 1, work, 1 )
306 CALL ctbmv( uplo, trans, diag, n, kd, ab, ldab, work, 1 )
307 CALL caxpy( n, -one, b( 1, j ), 1, work, 1 )
319 rwork( i ) = cabs1( b( i, j ) )
329 xk = cabs1( x( k, j ) )
330 DO 30 i = max( 1, k-kd ), k
331 rwork( i ) = rwork( i ) +
332 $ cabs1( ab( kd+1+i-k, k ) )*xk
337 xk = cabs1( x( k, j ) )
338 DO 50 i = max( 1, k-kd ), k - 1
339 rwork( i ) = rwork( i ) +
340 $ cabs1( ab( kd+1+i-k, k ) )*xk
342 rwork( k ) = rwork( k ) + xk
348 xk = cabs1( x( k, j ) )
349 DO 70 i = k, min( n, k+kd )
350 rwork( i ) = rwork( i ) +
351 $ cabs1( ab( 1+i-k, k ) )*xk
356 xk = cabs1( x( k, j ) )
357 DO 90 i = k + 1, min( n, k+kd )
358 rwork( i ) = rwork( i ) +
359 $ cabs1( ab( 1+i-k, k ) )*xk
361 rwork( k ) = rwork( k ) + xk
373 DO 110 i = max( 1, k-kd ), k
374 s = s + cabs1( ab( kd+1+i-k, k ) )*
377 rwork( k ) = rwork( k ) + s
381 s = cabs1( x( k, j ) )
382 DO 130 i = max( 1, k-kd ), k - 1
383 s = s + cabs1( ab( kd+1+i-k, k ) )*
386 rwork( k ) = rwork( k ) + s
393 DO 150 i = k, min( n, k+kd )
394 s = s + cabs1( ab( 1+i-k, k ) )*
397 rwork( k ) = rwork( k ) + s
401 s = cabs1( x( k, j ) )
402 DO 170 i = k + 1, min( n, k+kd )
403 s = s + cabs1( ab( 1+i-k, k ) )*
406 rwork( k ) = rwork( k ) + s
413 IF( rwork( i ).GT.safe2 )
THEN
414 s = max( s, cabs1( work( i ) ) / rwork( i ) )
416 s = max( s, ( cabs1( work( i ) )+safe1 ) /
417 $ ( rwork( i )+safe1 ) )
445 IF( rwork( i ).GT.safe2 )
THEN
446 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
448 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
455 CALL clacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
461 CALL ctbsv( uplo, transt, diag, n, kd, ab, ldab, work,
464 work( i ) = rwork( i )*work( i )
471 work( i ) = rwork( i )*work( i )
473 CALL ctbsv( uplo, transn, diag, n, kd, ab, ldab, work,
483 lstres = max( lstres, cabs1( x( i, j ) ) )
486 $ 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 clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
subroutine ctbmv(uplo, trans, diag, n, k, a, lda, x, incx)
CTBMV
subroutine ctbrfs(uplo, trans, diag, n, kd, nrhs, ab, ldab, b, ldb, x, ldx, ferr, berr, work, rwork, info)
CTBRFS
subroutine ctbsv(uplo, trans, diag, n, k, a, lda, x, incx)
CTBSV