171 SUBROUTINE zpprfs( UPLO, N, NRHS, AP, AFP, B, LDB, X, LDX, FERR,
172 $ berr, work, rwork, info )
181 INTEGER info, ldb, ldx, n, nrhs
184 DOUBLE PRECISION berr( * ), ferr( * ), rwork( * )
185 COMPLEX*16 afp( * ), ap( * ), b( ldb, * ), work( * ),
193 parameter( itmax = 5 )
194 DOUBLE PRECISION zero
195 parameter( zero = 0.0d+0 )
197 parameter( cone = ( 1.0d+0, 0.0d+0 ) )
199 parameter( two = 2.0d+0 )
200 DOUBLE PRECISION three
201 parameter( three = 3.0d+0 )
205 INTEGER count, i, ik, j, k, kase, kk, nz
206 DOUBLE PRECISION eps, lstres, s, safe1, safe2, safmin, xk
216 INTRINSIC abs, dble, dimag, max
224 DOUBLE PRECISION cabs1
227 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
234 upper =
lsame( uplo,
'U' )
235 IF( .NOT.upper .AND. .NOT.
lsame( uplo,
'L' ) )
THEN
237 ELSE IF( n.LT.0 )
THEN
239 ELSE IF( nrhs.LT.0 )
THEN
241 ELSE IF( ldb.LT.max( 1, n ) )
THEN
243 ELSE IF( ldx.LT.max( 1, n ) )
THEN
247 CALL
xerbla(
'ZPPRFS', -info )
253 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
265 safmin =
dlamch(
'Safe minimum' )
281 CALL
zcopy( n, b( 1, j ), 1, work, 1 )
282 CALL
zhpmv( uplo, n, -cone, ap, x( 1, j ), 1, cone, work, 1 )
294 rwork( i ) = cabs1( b( i, j ) )
303 xk = cabs1( x( k, j ) )
306 rwork( i ) = rwork( i ) + cabs1( ap( ik ) )*xk
307 s = s + cabs1( ap( ik ) )*cabs1( x( i, j ) )
310 rwork( k ) = rwork( k ) + abs( dble( ap( kk+k-1 ) ) )*
317 xk = cabs1( x( k, j ) )
318 rwork( k ) = rwork( k ) + abs( dble( ap( kk ) ) )*xk
321 rwork( i ) = rwork( i ) + cabs1( ap( ik ) )*xk
322 s = s + cabs1( ap( ik ) )*cabs1( x( i, j ) )
325 rwork( k ) = rwork( k ) + s
331 IF( rwork( i ).GT.safe2 )
THEN
332 s = max( s, cabs1( work( i ) ) / rwork( i ) )
334 s = max( s, ( cabs1( work( i ) )+safe1 ) /
335 $ ( rwork( i )+safe1 ) )
346 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
347 $ count.LE.itmax )
THEN
351 CALL
zpptrs( uplo, n, 1, afp, work, n, info )
352 CALL
zaxpy( n, cone, work, 1, x( 1, j ), 1 )
381 IF( rwork( i ).GT.safe2 )
THEN
382 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
384 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
391 CALL
zlacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
397 CALL
zpptrs( uplo, n, 1, afp, work, n, info )
399 work( i ) = rwork( i )*work( i )
401 ELSE IF( kase.EQ.2 )
THEN
406 work( i ) = rwork( i )*work( i )
408 CALL
zpptrs( uplo, n, 1, afp, work, n, info )
417 lstres = max( lstres, cabs1( x( i, j ) ) )
420 $ ferr( j ) = ferr( j ) / lstres