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 COMPLEX 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
442 INTEGER UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
443 $ NOPROG_STATE, BASE_RESIDUAL, EXTRA_RESIDUAL,
445 parameter( unstable_state = 0, working_state = 1,
446 $ conv_state = 2, noprog_state = 3 )
447 parameter( base_residual = 0, extra_residual = 1,
449 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
450 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
451 INTEGER CMP_ERR_I, PIV_GROWTH_I
452 parameter( final_nrm_err_i = 1, final_cmp_err_i = 2,
454 parameter( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
455 parameter( cmp_rcond_i = 7, cmp_err_i = 8,
457 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
459 parameter( la_linrx_itref_i = 1,
460 $ la_linrx_ithresh_i = 2 )
461 parameter( la_linrx_cwise_i = 3 )
462 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
464 parameter( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
465 parameter( la_linrx_rcond_i = 3 )
473 CHARACTER CHLA_TRANSTYPE
476 INTRINSIC abs, max, min
482 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
486 IF (info.NE.0)
RETURN
487 trans = chla_transtype(trans_type)
488 eps = slamch(
'Epsilon' )
489 hugeval = slamch(
'Overflow' )
491 hugeval = hugeval * hugeval
493 incr_thresh = real( n ) * eps
497 y_prec_state = extra_residual
498 IF ( y_prec_state .EQ. extra_y )
then
515 x_state = working_state
516 z_state = unstable_state
524 CALL ccopy( n, b( 1, j ), 1, res, 1 )
525 IF ( y_prec_state .EQ. base_residual )
THEN
526 CALL cgbmv( trans, m, n, kl, ku, (-1.0e+0,0.0e+0), ab,
527 $ ldab, y( 1, j ), 1, (1.0e+0,0.0e+0), res, 1 )
528 ELSE IF ( y_prec_state .EQ. extra_residual )
THEN
529 CALL blas_cgbmv_x( trans_type, n, n, kl, ku,
530 $ (-1.0e+0,0.0e+0), ab, ldab, y( 1, j ), 1,
531 $ (1.0e+0,0.0e+0), res, 1, prec_type )
533 CALL blas_cgbmv2_x( trans_type, n, n, kl, ku,
534 $ (-1.0e+0,0.0e+0), ab, ldab, y( 1, j ), y_tail, 1,
535 $ (1.0e+0,0.0e+0), res, 1, prec_type )
539 CALL ccopy( n, res, 1, dy, 1 )
540 CALL cgbtrs( trans, n, kl, ku, 1, afb, ldafb, ipiv, dy,
553 yk = cabs1( y( i, j ) )
554 dyk = cabs1( dy( i ) )
556 IF (yk .NE. 0.0)
THEN
557 dz_z = max( dz_z, dyk / yk )
558 ELSE IF ( dyk .NE. 0.0 )
THEN
562 ymin = min( ymin, yk )
564 normy = max( normy, yk )
567 normx = max( normx, yk * c( i ) )
568 normdx = max(normdx, dyk * c(i))
571 normdx = max( normdx, dyk )
575 IF ( normx .NE. 0.0 )
THEN
576 dx_x = normdx / normx
577 ELSE IF ( normdx .EQ. 0.0 )
THEN
583 dxrat = normdx / prevnormdx
584 dzrat = dz_z / prev_dz_z
588 IF (.NOT.ignore_cwise
589 $ .AND. ymin*rcond .LT. incr_thresh*normy
590 $ .AND. y_prec_state .LT. extra_y )
593 IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
594 $ x_state = working_state
595 IF ( x_state .EQ. working_state )
THEN
596 IF ( dx_x .LE. eps )
THEN
598 ELSE IF ( dxrat .GT. rthresh )
THEN
599 IF ( y_prec_state .NE. extra_y )
THEN
602 x_state = noprog_state
605 IF ( dxrat .GT. dxratmax ) dxratmax = dxrat
607 IF ( x_state .GT. working_state ) final_dx_x = dx_x
610 IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
611 $ z_state = working_state
612 IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
613 $ z_state = working_state
614 IF ( z_state .EQ. working_state )
THEN
615 IF ( dz_z .LE. eps )
THEN
617 ELSE IF ( dz_z .GT. dz_ub )
THEN
618 z_state = unstable_state
621 ELSE IF ( dzrat .GT. rthresh )
THEN
622 IF ( y_prec_state .NE. extra_y )
THEN
625 z_state = noprog_state
628 IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
630 IF ( z_state .GT. working_state ) final_dz_z = dz_z
637 IF ( x_state.NE.working_state )
THEN
638 IF ( ignore_cwise )
GOTO 666
639 IF ( z_state.EQ.noprog_state .OR. z_state.EQ.conv_state )
641 IF ( z_state.EQ.unstable_state .AND. cnt.GT.1 )
GOTO 666
644 IF ( incr_prec )
THEN
646 y_prec_state = y_prec_state + 1
657 IF ( y_prec_state .LT. extra_y )
THEN
658 CALL caxpy( n, (1.0e+0,0.0e+0), dy, 1, y(1,j), 1 )
669 IF ( x_state .EQ. working_state ) final_dx_x = dx_x
670 IF ( z_state .EQ. working_state ) final_dz_z = dz_z
674 IF ( n_norms .GE. 1 )
THEN
675 err_bnds_norm( j, la_linrx_err_i ) =
676 $ final_dx_x / (1 - dxratmax)
678 IF ( n_norms .GE. 2 )
THEN
679 err_bnds_comp( j, la_linrx_err_i ) =
680 $ final_dz_z / (1 - dzratmax)
691 CALL ccopy( n, b( 1, j ), 1, res, 1 )
692 CALL cgbmv( trans, n, n, kl, ku, (-1.0e+0,0.0e+0), ab, ldab,
693 $ y(1,j), 1, (1.0e+0,0.0e+0), res, 1 )
696 ayb( i ) = cabs1( b( i, j ) )
701 CALL cla_gbamv( trans_type, n, n, kl, ku, 1.0e+0,
702 $ ab, ldab, y(1, j), 1, 1.0e+0, ayb, 1 )