181 SUBROUTINE cptrfs( UPLO, N, NRHS, D, E, DF, EF, B, LDB, X, LDX,
182 $ FERR, BERR, WORK, RWORK, INFO )
190 INTEGER INFO, LDB, LDX, N, NRHS
193 REAL BERR( * ), D( * ), DF( * ), FERR( * ),
195 COMPLEX B( LDB, * ), E( * ), EF( * ), WORK( * ),
203 parameter( itmax = 5 )
205 parameter( zero = 0.0e+0 )
207 parameter( one = 1.0e+0 )
209 parameter( two = 2.0e+0 )
211 parameter( three = 3.0e+0 )
215 INTEGER COUNT, I, IX, J, NZ
216 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN
217 COMPLEX BI, CX, DX, EX, ZDUM
223 EXTERNAL lsame, isamax, slamch
229 INTRINSIC abs, aimag, cmplx, conjg, max, real
235 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
242 upper = lsame( uplo,
'U' )
243 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
245 ELSE IF( n.LT.0 )
THEN
247 ELSE IF( nrhs.LT.0 )
THEN
249 ELSE IF( ldb.LT.max( 1, n ) )
THEN
251 ELSE IF( ldx.LT.max( 1, n ) )
THEN
255 CALL xerbla(
'CPTRFS', -info )
261 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
272 eps = slamch(
'Epsilon' )
273 safmin = slamch(
'Safe minimum' )
293 dx = d( 1 )*x( 1, j )
295 rwork( 1 ) = cabs1( bi ) + cabs1( dx )
298 dx = d( 1 )*x( 1, j )
299 ex = e( 1 )*x( 2, j )
300 work( 1 ) = bi - dx - ex
301 rwork( 1 ) = cabs1( bi ) + cabs1( dx ) +
302 $ cabs1( e( 1 ) )*cabs1( x( 2, j ) )
305 cx = conjg( e( i-1 ) )*x( i-1, j )
306 dx = d( i )*x( i, j )
307 ex = e( i )*x( i+1, j )
308 work( i ) = bi - cx - dx - ex
309 rwork( i ) = cabs1( bi ) +
310 $ cabs1( e( i-1 ) )*cabs1( x( i-1, j ) ) +
311 $ cabs1( dx ) + cabs1( e( i ) )*
312 $ cabs1( x( i+1, j ) )
315 cx = conjg( e( n-1 ) )*x( n-1, j )
316 dx = d( n )*x( n, j )
317 work( n ) = bi - cx - dx
318 rwork( n ) = cabs1( bi ) + cabs1( e( n-1 ) )*
319 $ cabs1( x( n-1, j ) ) + cabs1( dx )
324 dx = d( 1 )*x( 1, j )
326 rwork( 1 ) = cabs1( bi ) + cabs1( dx )
329 dx = d( 1 )*x( 1, j )
330 ex = conjg( e( 1 ) )*x( 2, j )
331 work( 1 ) = bi - dx - ex
332 rwork( 1 ) = cabs1( bi ) + cabs1( dx ) +
333 $ cabs1( e( 1 ) )*cabs1( x( 2, j ) )
336 cx = e( i-1 )*x( i-1, j )
337 dx = d( i )*x( i, j )
338 ex = conjg( e( i ) )*x( i+1, j )
339 work( i ) = bi - cx - dx - ex
340 rwork( i ) = cabs1( bi ) +
341 $ cabs1( e( i-1 ) )*cabs1( x( i-1, j ) ) +
342 $ cabs1( dx ) + cabs1( e( i ) )*
343 $ cabs1( x( i+1, j ) )
346 cx = e( n-1 )*x( n-1, j )
347 dx = d( n )*x( n, j )
348 work( n ) = bi - cx - dx
349 rwork( n ) = cabs1( bi ) + cabs1( e( n-1 ) )*
350 $ cabs1( x( n-1, j ) ) + cabs1( dx )
365 IF( rwork( i ).GT.safe2 )
THEN
366 s = max( s, cabs1( work( i ) ) / rwork( i ) )
368 s = max( s, ( cabs1( work( i ) )+safe1 ) /
369 $ ( rwork( i )+safe1 ) )
380 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
381 $ count.LE.itmax )
THEN
385 CALL cpttrs( uplo, n, 1, df, ef, work, n, info )
386 CALL caxpy( n, cmplx( one ), work, 1, x( 1, j ), 1 )
411 IF( rwork( i ).GT.safe2 )
THEN
412 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i )
414 rwork( i ) = cabs1( work( i ) ) + nz*eps*rwork( i ) +
418 ix = isamax( n, rwork, 1 )
419 ferr( j ) = rwork( ix )
434 rwork( i ) = one + rwork( i-1 )*abs( ef( i-1 ) )
439 rwork( n ) = rwork( n ) / df( n )
440 DO 80 i = n - 1, 1, -1
441 rwork( i ) = rwork( i ) / df( i ) +
442 $ rwork( i+1 )*abs( ef( i ) )
447 ix = isamax( n, rwork, 1 )
448 ferr( j ) = ferr( j )*abs( rwork( ix ) )
454 lstres = max( lstres, abs( x( i, j ) ) )
457 $ ferr( j ) = ferr( j ) / lstres
subroutine xerbla(srname, info)
subroutine caxpy(n, ca, cx, incx, cy, incy)
CAXPY
subroutine cptrfs(uplo, n, nrhs, d, e, df, ef, b, ldb, x, ldx, ferr, berr, work, rwork, info)
CPTRFS
subroutine cpttrs(uplo, n, nrhs, d, e, b, ldb, info)
CPTTRS