388 $ AF, LDAF, IPIV, COLEQU, C, B, LDB,
389 $ Y, LDY, BERR_OUT, N_NORMS,
390 $ ERR_BNDS_NORM, ERR_BNDS_COMP, RES,
391 $ AYB, DY, Y_TAIL, RCOND, ITHRESH,
392 $ RTHRESH, DZ_UB, IGNORE_CWISE,
400 INTEGER INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE,
403 LOGICAL COLEQU, IGNORE_CWISE
404 DOUBLE PRECISION RTHRESH, DZ_UB
408 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
409 $ y( ldy, * ), res( * ), dy( * ), y_tail( * )
410 DOUBLE PRECISION C( * ), AYB( * ), RCOND, BERR_OUT( * ),
411 $ err_bnds_norm( nrhs, * ),
412 $ err_bnds_comp( nrhs, * )
418 INTEGER UPLO2, CNT, I, J, X_STATE, Z_STATE,
420 DOUBLE PRECISION YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
421 $ DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
422 $ DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
423 $ EPS, HUGEVAL, INCR_THRESH
424 LOGICAL INCR_PREC, UPPER
428 INTEGER UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
429 $ NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
431 parameter( unstable_state = 0, working_state = 1,
432 $ conv_state = 2, noprog_state = 3 )
433 parameter( base_residual = 0, extra_residual = 1,
435 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
436 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
437 INTEGER CMP_ERR_I, PIV_GROWTH_I
438 parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
440 parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
441 parameter( cmp_rcond_i = 7, cmp_err_i = 8,
443 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
445 parameter( la_linrx_itref_i = 1,
446 $ la_linrx_ithresh_i = 2 )
447 parameter( la_linrx_cwise_i = 3 )
448 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
450 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
451 parameter( la_linrx_rcond_i = 3 )
463 DOUBLE PRECISION DLAMCH
466 INTRINSIC abs, real, dimag, max, min
469 DOUBLE PRECISION CABS1
472 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
477 upper = lsame( uplo,
'U' )
478 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
480 ELSE IF( n.LT.0 )
THEN
482 ELSE IF( nrhs.LT.0 )
THEN
484 ELSE IF( lda.LT.max( 1, n ) )
THEN
486 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
488 ELSE IF( ldb.LT.max( 1, n ) )
THEN
490 ELSE IF( ldy.LT.max( 1, n ) )
THEN
494 CALL xerbla(
'ZLA_HERFSX_EXTENDED', -info )
497 eps = dlamch(
'Epsilon' )
498 hugeval = dlamch(
'Overflow' )
500 hugeval = hugeval * hugeval
502 incr_thresh = dble( n ) * eps
504 IF ( lsame( uplo,
'L' ) )
THEN
505 uplo2 = ilauplo(
'L' )
507 uplo2 = ilauplo(
'U' )
511 y_prec_state = extra_residual
512 IF ( y_prec_state .EQ. extra_y )
THEN
529 x_state = working_state
530 z_state = unstable_state
538 CALL zcopy( n, b( 1, j ), 1, res, 1 )
539 IF ( y_prec_state .EQ. base_residual )
THEN
540 CALL zsymv( uplo, n, dcmplx(-1.0d+0), a, lda, y(1,j),
542 $ dcmplx(1.0d+0), res, 1 )
543 ELSE IF ( y_prec_state .EQ. extra_residual )
THEN
544 CALL blas_zsymv_x( uplo2, n, dcmplx(-1.0d+0), a, lda,
545 $ y( 1, j ), 1, dcmplx(1.0d+0), res, 1, prec_type )
547 CALL blas_zsymv2_x(uplo2, n, dcmplx(-1.0d+0), a, lda,
548 $ y(1, j), y_tail, 1, dcmplx(1.0d+0), res, 1,
553 CALL zcopy( n, res, 1, dy, 1 )
554 CALL zsytrs( uplo, n, 1, af, ldaf, ipiv, dy, n, info )
565 yk = cabs1( y( i, j ) )
566 dyk = cabs1( dy( i ) )
568 IF ( yk .NE. 0.0d+0 )
THEN
569 dz_z = max( dz_z, dyk / yk )
570 ELSE IF ( dyk .NE. 0.0d+0 )
THEN
574 ymin = min( ymin, yk )
576 normy = max( normy, yk )
579 normx = max( normx, yk * c( i ) )
580 normdx = max( normdx, dyk * c( i ) )
583 normdx = max( normdx, dyk )
587 IF ( normx .NE. 0.0d+0 )
THEN
588 dx_x = normdx / normx
589 ELSE IF ( normdx .EQ. 0.0d+0 )
THEN
595 dxrat = normdx / prevnormdx
596 dzrat = dz_z / prev_dz_z
600 IF ( ymin*rcond .LT. incr_thresh*normy
601 $ .AND. y_prec_state .LT. extra_y )
604 IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
605 $ x_state = working_state
606 IF ( x_state .EQ. working_state )
THEN
607 IF ( dx_x .LE. eps )
THEN
609 ELSE IF ( dxrat .GT. rthresh )
THEN
610 IF ( y_prec_state .NE. extra_y )
THEN
613 x_state = noprog_state
616 IF (dxrat .GT. dxratmax) dxratmax = dxrat
618 IF ( x_state .GT. working_state ) final_dx_x = dx_x
621 IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
622 $ z_state = working_state
623 IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
624 $ z_state = working_state
625 IF ( z_state .EQ. working_state )
THEN
626 IF ( dz_z .LE. eps )
THEN
628 ELSE IF ( dz_z .GT. dz_ub )
THEN
629 z_state = unstable_state
632 ELSE IF ( dzrat .GT. rthresh )
THEN
633 IF ( y_prec_state .NE. extra_y )
THEN
636 z_state = noprog_state
639 IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
641 IF ( z_state .GT. working_state ) final_dz_z = dz_z
644 IF ( x_state.NE.working_state.AND.
645 $ ( ignore_cwise.OR.z_state.NE.working_state ) )
648 IF ( incr_prec )
THEN
650 y_prec_state = y_prec_state + 1
661 IF ( y_prec_state .LT. extra_y )
THEN
662 CALL zaxpy( n, dcmplx(1.0d+0), dy, 1, y(1,j), 1 )
673 IF ( x_state .EQ. working_state ) final_dx_x = dx_x
674 IF ( z_state .EQ. working_state ) final_dz_z = dz_z
678 IF ( n_norms .GE. 1 )
THEN
679 err_bnds_norm( j, la_linrx_err_i ) =
680 $ final_dx_x / (1 - dxratmax)
682 IF ( n_norms .GE. 2 )
THEN
683 err_bnds_comp( j, la_linrx_err_i ) =
684 $ final_dz_z / (1 - dzratmax)
695 CALL zcopy( n, b( 1, j ), 1, res, 1 )
696 CALL zsymv( uplo, n, dcmplx(-1.0d+0), a, lda, y(1,j), 1,
697 $ dcmplx(1.0d+0), res, 1 )
700 ayb( i ) = cabs1( b( i, j ) )
706 $ a, lda, y(1, j), 1, 1.0d+0, ayb, 1 )