181 SUBROUTINE zptrfs( 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 DOUBLE PRECISION BERR( * ), D( * ), DF( * ), FERR( * ),
195 COMPLEX*16 B( LDB, * ), E( * ), EF( * ), WORK( * ),
203 parameter( itmax = 5 )
204 DOUBLE PRECISION ZERO
205 parameter( zero = 0.0d+0 )
207 parameter( one = 1.0d+0 )
209 parameter( two = 2.0d+0 )
210 DOUBLE PRECISION THREE
211 parameter( three = 3.0d+0 )
215 INTEGER COUNT, I, IX, J, NZ
216 DOUBLE PRECISION EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN
217 COMPLEX*16 BI, CX, DX, EX, ZDUM
222 DOUBLE PRECISION DLAMCH
223 EXTERNAL lsame, idamax, dlamch
229 INTRINSIC abs, dble, dcmplx, dconjg, dimag, max
232 DOUBLE PRECISION CABS1
235 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( 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(
'ZPTRFS', -info )
261 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
272 eps = dlamch(
'Epsilon' )
273 safmin = dlamch(
'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 = dconjg( 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 = dconjg( 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 = dconjg( 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 = dconjg( 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 zpttrs( uplo, n, 1, df, ef, work, n, info )
386 CALL zaxpy( n, dcmplx( 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 = idamax( 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 = idamax( 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 zaxpy(n, za, zx, incx, zy, incy)
ZAXPY
subroutine zptrfs(uplo, n, nrhs, d, e, df, ef, b, ldb, x, ldx, ferr, berr, work, rwork, info)
ZPTRFS
subroutine zpttrs(uplo, n, nrhs, d, e, b, ldb, info)
ZPTTRS