408 SUBROUTINE zgerfsx( TRANS, EQUED, N, NRHS, A, LDA, AF, LDAF,
410 $ R, C, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS,
411 $ ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
412 $ WORK, RWORK, INFO )
419 CHARACTER TRANS, EQUED
420 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
422 DOUBLE PRECISION RCOND
426 COMPLEX*16 A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
427 $ X( LDX , * ), WORK( * )
428 DOUBLE PRECISION R( * ), C( * ), PARAMS( * ), BERR( * ),
429 $ err_bnds_norm( nrhs, * ),
430 $ err_bnds_comp( nrhs, * ), rwork( * )
436 DOUBLE PRECISION ZERO, ONE
437 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
438 DOUBLE PRECISION ITREF_DEFAULT, ITHRESH_DEFAULT
439 DOUBLE PRECISION COMPONENTWISE_DEFAULT, RTHRESH_DEFAULT
440 DOUBLE PRECISION DZTHRESH_DEFAULT
441 parameter( itref_default = 1.0d+0 )
442 parameter( ithresh_default = 10.0d+0 )
443 parameter( componentwise_default = 1.0d+0 )
444 parameter( rthresh_default = 0.5d+0 )
445 parameter( dzthresh_default = 0.25d+0 )
446 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
448 parameter( la_linrx_itref_i = 1,
449 $ la_linrx_ithresh_i = 2 )
450 parameter( la_linrx_cwise_i = 3 )
451 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
453 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
454 parameter( la_linrx_rcond_i = 3 )
458 LOGICAL ROWEQU, COLEQU, NOTRAN
459 INTEGER J, TRANS_TYPE, PREC_TYPE, REF_TYPE
461 DOUBLE PRECISION ANORM, RCOND_TMP
462 DOUBLE PRECISION ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
465 DOUBLE PRECISION RTHRESH, UNSTABLE_THRESH
471 INTRINSIC max, sqrt, transfer
477 DOUBLE PRECISION DLAMCH, ZLANGE, ZLA_GERCOND_X, ZLA_GERCOND_C
479 INTEGER ILATRANS, ILAPREC
486 trans_type = ilatrans( trans )
487 ref_type = int( itref_default )
488 IF ( nparams .GE. la_linrx_itref_i )
THEN
489 IF ( params( la_linrx_itref_i ) .LT. 0.0d+0 )
THEN
490 params( la_linrx_itref_i ) = itref_default
492 ref_type = params( la_linrx_itref_i )
498 illrcond_thresh = dble( n ) * dlamch(
'Epsilon' )
499 ithresh = int( ithresh_default )
500 rthresh = rthresh_default
501 unstable_thresh = dzthresh_default
502 ignore_cwise = componentwise_default .EQ. 0.0d+0
504 IF ( nparams.GE.la_linrx_ithresh_i )
THEN
505 IF ( params( la_linrx_ithresh_i ).LT.0.0d+0 )
THEN
506 params(la_linrx_ithresh_i) = ithresh
508 ithresh = int( params( la_linrx_ithresh_i ) )
511 IF ( nparams.GE.la_linrx_cwise_i )
THEN
512 IF ( params( la_linrx_cwise_i ).LT.0.0d+0 )
THEN
513 IF ( ignore_cwise )
THEN
514 params( la_linrx_cwise_i ) = 0.0d+0
516 params( la_linrx_cwise_i ) = 1.0d+0
519 ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0d+0
522 IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 )
THEN
524 ELSE IF ( ignore_cwise )
THEN
530 notran = lsame( trans,
'N' )
531 rowequ = lsame( equed,
'R' ) .OR. lsame( equed,
'B' )
532 colequ = lsame( equed,
'C' ) .OR. lsame( equed,
'B' )
536 IF( trans_type.EQ.-1 )
THEN
538 ELSE IF( .NOT.rowequ .AND. .NOT.colequ .AND.
539 $ .NOT.lsame( equed,
'N' ) )
THEN
541 ELSE IF( n.LT.0 )
THEN
543 ELSE IF( nrhs.LT.0 )
THEN
545 ELSE IF( lda.LT.max( 1, n ) )
THEN
547 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
549 ELSE IF( ldb.LT.max( 1, n ) )
THEN
551 ELSE IF( ldx.LT.max( 1, n ) )
THEN
555 CALL xerbla(
'ZGERFSX', -info )
561 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
565 IF ( n_err_bnds .GE. 1 )
THEN
566 err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
567 err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
569 IF ( n_err_bnds .GE. 2 )
THEN
570 err_bnds_norm( j, la_linrx_err_i ) = 0.0d+0
571 err_bnds_comp( j, la_linrx_err_i ) = 0.0d+0
573 IF ( n_err_bnds .GE. 3 )
THEN
574 err_bnds_norm( j, la_linrx_rcond_i ) = 1.0d+0
575 err_bnds_comp( j, la_linrx_rcond_i ) = 1.0d+0
586 IF ( n_err_bnds .GE. 1 )
THEN
587 err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
588 err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
590 IF ( n_err_bnds .GE. 2 )
THEN
591 err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
592 err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
594 IF ( n_err_bnds .GE. 3 )
THEN
595 err_bnds_norm( j, la_linrx_rcond_i ) = 0.0d+0
596 err_bnds_comp( j, la_linrx_rcond_i ) = 0.0d+0
608 anorm = zlange( norm, n, n, a, lda, rwork )
609 CALL zgecon( norm, n, af, ldaf, anorm, rcond, work, rwork,
614 IF ( ref_type .NE. 0 )
THEN
616 prec_type = ilaprec(
'E' )
620 $ nrhs, a, lda, af, ldaf, ipiv, colequ, c, b,
621 $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
622 $ err_bnds_comp, work, rwork, work(n+1),
623 $ transfer(rwork(1:2*n), (/ (zero, zero) /), n),
624 $ rcond, ithresh, rthresh, unstable_thresh, ignore_cwise,
628 $ nrhs, a, lda, af, ldaf, ipiv, rowequ, r, b,
629 $ ldb, x, ldx, berr, n_norms, err_bnds_norm,
630 $ err_bnds_comp, work, rwork, work(n+1),
631 $ transfer(rwork(1:2*n), (/ (zero, zero) /), n),
632 $ rcond, ithresh, rthresh, unstable_thresh, ignore_cwise,
637 err_lbnd = max( 10.0d+0,
638 $ sqrt( dble( n ) ) ) * dlamch(
'Epsilon' )
639 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 1 )
THEN
643 IF ( colequ .AND. notran )
THEN
644 rcond_tmp = zla_gercond_c( trans, n, a, lda, af, ldaf,
646 $ c, .true., info, work, rwork )
647 ELSE IF ( rowequ .AND. .NOT. notran )
THEN
648 rcond_tmp = zla_gercond_c( trans, n, a, lda, af, ldaf,
650 $ r, .true., info, work, rwork )
652 rcond_tmp = zla_gercond_c( trans, n, a, lda, af, ldaf,
654 $ c, .false., info, work, rwork )
660 IF ( n_err_bnds .GE. la_linrx_err_i
661 $ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0d+0 )
662 $ err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
666 IF ( rcond_tmp .LT. illrcond_thresh )
THEN
667 err_bnds_norm( j, la_linrx_err_i ) = 1.0d+0
668 err_bnds_norm( j, la_linrx_trust_i ) = 0.0d+0
669 IF ( info .LE. n ) info = n + j
670 ELSE IF (err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd)
672 err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
673 err_bnds_norm( j, la_linrx_trust_i ) = 1.0d+0
678 IF ( n_err_bnds .GE. la_linrx_rcond_i )
THEN
679 err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
684 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 2 )
THEN
694 cwise_wrong = sqrt( dlamch(
'Epsilon' ) )
696 IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
698 rcond_tmp = zla_gercond_x( trans, n, a, lda, af, ldaf,
699 $ ipiv, x(1,j), info, work, rwork )
706 IF ( n_err_bnds .GE. la_linrx_err_i
707 $ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0d+0 )
708 $ err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
712 IF ( rcond_tmp .LT. illrcond_thresh )
THEN
713 err_bnds_comp( j, la_linrx_err_i ) = 1.0d+0
714 err_bnds_comp( j, la_linrx_trust_i ) = 0.0d+0
715 IF ( params( la_linrx_cwise_i ) .EQ. 1.0d+0
716 $ .AND. info.LT.n + j ) info = n + j
717 ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
718 $ .LT. err_lbnd )
THEN
719 err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
720 err_bnds_comp( j, la_linrx_trust_i ) = 1.0d+0
725 IF ( n_err_bnds .GE. la_linrx_rcond_i )
THEN
726 err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp