186 SUBROUTINE ztbrfs( 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 DOUBLE PRECISION BERR( * ), FERR( * ), RWORK( * )
199 COMPLEX*16 AB( LDAB, * ), B( LDB, * ), WORK( * ),
206 DOUBLE PRECISION ZERO
207 parameter( zero = 0.0d+0 )
209 parameter( one = ( 1.0d+0, 0.0d+0 ) )
212 LOGICAL NOTRAN, NOUNIT, UPPER
213 CHARACTER TRANSN, TRANST
214 INTEGER I, J, K, KASE, NZ
215 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
225 INTRINSIC abs, dble, dimag, max, min
229 DOUBLE PRECISION DLAMCH
230 EXTERNAL lsame, dlamch
233 DOUBLE PRECISION CABS1
236 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( 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(
'ZTBRFS', -info )
274 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
293 eps = dlamch(
'Epsilon' )
294 safmin = dlamch(
'Safe minimum' )
305 CALL zcopy( n, x( 1, j ), 1, work, 1 )
306 CALL ztbmv( uplo, trans, diag, n, kd, ab, ldab, work, 1 )
307 CALL zaxpy( 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 zlacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
461 CALL ztbsv( uplo, transt, diag, n, kd, ab, ldab, work,
464 work( i ) = rwork( i )*work( i )
471 work( i ) = rwork( i )*work( i )
473 CALL ztbsv( 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 zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zlacn2(n, v, x, est, kase, isave)
ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
subroutine ztbmv(uplo, trans, diag, n, k, a, lda, x, incx)
ZTBMV
subroutine ztbrfs(uplo, trans, diag, n, kd, nrhs, ab, ldab, b, ldb, x, ldx, ferr, berr, work, rwork, info)
ZTBRFS
subroutine ztbsv(uplo, trans, diag, n, k, a, lda, x, incx)
ZTBSV