175 SUBROUTINE ssprfs( UPLO, N, NRHS, AP, AFP, IPIV, B, LDB, X,
177 $ FERR, BERR, WORK, IWORK, INFO )
185 INTEGER INFO, LDB, LDX, N, NRHS
188 INTEGER IPIV( * ), IWORK( * )
189 REAL AFP( * ), AP( * ), B( LDB, * ), BERR( * ),
190 $ ferr( * ), work( * ), x( ldx, * )
197 PARAMETER ( ITMAX = 5 )
199 parameter( zero = 0.0e+0 )
201 parameter( one = 1.0e+0 )
203 parameter( two = 2.0e+0 )
205 parameter( three = 3.0e+0 )
209 INTEGER COUNT, I, IK, J, K, KASE, KK, NZ
210 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
225 EXTERNAL lsame, slamch
232 upper = lsame( uplo,
'U' )
233 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
235 ELSE IF( n.LT.0 )
THEN
237 ELSE IF( nrhs.LT.0 )
THEN
239 ELSE IF( ldb.LT.max( 1, n ) )
THEN
241 ELSE IF( ldx.LT.max( 1, n ) )
THEN
245 CALL xerbla(
'SSPRFS', -info )
251 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
262 eps = slamch(
'Epsilon' )
263 safmin = slamch(
'Safe minimum' )
264 safe1 = real( nz )*safmin
279 CALL scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
280 CALL sspmv( uplo, n, -one, ap, x( 1, j ), 1, one,
294 work( i ) = abs( b( i, j ) )
303 xk = abs( x( k, j ) )
306 work( i ) = work( i ) + abs( ap( ik ) )*xk
307 s = s + abs( ap( ik ) )*abs( x( i, j ) )
310 work( k ) = work( k ) + abs( ap( kk+k-1 ) )*xk + s
316 xk = abs( x( k, j ) )
317 work( k ) = work( k ) + abs( ap( kk ) )*xk
320 work( i ) = work( i ) + abs( ap( ik ) )*xk
321 s = s + abs( ap( ik ) )*abs( x( i, j ) )
324 work( k ) = work( k ) + s
330 IF( work( i ).GT.safe2 )
THEN
331 s = max( s, abs( work( n+i ) ) / work( i ) )
333 s = max( s, ( abs( work( n+i ) )+safe1 ) /
334 $ ( work( i )+safe1 ) )
345 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
346 $ count.LE.itmax )
THEN
350 CALL ssptrs( uplo, n, 1, afp, ipiv, work( n+1 ), n,
352 CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
381 IF( work( i ).GT.safe2 )
THEN
382 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
384 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
391 CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork,
399 CALL ssptrs( uplo, n, 1, afp, ipiv, work( n+1 ), n,
402 work( n+i ) = work( i )*work( n+i )
404 ELSE IF( kase.EQ.2 )
THEN
409 work( n+i ) = work( i )*work( n+i )
411 CALL ssptrs( uplo, n, 1, afp, ipiv, work( n+1 ), n,
421 lstres = max( lstres, abs( x( i, j ) ) )
424 $ ferr( j ) = ferr( j ) / lstres
subroutine ssprfs(uplo, n, nrhs, ap, afp, ipiv, b, ldb, x, ldx, ferr, berr, work, iwork, info)
SSPRFS