184 SUBROUTINE zgerfs( TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB,
185 $ X, LDX, FERR, BERR, WORK, RWORK, INFO )
193 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS
197 DOUBLE PRECISION BERR( * ), FERR( * ), RWORK( * )
198 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
199 $ work( * ), x( ldx, * )
206 parameter( itmax = 5 )
207 DOUBLE PRECISION ZERO
208 parameter( zero = 0.0d+0 )
210 parameter( one = ( 1.0d+0, 0.0d+0 ) )
212 parameter( two = 2.0d+0 )
213 DOUBLE PRECISION THREE
214 parameter( three = 3.0d+0 )
218 CHARACTER TRANSN, TRANST
219 INTEGER COUNT, I, J, K, KASE, NZ
220 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
228 DOUBLE PRECISION DLAMCH
229 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, work,
323 rwork( i ) = cabs1( b( i, j ) )
330 xk = cabs1( x( k, j ) )
332 rwork( i ) = rwork( i ) + cabs1( a( i, k ) )*xk
339 s = s + cabs1( a( i, k ) )*cabs1( x( i, j ) )
341 rwork( k ) = rwork( k ) + s
346 IF( rwork( i ).GT.safe2 )
THEN
347 s = max( s, cabs1( work( i ) ) / rwork( i ) )
349 s = max( s, ( cabs1( work( i ) )+safe1 ) /
350 $ ( rwork( i )+safe1 ) )
361 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
362 $ count.LE.itmax )
THEN
366 CALL zgetrs( trans, n, 1, af, ldaf, ipiv, work, n, info )
367 CALL zaxpy( n, one, work, 1, x( 1, j ), 1 )
396 IF( rwork( i ).GT.safe2 )
THEN
397 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
399 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
406 CALL zlacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
412 CALL zgetrs( transt, n, 1, af, ldaf, ipiv, work, n,
415 work( i ) = rwork( i )*work( i )
422 work( i ) = rwork( i )*work( i )
424 CALL zgetrs( transn, n, 1, af, ldaf, ipiv, work, n,
434 lstres = max( lstres, cabs1( x( i, j ) ) )
437 $ 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 zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zgerfs(trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
ZGERFS
subroutine zgetrs(trans, n, nrhs, a, lda, ipiv, b, ldb, info)
ZGETRS
subroutine zlacn2(n, v, x, est, kase, isave)
ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...