204 SUBROUTINE sgtrfs( TRANS, N, NRHS, DL, D, DU, DLF, DF, DUF,
206 $ IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK,
215 INTEGER INFO, LDB, LDX, N, NRHS
218 INTEGER IPIV( * ), IWORK( * )
219 REAL B( LDB, * ), BERR( * ), D( * ), DF( * ),
220 $ DL( * ), DLF( * ), DU( * ), DU2( * ), DUF( * ),
221 $ ferr( * ), work( * ), x( ldx, * )
228 PARAMETER ( ITMAX = 5 )
230 parameter( zero = 0.0e+0, one = 1.0e+0 )
232 parameter( two = 2.0e+0 )
234 parameter( three = 3.0e+0 )
238 CHARACTER TRANSN, TRANST
239 INTEGER COUNT, I, J, KASE, NZ
240 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN
255 EXTERNAL LSAME, SLAMCH
262 notran = lsame( trans,
'N' )
263 IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
264 $ lsame( trans,
'C' ) )
THEN
266 ELSE IF( n.LT.0 )
THEN
268 ELSE IF( nrhs.LT.0 )
THEN
270 ELSE IF( ldb.LT.max( 1, n ) )
THEN
272 ELSE IF( ldx.LT.max( 1, n ) )
THEN
276 CALL xerbla(
'SGTRFS', -info )
282 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
301 eps = slamch(
'Epsilon' )
302 safmin = slamch(
'Safe minimum' )
303 safe1 = real( nz )*safmin
319 CALL scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
320 CALL slagtm( trans, n, 1, -one, dl, d, du, x( 1, j ), ldx,
329 work( 1 ) = abs( b( 1, j ) ) + abs( d( 1 )*x( 1, j ) )
331 work( 1 ) = abs( b( 1, j ) ) + abs( d( 1 )*x( 1, j ) ) +
332 $ abs( du( 1 )*x( 2, j ) )
334 work( i ) = abs( b( i, j ) ) +
335 $ abs( dl( i-1 )*x( i-1, j ) ) +
336 $ abs( d( i )*x( i, j ) ) +
337 $ abs( du( i )*x( i+1, j ) )
339 work( n ) = abs( b( n, j ) ) +
340 $ abs( dl( n-1 )*x( n-1, j ) ) +
341 $ abs( d( n )*x( n, j ) )
345 work( 1 ) = abs( b( 1, j ) ) + abs( d( 1 )*x( 1, j ) )
347 work( 1 ) = abs( b( 1, j ) ) + abs( d( 1 )*x( 1, j ) ) +
348 $ abs( dl( 1 )*x( 2, j ) )
350 work( i ) = abs( b( i, j ) ) +
351 $ abs( du( i-1 )*x( i-1, j ) ) +
352 $ abs( d( i )*x( i, j ) ) +
353 $ abs( dl( i )*x( i+1, j ) )
355 work( n ) = abs( b( n, j ) ) +
356 $ abs( du( n-1 )*x( n-1, j ) ) +
357 $ abs( d( n )*x( n, j ) )
372 IF( work( i ).GT.safe2 )
THEN
373 s = max( s, abs( work( n+i ) ) / work( i ) )
375 s = max( s, ( abs( work( n+i ) )+safe1 ) /
376 $ ( work( i )+safe1 ) )
387 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
388 $ count.LE.itmax )
THEN
392 CALL sgttrs( trans, n, 1, dlf, df, duf, du2, ipiv,
393 $ work( n+1 ), n, info )
394 CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
423 IF( work( i ).GT.safe2 )
THEN
424 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
426 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
433 CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork,
441 CALL sgttrs( transt, n, 1, dlf, df, duf, du2, ipiv,
442 $ work( n+1 ), n, info )
444 work( n+i ) = work( i )*work( n+i )
451 work( n+i ) = work( i )*work( n+i )
453 CALL sgttrs( transn, n, 1, dlf, df, duf, du2, ipiv,
454 $ work( n+1 ), n, info )
463 lstres = max( lstres, abs( x( i, j ) ) )
466 $ ferr( j ) = ferr( j ) / lstres
subroutine sgtrfs(trans, n, nrhs, dl, d, du, dlf, df, duf, du2, ipiv, b, ldb, x, ldx, ferr, berr, work, iwork, info)
SGTRFS