395 SUBROUTINE cherfsx( UPLO, EQUED, N, NRHS, A, LDA, AF, LDAF,
397 $ S, B, LDB, X, LDX, RCOND, BERR, N_ERR_BNDS,
398 $ ERR_BNDS_NORM, ERR_BNDS_COMP, NPARAMS, PARAMS,
399 $ WORK, RWORK, INFO )
406 CHARACTER UPLO, EQUED
407 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS, NPARAMS,
413 COMPLEX A( LDA, * ), AF( LDAF, * ), B( LDB, * ),
414 $ X( LDX, * ), WORK( * )
415 REAL S( * ), PARAMS( * ), BERR( * ), RWORK( * ),
416 $ err_bnds_norm( nrhs, * ),
417 $ err_bnds_comp( nrhs, * )
423 PARAMETER ( ZERO = 0.0e+0, one = 1.0e+0 )
424 REAL ITREF_DEFAULT, ITHRESH_DEFAULT,
425 $ COMPONENTWISE_DEFAULT
426 REAL RTHRESH_DEFAULT, DZTHRESH_DEFAULT
427 parameter( itref_default = 1.0 )
428 parameter( ithresh_default = 10.0 )
429 parameter( componentwise_default = 1.0 )
430 parameter( rthresh_default = 0.5 )
431 parameter( dzthresh_default = 0.25 )
432 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
434 parameter( la_linrx_itref_i = 1,
435 $ la_linrx_ithresh_i = 2 )
436 parameter( la_linrx_cwise_i = 3 )
437 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
439 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
440 parameter( la_linrx_rcond_i = 3 )
445 INTEGER J, PREC_TYPE, REF_TYPE
447 REAL ANORM, RCOND_TMP
448 REAL ILLRCOND_THRESH, ERR_LBND, CWISE_WRONG
451 REAL RTHRESH, UNSTABLE_THRESH
457 INTRINSIC max, sqrt, transfer
463 REAL SLAMCH, CLANHE, CLA_HERCOND_X, CLA_HERCOND_C
472 ref_type = int( itref_default )
473 IF ( nparams .GE. la_linrx_itref_i )
THEN
474 IF ( params( la_linrx_itref_i ) .LT. 0.0 )
THEN
475 params( la_linrx_itref_i ) = itref_default
477 ref_type = params( la_linrx_itref_i )
483 illrcond_thresh = real( n ) * slamch(
'Epsilon' )
484 ithresh = int( ithresh_default )
485 rthresh = rthresh_default
486 unstable_thresh = dzthresh_default
487 ignore_cwise = componentwise_default .EQ. 0.0
489 IF ( nparams.GE.la_linrx_ithresh_i )
THEN
490 IF ( params( la_linrx_ithresh_i ).LT.0.0 )
THEN
491 params( la_linrx_ithresh_i ) = ithresh
493 ithresh = int( params( la_linrx_ithresh_i ) )
496 IF ( nparams.GE.la_linrx_cwise_i )
THEN
497 IF ( params(la_linrx_cwise_i ).LT.0.0 )
THEN
498 IF ( ignore_cwise )
THEN
499 params( la_linrx_cwise_i ) = 0.0
501 params( la_linrx_cwise_i ) = 1.0
504 ignore_cwise = params( la_linrx_cwise_i ) .EQ. 0.0
507 IF ( ref_type .EQ. 0 .OR. n_err_bnds .EQ. 0 )
THEN
509 ELSE IF ( ignore_cwise )
THEN
515 rcequ = lsame( equed,
'Y' )
519 IF (.NOT.lsame( uplo,
'U' ) .AND.
520 $ .NOT.lsame( uplo,
'L' ) )
THEN
522 ELSE IF( .NOT.rcequ .AND. .NOT.lsame( equed,
'N' ) )
THEN
524 ELSE IF( n.LT.0 )
THEN
526 ELSE IF( nrhs.LT.0 )
THEN
528 ELSE IF( lda.LT.max( 1, n ) )
THEN
530 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
532 ELSE IF( ldb.LT.max( 1, n ) )
THEN
534 ELSE IF( ldx.LT.max( 1, n ) )
THEN
538 CALL xerbla(
'CHERFSX', -info )
544 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
548 IF ( n_err_bnds .GE. 1 )
THEN
549 err_bnds_norm( j, la_linrx_trust_i ) = 1.0
550 err_bnds_comp( j, la_linrx_trust_i ) = 1.0
552 IF ( n_err_bnds .GE. 2 )
THEN
553 err_bnds_norm( j, la_linrx_err_i ) = 0.0
554 err_bnds_comp( j, la_linrx_err_i ) = 0.0
556 IF ( n_err_bnds .GE. 3 )
THEN
557 err_bnds_norm( j, la_linrx_rcond_i ) = 1.0
558 err_bnds_comp( j, la_linrx_rcond_i ) = 1.0
569 IF ( n_err_bnds .GE. 1 )
THEN
570 err_bnds_norm( j, la_linrx_trust_i ) = 1.0
571 err_bnds_comp( j, la_linrx_trust_i ) = 1.0
573 IF ( n_err_bnds .GE. 2 )
THEN
574 err_bnds_norm( j, la_linrx_err_i ) = 1.0
575 err_bnds_comp( j, la_linrx_err_i ) = 1.0
577 IF ( n_err_bnds .GE. 3 )
THEN
578 err_bnds_norm( j, la_linrx_rcond_i ) = 0.0
579 err_bnds_comp( j, la_linrx_rcond_i ) = 0.0
587 anorm = clanhe( norm, uplo, n, a, lda, rwork )
588 CALL checon( uplo, n, af, ldaf, ipiv, anorm, rcond, work,
593 IF ( ref_type .NE. 0 )
THEN
595 prec_type = ilaprec(
'D' )
598 $ nrhs, a, lda, af, ldaf, ipiv, rcequ, s, b,
599 $ ldb, x, ldx, berr, n_norms, err_bnds_norm, err_bnds_comp,
600 $ work, rwork, work(n+1),
601 $ transfer(rwork(1:2*n), (/ (zero, zero) /), n), rcond,
602 $ ithresh, rthresh, unstable_thresh, ignore_cwise,
606 err_lbnd = max( 10.0, sqrt( real( n ) ) ) * slamch(
'Epsilon' )
607 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 1 )
THEN
612 rcond_tmp = cla_hercond_c( uplo, n, a, lda, af, ldaf,
614 $ s, .true., info, work, rwork )
616 rcond_tmp = cla_hercond_c( uplo, n, a, lda, af, ldaf,
618 $ s, .false., info, work, rwork )
624 IF ( n_err_bnds .GE. la_linrx_err_i
625 $ .AND. err_bnds_norm( j, la_linrx_err_i ) .GT. 1.0 )
626 $ err_bnds_norm( j, la_linrx_err_i ) = 1.0
630 IF (rcond_tmp .LT. illrcond_thresh)
THEN
631 err_bnds_norm( j, la_linrx_err_i ) = 1.0
632 err_bnds_norm( j, la_linrx_trust_i ) = 0.0
633 IF ( info .LE. n ) info = n + j
634 ELSE IF ( err_bnds_norm( j, la_linrx_err_i ) .LT. err_lbnd )
636 err_bnds_norm( j, la_linrx_err_i ) = err_lbnd
637 err_bnds_norm( j, la_linrx_trust_i ) = 1.0
642 IF ( n_err_bnds .GE. la_linrx_rcond_i )
THEN
643 err_bnds_norm( j, la_linrx_rcond_i ) = rcond_tmp
648 IF ( n_err_bnds .GE. 1 .AND. n_norms .GE. 2 )
THEN
658 cwise_wrong = sqrt( slamch(
'Epsilon' ) )
660 IF ( err_bnds_comp( j, la_linrx_err_i ) .LT. cwise_wrong )
662 rcond_tmp = cla_hercond_x( uplo, n, a, lda, af, ldaf,
663 $ ipiv, x( 1, j ), info, work, rwork )
670 IF ( n_err_bnds .GE. la_linrx_err_i
671 $ .AND. err_bnds_comp( j, la_linrx_err_i ) .GT. 1.0 )
672 $ err_bnds_comp( j, la_linrx_err_i ) = 1.0
676 IF ( rcond_tmp .LT. illrcond_thresh )
THEN
677 err_bnds_comp( j, la_linrx_err_i ) = 1.0
678 err_bnds_comp( j, la_linrx_trust_i ) = 0.0
679 IF ( .NOT. ignore_cwise
680 $ .AND. info.LT.n + j ) info = n + j
681 ELSE IF ( err_bnds_comp( j, la_linrx_err_i )
682 $ .LT. err_lbnd )
THEN
683 err_bnds_comp( j, la_linrx_err_i ) = err_lbnd
684 err_bnds_comp( j, la_linrx_trust_i ) = 1.0
689 IF ( n_err_bnds .GE. la_linrx_rcond_i )
THEN
690 err_bnds_comp( j, la_linrx_rcond_i ) = rcond_tmp