169 SUBROUTINE cpprfs( UPLO, N, NRHS, AP, AFP, B, LDB, X, LDX, FERR,
170 $ BERR, WORK, RWORK, INFO )
178 INTEGER INFO, LDB, LDX, N, NRHS
181 REAL BERR( * ), FERR( * ), RWORK( * )
182 COMPLEX AFP( * ), AP( * ), B( LDB, * ), WORK( * ),
190 parameter( itmax = 5 )
192 parameter( zero = 0.0e+0 )
194 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
196 parameter( two = 2.0e+0 )
198 parameter( three = 3.0e+0 )
202 INTEGER COUNT, I, IK, J, K, KASE, KK, NZ
203 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' )
278 CALL ccopy( n, b( 1, j ), 1, work, 1 )
279 CALL chpmv( uplo, n, -cone, ap, x( 1, j ), 1, cone, work, 1 )
291 rwork( i ) = cabs1( b( i, j ) )
300 xk = cabs1( x( k, j ) )
303 rwork( i ) = rwork( i ) + cabs1( ap( ik ) )*xk
304 s = s + cabs1( ap( ik ) )*cabs1( x( i, j ) )
307 rwork( k ) = rwork( k ) + abs( real( ap( kk+k-1 ) ) )*
314 xk = cabs1( x( k, j ) )
315 rwork( k ) = rwork( k ) + abs( real( ap( kk ) ) )*xk
318 rwork( i ) = rwork( i ) + cabs1( ap( ik ) )*xk
319 s = s + cabs1( ap( ik ) )*cabs1( x( i, j ) )
322 rwork( k ) = rwork( k ) + s
328 IF( rwork( i ).GT.safe2 )
THEN
329 s = max( s, cabs1( work( i ) ) / rwork( i ) )
331 s = max( s, ( cabs1( work( i ) )+safe1 ) /
332 $ ( rwork( i )+safe1 ) )
343 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
344 $ count.LE.itmax )
THEN
348 CALL cpptrs( uplo, n, 1, afp, work, n, info )
349 CALL caxpy( n, cone, work, 1, x( 1, j ), 1 )
378 IF( rwork( i ).GT.safe2 )
THEN
379 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
381 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
388 CALL clacn2( n, work( n+1 ), work, ferr( j ), kase, isave )
394 CALL cpptrs( uplo, n, 1, afp, work, n, info )
396 work( i ) = rwork( i )*work( i )
398 ELSE IF( kase.EQ.2 )
THEN
403 work( i ) = rwork( i )*work( i )
405 CALL cpptrs( uplo, n, 1, afp, work, n, info )
414 lstres = max( lstres, cabs1( x( i, j ) ) )
417 $ 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 chpmv(uplo, n, alpha, ap, x, incx, beta, y, incy)
CHPMV
subroutine clacn2(n, v, x, est, kase, isave)
CLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
subroutine cpprfs(uplo, n, nrhs, ap, afp, b, ldb, x, ldx, ferr, berr, work, rwork, info)
CPPRFS
subroutine cpptrs(uplo, n, nrhs, ap, b, ldb, info)
CPPTRS