190 SUBROUTINE zherfs( UPLO, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB,
191 $ X, LDX, FERR, BERR, WORK, RWORK, INFO )
199 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS
203 DOUBLE PRECISION BERR( * ), FERR( * ), RWORK( * )
204 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
205 $ work( * ), x( ldx, * )
212 parameter( itmax = 5 )
213 DOUBLE PRECISION ZERO
214 parameter( zero = 0.0d+0 )
216 parameter( one = ( 1.0d+0, 0.0d+0 ) )
218 parameter( two = 2.0d+0 )
219 DOUBLE PRECISION THREE
220 parameter( three = 3.0d+0 )
224 INTEGER COUNT, I, J, K, KASE, NZ
225 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
235 INTRINSIC abs, dble, dimag, max
239 DOUBLE PRECISION DLAMCH
240 EXTERNAL lsame, dlamch
243 DOUBLE PRECISION CABS1
246 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
253 upper = lsame( uplo,
'U' )
254 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
256 ELSE IF( n.LT.0 )
THEN
258 ELSE IF( nrhs.LT.0 )
THEN
260 ELSE IF( lda.LT.max( 1, n ) )
THEN
262 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
264 ELSE IF( ldb.LT.max( 1, n ) )
THEN
266 ELSE IF( ldx.LT.max( 1, n ) )
THEN
270 CALL xerbla(
'ZHERFS', -info )
276 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
287 eps = dlamch(
'Epsilon' )
288 safmin = dlamch(
'Safe minimum' )
304 CALL zcopy( n, b( 1, j ), 1, work, 1 )
305 CALL zhemv( uplo, n, -one, a, lda, x( 1, j ), 1, one, work, 1 )
317 rwork( i ) = cabs1( b( i, j ) )
325 xk = cabs1( x( k, j ) )
327 rwork( i ) = rwork( i ) + cabs1( a( i, k ) )*xk
328 s = s + cabs1( a( i, k ) )*cabs1( x( i, j ) )
330 rwork( k ) = rwork( k ) + abs( dble( a( k, k ) ) )*xk + s
335 xk = cabs1( x( k, j ) )
336 rwork( k ) = rwork( k ) + abs( dble( a( k, k ) ) )*xk
338 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 zhetrs( uplo, 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 zhetrs( uplo, n, 1, af, ldaf, ipiv, work, n, info )
414 work( i ) = rwork( i )*work( i )
416 ELSE IF( kase.EQ.2 )
THEN
421 work( i ) = rwork( i )*work( i )
423 CALL zhetrs( uplo, n, 1, af, ldaf, ipiv, work, n, info )
432 lstres = max( lstres, cabs1( x( i, j ) ) )
435 $ 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 zhemv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
ZHEMV
subroutine zherfs(uplo, n, nrhs, a, lda, af, ldaf, ipiv, b, ldb, x, ldx, ferr, berr, work, rwork, info)
ZHERFS
subroutine zhetrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
ZHETRS
subroutine zlacn2(n, v, x, est, kase, isave)
ZLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...