433 SUBROUTINE dgbrfsx( TRANS, EQUED, N, KL, KU, NRHS, AB, LDAB,
435 $ LDAFB, IPIV, R, C, B, LDB, X, LDX, RCOND,
436 $ BERR, N_ERR_BNDS, ERR_BNDS_NORM,
437 $ ERR_BNDS_COMP, NPARAMS, PARAMS, WORK, IWORK,
445 CHARACTER TRANS, EQUED
446 INTEGER INFO, LDAB, LDAFB, LDB, LDX, N, KL, KU, NRHS,
447 $ NPARAMS, N_ERR_BNDS
448 DOUBLE PRECISION RCOND
451 INTEGER IPIV( * ), IWORK( * )
452 DOUBLE PRECISION AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
453 $ x( ldx , * ),work( * )
454 DOUBLE PRECISION R( * ), C( * ), PARAMS( * ), BERR( * ),
455 $ ERR_BNDS_NORM( NRHS, * ),
456 $ err_bnds_comp( nrhs, * )
462 DOUBLE PRECISION ZERO, ONE
463 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
464 DOUBLE PRECISION ITREF_DEFAULT, ITHRESH_DEFAULT
465 DOUBLE PRECISION COMPONENTWISE_DEFAULT, RTHRESH_DEFAULT
466 DOUBLE PRECISION DZTHRESH_DEFAULT
467 parameter( itref_default = 1.0d+0 )
468 parameter( ithresh_default = 10.0d+0 )
469 parameter( componentwise_default = 1.0d+0 )
470 parameter( rthresh_default = 0.5d+0 )
471 parameter( dzthresh_default = 0.25d+0 )
472 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
474 parameter( la_linrx_itref_i = 1,
475 $ la_linrx_ithresh_i = 2 )
476 parameter( la_linrx_cwise_i = 3 )
477 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
479 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
480 parameter( la_linrx_rcond_i = 3 )
484 LOGICAL ROWEQU, COLEQU, NOTRAN
485 INTEGER J, TRANS_TYPE, PREC_TYPE, REF_TYPE
487 DOUBLE PRECISION ANORM, RCOND_TMP
488 DOUBLE PRECISION ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
491 DOUBLE PRECISION RTHRESH, UNSTABLE_THRESH
503 DOUBLE PRECISION DLAMCH, DLANGB, DLA_GBRCOND
505 INTEGER ILATRANS, ILAPREC
512 trans_type = ilatrans( trans )
513 ref_type = int( itref_default )
514 IF ( nparams .GE. la_linrx_itref_i )
THEN
515 IF ( params( la_linrx_itref_i ) .LT. 0.0d+0 )
THEN
516 params( la_linrx_itref_i ) = itref_default
518 ref_type = params( la_linrx_itref_i )
524 illrcond_thresh = dble( n ) * dlamch(
'Epsilon' )
525 ithresh = int( ithresh_default )
526 rthresh = rthresh_default
527 unstable_thresh = dzthresh_default
528 ignore_cwise = componentwise_default .EQ. 0.0d+0
530 IF ( nparams.GE.la_linrx_ithresh_i )
THEN
531 IF ( params( la_linrx_ithresh_i ).LT.0.0d+0 )
THEN
532 params( la_linrx_ithresh_i ) = ithresh
534 ithresh = int( params( la_linrx_ithresh_i ) )
537 IF ( nparams.GE.la_linrx_cwise_i )
THEN
538 IF ( params( la_linrx_cwise_i ).LT.0.0d+0 )
THEN
539 IF ( ignore_cwise )
THEN
540 params( la_linrx_cwise_i ) = 0.0d+0
542 params( la_linrx_cwise_i ) = 1.0d+0
545 ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0d+0
548 IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 )
THEN
550 ELSE IF ( ignore_cwise )
THEN
556 notran = lsame( trans,
'N' )
557 rowequ = lsame( equed,
'R' ) .OR. lsame( equed,
'B' )
558 colequ = lsame( equed,
'C' ) .OR. lsame( equed,
'B' )
562 IF( trans_type.EQ.-1 )
THEN
564 ELSE IF( .NOT.rowequ .AND. .NOT.colequ .AND.
565 $ .NOT.lsame( equed,
'N' ) )
THEN
567 ELSE IF( n.LT.0 )
THEN
569 ELSE IF( kl.LT.0 )
THEN
571 ELSE IF( ku.LT.0 )
THEN
573 ELSE IF( nrhs.LT.0 )
THEN
575 ELSE IF( ldab.LT.kl+ku+1 )
THEN
577 ELSE IF( ldafb.LT.2*kl+ku+1 )
THEN
579 ELSE IF( ldb.LT.max( 1, n ) )
THEN
581 ELSE IF( ldx.LT.max( 1, n ) )
THEN
585 CALL xerbla(
'DGBRFSX', -info )
591 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
595 IF ( n_err_bnds .GE. 1 )
THEN
596 err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
597 err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
599 IF ( n_err_bnds .GE. 2 )
THEN
600 err_bnds_norm( j, la_linrx_err_i ) = 0.0d+0
601 err_bnds_comp( j, la_linrx_err_i ) = 0.0d+0
603 IF ( n_err_bnds .GE. 3 )
THEN
604 err_bnds_norm( j, la_linrx_rcond_i ) = 1.0d+0
605 err_bnds_comp( j, la_linrx_rcond_i ) = 1.0d+0
616 IF ( n_err_bnds .GE. 1 )
THEN
617 err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
618 err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
620 IF ( n_err_bnds .GE. 2 )
THEN
621 err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
622 err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
624 IF ( n_err_bnds .GE. 3 )
THEN
625 err_bnds_norm( j, la_linrx_rcond_i ) = 0.0d+0
626 err_bnds_comp( j, la_linrx_rcond_i ) = 0.0d+0
638 anorm = dlangb( norm, n, kl, ku, ab, ldab, work )
639 CALL dgbcon( norm, n, kl, ku, afb, ldafb, ipiv, anorm, rcond,
640 $ work, iwork, info )
644 IF ( ref_type .NE. 0 .AND. info .EQ. 0 )
THEN
646 prec_type = ilaprec(
'E' )
651 $ nrhs, ab, ldab, afb, ldafb, ipiv, colequ, c, b,
652 $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
653 $ err_bnds_comp, work( n+1 ), work( 1 ), work( 2*n+1 ),
654 $ work( 1 ), rcond, ithresh, rthresh, unstable_thresh,
655 $ ignore_cwise, info )
659 $ nrhs, ab, ldab, afb, ldafb, ipiv, rowequ, r, b,
660 $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
661 $ err_bnds_comp, work( n+1 ), work( 1 ), work( 2*n+1 ),
662 $ work( 1 ), rcond, ithresh, rthresh, unstable_thresh,
663 $ ignore_cwise, info )
667 err_lbnd = max( 10.0d+0,
668 $ sqrt( dble( n ) ) ) * dlamch(
'Epsilon' )
669 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 1 )
THEN
673 IF ( colequ .AND. notran )
THEN
674 rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
675 $ ldafb, ipiv, -1, c, info, work, iwork )
676 ELSE IF ( rowequ .AND. .NOT. notran )
THEN
677 rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
678 $ ldafb, ipiv, -1, r, info, work, iwork )
680 rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab, afb,
681 $ ldafb, ipiv, 0, r, info, work, iwork )
687 IF ( n_err_bnds .GE. la_linrx_err_i
688 $ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0d+0 )
689 $ err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
693 IF ( rcond_tmp .LT. illrcond_thresh )
THEN
694 err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
695 err_bnds_norm( j, la_linrx_trust_i ) = 0.0d+0
696 IF ( info .LE. n ) info = n + j
697 ELSE IF ( err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd )
699 err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
700 err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
705 IF ( n_err_bnds .GE. la_linrx_rcond_i )
THEN
706 err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
712 IF (n_err_bnds .GE. 1 .AND. n_norms .GE. 2)
THEN
722 cwise_wrong = sqrt( dlamch(
'Epsilon' ) )
724 IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
726 rcond_tmp = dla_gbrcond( trans, n, kl, ku, ab, ldab,
728 $ ldafb, ipiv, 1, x( 1, j ), info, work, iwork )
735 IF ( n_err_bnds .GE. la_linrx_err_i
736 $ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0d+0 )
737 $ err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
741 IF ( rcond_tmp .LT. illrcond_thresh )
THEN
742 err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
743 err_bnds_comp( j, la_linrx_trust_i ) = 0.0d+0
744 IF ( params( la_linrx_cwise_i ) .EQ. 1.0d+0
745 $ .AND. info.LT.n + j ) info = n + j
746 ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
747 $ .LT. err_lbnd )
THEN
748 err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
749 err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
754 IF ( n_err_bnds .GE. la_linrx_rcond_i )
THEN
755 err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp