167 SUBROUTINE cpprfs( UPLO, N, NRHS, AP, AFP, B, LDB, X, LDX,
169 $ BERR, WORK, RWORK, INFO )
177 INTEGER INFO, LDB, LDX, N, NRHS
180 REAL BERR( * ), FERR( * ), RWORK( * )
181 COMPLEX AFP( * ), AP( * ), B( LDB, * ), WORK( * ),
189 PARAMETER ( ITMAX = 5 )
191 parameter( zero = 0.0e+0 )
193 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
195 parameter( two = 2.0e+0 )
197 parameter( three = 3.0e+0 )
201 INTEGER COUNT, I, IK, J, K, KASE, KK, NZ
202 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
213 INTRINSIC abs, aimag, max, real
218 EXTERNAL lsame, slamch
224 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( 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(
'CPPRFS', -info )
250 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
261 eps = slamch(
'Epsilon' )
262 safmin = slamch(
'Safe minimum' )
263 safe1 = real( nz )*safmin
278 CALL ccopy( n, b( 1, j ), 1, work, 1 )
279 CALL chpmv( 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( real( ap( kk+k-1 ) ) )*
315 xk = cabs1( x( k, j ) )
316 rwork( k ) = rwork( k ) + abs( real( 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 cpptrs( uplo, n, 1, afp, work, n, info )
350 CALL caxpy( n, cone, work, 1, x( 1, j ), 1 )
379 IF( rwork( i ).GT.safe2 )
THEN
380 rwork( i ) = cabs1( work( i ) ) + real( nz )*
383 rwork( i ) = cabs1( work( i ) ) + real( nz )*
384 $ eps*rwork( i ) + safe1
390 CALL clacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
396 CALL cpptrs( uplo, n, 1, afp, work, n, info )
398 work( i ) = rwork( i )*work( i )
400 ELSE IF( kase.EQ.2 )
THEN
405 work( i ) = rwork( i )*work( i )
407 CALL cpptrs( uplo, n, 1, afp, work, n, info )
416 lstres = max( lstres, cabs1( x( i, j ) ) )
419 $ ferr( j ) = ferr( j ) / lstres