403 $ NRHS, AB, LDAB, AFB, LDAFB, IPIV,
404 $ COLEQU, C, B, LDB, Y, LDY,
405 $ BERR_OUT, N_NORMS, ERR_BNDS_NORM,
406 $ ERR_BNDS_COMP, RES, AYB, DY,
407 $ Y_TAIL, RCOND, ITHRESH, RTHRESH,
408 $ DZ_UB, IGNORE_CWISE, INFO )
415 INTEGER INFO, LDAB, LDAFB, LDB, LDY, N, KL, KU, NRHS,
416 $ PREC_TYPE, TRANS_TYPE, N_NORMS, ITHRESH
417 LOGICAL COLEQU, IGNORE_CWISE
422 REAL AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
423 $ Y( LDY, * ), RES(*), DY(*), Y_TAIL(*)
424 REAL C( * ), AYB(*), RCOND, BERR_OUT(*),
425 $ err_bnds_norm( nrhs, * ),
426 $ err_bnds_comp( nrhs, * )
433 INTEGER CNT, I, J, M, X_STATE, Z_STATE, Y_PREC_STATE
434 REAL YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
435 $ DZRAT, PREVNORMDX, PREV_DZ_Z, DXRATMAX,
436 $ DZRATMAX, DX_X, DZ_Z, FINAL_DX_X, FINAL_DZ_Z,
437 $ EPS, HUGEVAL, INCR_THRESH
441 INTEGER UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
442 $ NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
444 PARAMETER ( UNSTABLE_STATE = 0, working_state = 1,
445 $ conv_state = 2, noprog_state = 3 )
446 parameter( base_residual = 0, extra_residual = 1,
448 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
449 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
450 INTEGER CMP_ERR_I, PIV_GROWTH_I
451 parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
453 parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
454 parameter( cmp_rcond_i = 7, cmp_err_i = 8,
456 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
458 parameter( la_linrx_itref_i = 1,
459 $ la_linrx_ithresh_i = 2 )
460 parameter( la_linrx_cwise_i = 3 )
461 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
463 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
464 parameter( la_linrx_rcond_i = 3 )
472 CHARACTER CHLA_TRANSTYPE
475 INTRINSIC abs, max, min
479 IF (info.NE.0)
RETURN
480 trans = chla_transtype(trans_type)
481 eps = slamch(
'Epsilon' )
482 hugeval = slamch(
'Overflow' )
484 hugeval = hugeval * hugeval
486 incr_thresh = real( n ) * eps
490 y_prec_state = extra_residual
491 IF ( y_prec_state .EQ. extra_y )
THEN
508 x_state = working_state
509 z_state = unstable_state
517 CALL scopy( n, b( 1, j ), 1, res, 1 )
518 IF ( y_prec_state .EQ. base_residual )
THEN
519 CALL sgbmv( trans, m, n, kl, ku, -1.0, ab, ldab,
520 $ y( 1, j ), 1, 1.0, res, 1 )
521 ELSE IF ( y_prec_state .EQ. extra_residual )
THEN
522 CALL blas_sgbmv_x( trans_type, n, n, kl, ku,
523 $ -1.0, ab, ldab, y( 1, j ), 1, 1.0, res, 1,
526 CALL blas_sgbmv2_x( trans_type, n, n, kl, ku, -1.0,
527 $ ab, ldab, y( 1, j ), y_tail, 1, 1.0, res, 1,
532 CALL scopy( n, res, 1, dy, 1 )
533 CALL sgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv, dy,
546 yk = abs( y( i, j ) )
549 IF ( yk .NE. 0.0 )
THEN
550 dz_z = max( dz_z, dyk / yk )
551 ELSE IF ( dyk .NE. 0.0 )
THEN
555 ymin = min( ymin, yk )
557 normy = max( normy, yk )
560 normx = max( normx, yk * c( i ) )
561 normdx = max( normdx, dyk * c( i ) )
564 normdx = max( normdx, dyk )
568 IF ( normx .NE. 0.0 )
THEN
569 dx_x = normdx / normx
570 ELSE IF ( normdx .EQ. 0.0 )
THEN
576 dxrat = normdx / prevnormdx
577 dzrat = dz_z / prev_dz_z
581 IF ( .NOT.ignore_cwise
582 $ .AND. ymin*rcond .LT. incr_thresh*normy
583 $ .AND. y_prec_state .LT. extra_y )
586 IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
587 $ x_state = working_state
588 IF ( x_state .EQ. working_state )
THEN
589 IF ( dx_x .LE. eps )
THEN
591 ELSE IF ( dxrat .GT. rthresh )
THEN
592 IF ( y_prec_state .NE. extra_y )
THEN
595 x_state = noprog_state
598 IF ( dxrat .GT. dxratmax ) dxratmax = dxrat
600 IF ( x_state .GT. working_state ) final_dx_x = dx_x
603 IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
604 $ z_state = working_state
605 IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
606 $ z_state = working_state
607 IF ( z_state .EQ. working_state )
THEN
608 IF ( dz_z .LE. eps )
THEN
610 ELSE IF ( dz_z .GT. dz_ub )
THEN
611 z_state = unstable_state
614 ELSE IF ( dzrat .GT. rthresh )
THEN
615 IF ( y_prec_state .NE. extra_y )
THEN
618 z_state = noprog_state
621 IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
623 IF ( z_state .GT. working_state ) final_dz_z = dz_z
630 IF ( x_state.NE.working_state )
THEN
631 IF ( ignore_cwise )
GOTO 666
632 IF ( z_state.EQ.noprog_state .OR. z_state.EQ.conv_state )
634 IF ( z_state.EQ.unstable_state .AND. cnt.GT.1 )
GOTO 666
637 IF ( incr_prec )
THEN
639 y_prec_state = y_prec_state + 1
650 IF (y_prec_state .LT. extra_y)
THEN
651 CALL saxpy( n, 1.0, dy, 1, y(1,j), 1 )
662 IF ( x_state .EQ. working_state ) final_dx_x = dx_x
663 IF ( z_state .EQ. working_state ) final_dz_z = dz_z
667 IF ( n_norms .GE. 1 )
THEN
668 err_bnds_norm( j, la_linrx_err_i ) =
669 $ final_dx_x / (1 - dxratmax)
671 IF (n_norms .GE. 2)
THEN
672 err_bnds_comp( j, la_linrx_err_i ) =
673 $ final_dz_z / (1 - dzratmax)
684 CALL scopy( n, b( 1, j ), 1, res, 1 )
685 CALL sgbmv(trans, n, n, kl, ku, -1.0, ab, ldab, y(1,j),
689 ayb( i ) = abs( b( i, j ) )
694 CALL sla_gbamv( trans_type, n, n, kl, ku, 1.0,
695 $ ab, ldab, y(1, j), 1, 1.0, ayb, 1 )