184 SUBROUTINE cgerfs( 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 REAL BERR( * ), FERR( * ), RWORK( * )
198 COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
199 $ work( * ), x( ldx, * )
206 parameter( itmax = 5 )
208 parameter( zero = 0.0e+0 )
210 parameter( one = ( 1.0e+0, 0.0e+0 ) )
212 parameter( two = 2.0e+0 )
214 parameter( three = 3.0e+0 )
218 CHARACTER TRANSN, TRANST
219 INTEGER COUNT, I, J, K, KASE, NZ
220 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
229 EXTERNAL lsame, slamch
235 INTRINSIC abs, aimag, max, real
241 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( 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(
'CGERFS', -info )
272 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
291 eps = slamch(
'Epsilon' )
292 safmin = slamch(
'Safe minimum' )
309 CALL ccopy( n, b( 1, j ), 1, work, 1 )
310 CALL cgemv( 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 cgetrs( trans, n, 1, af, ldaf, ipiv, work, n, info )
367 CALL caxpy( 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 clacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
412 CALL cgetrs( transt, n, 1, af, ldaf, ipiv, work, n,
415 work( i ) = rwork( i )*work( i )
422 work( i ) = rwork( i )*work( i )
424 CALL cgetrs( 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 caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine cgerfs(trans, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
CGERFS
subroutine cgetrs(trans, n, nrhs, a, lda, ipiv, b, ldb, info)
CGETRS
subroutine clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...