167 SUBROUTINE zpprfs( UPLO, N, NRHS, AP, AFP, B, LDB, X, LDX,
169 $ BERR, WORK, RWORK, INFO )
177 INTEGER INFO, LDB, LDX, N, NRHS
180 DOUBLE PRECISION BERR( * ), FERR( * ), RWORK( * )
181 COMPLEX*16 AFP( * ), AP( * ), B( LDB, * ), WORK( * ),
189 PARAMETER ( ITMAX = 5 )
190 DOUBLE PRECISION ZERO
191 parameter( zero = 0.0d+0 )
193 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
195 parameter( two = 2.0d+0 )
196 DOUBLE PRECISION THREE
197 parameter( three = 3.0d+0 )
201 INTEGER COUNT, I, IK, J, K, KASE, KK, NZ
202 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
213 INTRINSIC abs, dble, dimag, max
217 DOUBLE PRECISION DLAMCH
218 EXTERNAL lsame, dlamch
221 DOUBLE PRECISION CABS1
224 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
231 upper = lsame( uplo,
'U' )
232 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
234 ELSE IF( n.LT.0 )
THEN
236 ELSE IF( nrhs.LT.0 )
THEN
238 ELSE IF( ldb.LT.max( 1, n ) )
THEN
240 ELSE IF( ldx.LT.max( 1, n ) )
THEN
244 CALL xerbla(
'ZPPRFS', -info )
250 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
261 eps = dlamch(
'Epsilon' )
262 safmin = dlamch(
'Safe minimum' )
278 CALL zcopy( n, b( 1, j ), 1, work, 1 )
279 CALL zhpmv( uplo, n, -cone, ap, x( 1, j ), 1, cone, work,
292 rwork( i ) = cabs1( b( i, j ) )
301 xk = cabs1( x( k, j ) )
304 rwork( i ) = rwork( i ) + cabs1( ap( ik ) )*xk
305 s = s + cabs1( ap( ik ) )*cabs1( x( i, j ) )
308 rwork( k ) = rwork( k ) + abs( dble( ap( kk+k-1 ) ) )*
315 xk = cabs1( x( k, j ) )
316 rwork( k ) = rwork( k ) + abs( dble( ap( kk ) ) )*xk
319 rwork( i ) = rwork( i ) + cabs1( ap( ik ) )*xk
320 s = s + cabs1( ap( ik ) )*cabs1( x( i, j ) )
323 rwork( k ) = rwork( k ) + s
329 IF( rwork( i ).GT.safe2 )
THEN
330 s = max( s, cabs1( work( i ) ) / rwork( i ) )
332 s = max( s, ( cabs1( work( i ) )+safe1 ) /
333 $ ( rwork( i )+safe1 ) )
344 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
345 $ count.LE.itmax )
THEN
349 CALL zpptrs( uplo, n, 1, afp, work, n, info )
350 CALL zaxpy( n, cone, work, 1, x( 1, j ), 1 )
379 IF( rwork( i ).GT.safe2 )
THEN
380 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
382 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
389 CALL zlacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
395 CALL zpptrs( uplo, n, 1, afp, work, n, info )
397 work( i ) = rwork( i )*work( i )
399 ELSE IF( kase.EQ.2 )
THEN
404 work( i ) = rwork( i )*work( i )
406 CALL zpptrs( uplo, n, 1, afp, work, n, info )
415 lstres = max( lstres, cabs1( x( i, j ) ) )
418 $ ferr( j ) = ferr( j ) / lstres