182 SUBROUTINE zgerfs( TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, B,
184 $ X, LDX, FERR, BERR, WORK, RWORK, INFO )
192 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS
196 DOUBLE PRECISION BERR( * ), FERR( * ), RWORK( * )
197 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
198 $ work( * ), x( ldx, * )
205 PARAMETER ( ITMAX = 5 )
206 DOUBLE PRECISION ZERO
207 parameter( zero = 0.0d+0 )
209 parameter( one = ( 1.0d+0, 0.0d+0 ) )
211 parameter( two = 2.0d+0 )
212 DOUBLE PRECISION THREE
213 parameter( three = 3.0d+0 )
217 CHARACTER TRANSN, TRANST
218 INTEGER COUNT, I, J, K, KASE, NZ
219 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
227 DOUBLE PRECISION DLAMCH
228 EXTERNAL lsame, dlamch
235 INTRINSIC abs, dble, dimag, max
238 DOUBLE PRECISION CABS1
241 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
248 notran = lsame( trans,
'N' )
249 IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
250 $ lsame( trans,
'C' ) )
THEN
252 ELSE IF( n.LT.0 )
THEN
254 ELSE IF( nrhs.LT.0 )
THEN
256 ELSE IF( lda.LT.max( 1, n ) )
THEN
258 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
260 ELSE IF( ldb.LT.max( 1, n ) )
THEN
262 ELSE IF( ldx.LT.max( 1, n ) )
THEN
266 CALL xerbla(
'ZGERFS', -info )
272 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
291 eps = dlamch(
'Epsilon' )
292 safmin = dlamch(
'Safe minimum' )
309 CALL zcopy( n, b( 1, j ), 1, work, 1 )
310 CALL zgemv( trans, n, n, -one, a, lda, x( 1, j ), 1, one,
324 rwork( i ) = cabs1( b( i, j ) )
331 xk = cabs1( x( k, j ) )
333 rwork( i ) = rwork( i ) + cabs1( a( i, k ) )*xk
340 s = s + cabs1( a( i, k ) )*cabs1( x( i, j ) )
342 rwork( k ) = rwork( k ) + s
347 IF( rwork( i ).GT.safe2 )
THEN
348 s = max( s, cabs1( work( i ) ) / rwork( i ) )
350 s = max( s, ( cabs1( work( i ) )+safe1 ) /
351 $ ( rwork( i )+safe1 ) )
362 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
363 $ count.LE.itmax )
THEN
367 CALL zgetrs( trans, n, 1, af, ldaf, ipiv, work, n, info )
368 CALL zaxpy( n, one, work, 1, x( 1, j ), 1 )
397 IF( rwork( i ).GT.safe2 )
THEN
398 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
400 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
407 CALL zlacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
413 CALL zgetrs( transt, n, 1, af, ldaf, ipiv, work, n,
416 work( i ) = rwork( i )*work( i )
423 work( i ) = rwork( i )*work( i )
425 CALL zgetrs( transn, n, 1, af, ldaf, ipiv, work, n,
435 lstres = max( lstres, cabs1( x( i, j ) ) )
438 $ ferr( j ) = ferr( j ) / lstres
subroutine zgerfs(trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
ZGERFS