159 SUBROUTINE sptrfs( N, NRHS, D, E, DF, EF, B, LDB, X, LDX, FERR,
167 INTEGER INFO, LDB, LDX, N, NRHS
170 REAL B( LDB, * ), BERR( * ), D( * ), DF( * ),
171 $ e( * ), ef( * ), ferr( * ), work( * ),
179 parameter( itmax = 5 )
181 parameter( zero = 0.0e+0 )
183 parameter( one = 1.0e+0 )
185 parameter( two = 2.0e+0 )
187 parameter( three = 3.0e+0 )
190 INTEGER COUNT, I, IX, J, NZ
191 REAL BI, CX, DX, EPS, EX, LSTRES, S, SAFE1, SAFE2,
203 EXTERNAL isamax, slamch
212 ELSE IF( nrhs.LT.0 )
THEN
214 ELSE IF( ldb.LT.max( 1, n ) )
THEN
216 ELSE IF( ldx.LT.max( 1, n ) )
THEN
220 CALL xerbla(
'SPTRFS', -info )
226 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
237 eps = slamch(
'Epsilon' )
238 safmin = slamch(
'Safe minimum' )
239 safe1 = real( nz )*safmin
257 dx = d( 1 )*x( 1, j )
258 work( n+1 ) = bi - dx
259 work( 1 ) = abs( bi ) + abs( dx )
262 dx = d( 1 )*x( 1, j )
263 ex = e( 1 )*x( 2, j )
264 work( n+1 ) = bi - dx - ex
265 work( 1 ) = abs( bi ) + abs( dx ) + abs( ex )
268 cx = e( i-1 )*x( i-1, j )
269 dx = d( i )*x( i, j )
270 ex = e( i )*x( i+1, j )
271 work( n+i ) = bi - cx - dx - ex
272 work( i ) = abs( bi ) + abs( cx ) + abs( dx ) + abs( ex )
275 cx = e( n-1 )*x( n-1, j )
276 dx = d( n )*x( n, j )
277 work( n+n ) = bi - cx - dx
278 work( n ) = abs( bi ) + abs( cx ) + abs( dx )
292 IF( work( i ).GT.safe2 )
THEN
293 s = max( s, abs( work( n+i ) ) / work( i ) )
295 s = max( s, ( abs( work( n+i ) )+safe1 ) /
296 $ ( work( i )+safe1 ) )
307 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
308 $ count.LE.itmax )
THEN
312 CALL spttrs( n, 1, df, ef, work( n+1 ), n, info )
313 CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
338 IF( work( i ).GT.safe2 )
THEN
339 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
341 work( i ) = abs( work( n+i ) ) + real( nz )*eps*work( i )
345 ix = isamax( n, work, 1 )
346 ferr( j ) = work( ix )
361 work( i ) = one + work( i-1 )*abs( ef( i-1 ) )
366 work( n ) = work( n ) / df( n )
367 DO 70 i = n - 1, 1, -1
368 work( i ) = work( i ) / df( i ) + work( i+1 )*abs( ef( i ) )
373 ix = isamax( n, work, 1 )
374 ferr( j ) = ferr( j )*abs( work( ix ) )
380 lstres = max( lstres, abs( x( i, j ) ) )
383 $ ferr( j ) = ferr( j ) / lstres
subroutine sptrfs(n, nrhs, d, e, df, ef, b, ldb, x, ldx, ferr, berr, work, info)
SPTRFS