394 $ lda, af, ldaf, ipiv, colequ, c, b,
395 $ ldb, y, ldy, berr_out, n_norms,
396 $ errs_n, errs_c, res,
397 $ ayb, dy, y_tail, rcond, ithresh,
398 $ rthresh, dz_ub, ignore_cwise,
407 INTEGER INFO, LDA, LDAF, LDB, LDY, N, NRHS, PREC_TYPE,
408 $ trans_type, n_norms, ithresh
409 LOGICAL COLEQU, IGNORE_CWISE
414 REAL A( lda, * ), AF( ldaf, * ), B( ldb, * ),
415 $ y( ldy, * ), res( * ), dy( * ), y_tail( * )
416 REAL C( * ), AYB( * ), RCOND, BERR_OUT( * ),
425 INTEGER CNT, I, J, X_STATE, Z_STATE, Y_PREC_STATE
426 REAL YK, DYK, YMIN, NORMY, NORMX, NORMDX, DXRAT,
427 $ dzrat, prevnormdx, prev_dz_z, dxratmax,
428 $ dzratmax, dx_x, dz_z, final_dx_x, final_dz_z,
429 $ eps, hugeval, incr_thresh
433 INTEGER UNSTABLE_STATE, WORKING_STATE, CONV_STATE,
434 $ noprog_state, base_residual, extra_residual,
436 parameter ( unstable_state = 0, working_state = 1,
437 $ conv_state = 2, noprog_state = 3 )
438 parameter ( base_residual = 0, extra_residual = 1,
440 INTEGER FINAL_NRM_ERR_I, FINAL_CMP_ERR_I, BERR_I
441 INTEGER RCOND_I, NRM_RCOND_I, NRM_ERR_I, CMP_RCOND_I
442 INTEGER CMP_ERR_I, PIV_GROWTH_I
443 parameter ( final_nrm_err_i = 1, final_cmp_err_i = 2,
445 parameter ( rcond_i = 4, nrm_rcond_i = 5, nrm_err_i = 6 )
446 parameter ( cmp_rcond_i = 7, cmp_err_i = 8,
448 INTEGER LA_LINRX_ITREF_I, LA_LINRX_ITHRESH_I,
450 parameter ( la_linrx_itref_i = 1,
451 $ la_linrx_ithresh_i = 2 )
452 parameter ( la_linrx_cwise_i = 3 )
453 INTEGER LA_LINRX_TRUST_I, LA_LINRX_ERR_I,
455 parameter ( la_linrx_trust_i = 1, la_linrx_err_i = 2 )
456 parameter ( la_linrx_rcond_i = 3 )
463 CHARACTER CHLA_TRANSTYPE
466 INTRINSIC abs, max, min
470 IF ( info.NE.0 )
RETURN
471 trans = chla_transtype(trans_type)
472 eps = slamch(
'Epsilon' )
473 hugeval = slamch(
'Overflow' )
475 hugeval = hugeval * hugeval
477 incr_thresh =
REAL( N ) * EPS
480 y_prec_state = extra_residual
481 IF ( y_prec_state .EQ. extra_y )
THEN
498 x_state = working_state
499 z_state = unstable_state
507 CALL scopy( n, b( 1, j ), 1, res, 1 )
508 IF ( y_prec_state .EQ. base_residual )
THEN
509 CALL sgemv( trans, n, n, -1.0, a, lda, y( 1, j ), 1,
511 ELSE IF ( y_prec_state .EQ. extra_residual )
THEN
512 CALL blas_sgemv_x( trans_type, n, n, -1.0, a, lda,
513 $ y( 1, j ), 1, 1.0, res, 1, prec_type )
515 CALL blas_sgemv2_x( trans_type, n, n, -1.0, a, lda,
516 $ y( 1, j ), y_tail, 1, 1.0, res, 1, prec_type )
520 CALL scopy( n, res, 1, dy, 1 )
521 CALL sgetrs( trans, n, 1, af, ldaf, ipiv, dy, n, info )
532 yk = abs( y( i, j ) )
535 IF ( yk .NE. 0.0 )
THEN
536 dz_z = max( dz_z, dyk / yk )
537 ELSE IF ( dyk .NE. 0.0 )
THEN
541 ymin = min( ymin, yk )
543 normy = max( normy, yk )
546 normx = max( normx, yk * c( i ) )
547 normdx = max( normdx, dyk * c( i ) )
550 normdx = max( normdx, dyk )
554 IF ( normx .NE. 0.0 )
THEN
555 dx_x = normdx / normx
556 ELSE IF ( normdx .EQ. 0.0 )
THEN
562 dxrat = normdx / prevnormdx
563 dzrat = dz_z / prev_dz_z
567 IF (.NOT.ignore_cwise
568 $ .AND. ymin*rcond .LT. incr_thresh*normy
569 $ .AND. y_prec_state .LT. extra_y)
572 IF ( x_state .EQ. noprog_state .AND. dxrat .LE. rthresh )
573 $ x_state = working_state
574 IF ( x_state .EQ. working_state )
THEN
575 IF ( dx_x .LE. eps )
THEN
577 ELSE IF ( dxrat .GT. rthresh )
THEN
578 IF ( y_prec_state .NE. extra_y )
THEN
581 x_state = noprog_state
584 IF ( dxrat .GT. dxratmax ) dxratmax = dxrat
586 IF ( x_state .GT. working_state ) final_dx_x = dx_x
589 IF ( z_state .EQ. unstable_state .AND. dz_z .LE. dz_ub )
590 $ z_state = working_state
591 IF ( z_state .EQ. noprog_state .AND. dzrat .LE. rthresh )
592 $ z_state = working_state
593 IF ( z_state .EQ. working_state )
THEN
594 IF ( dz_z .LE. eps )
THEN
596 ELSE IF ( dz_z .GT. dz_ub )
THEN
597 z_state = unstable_state
600 ELSE IF ( dzrat .GT. rthresh )
THEN
601 IF ( y_prec_state .NE. extra_y )
THEN
604 z_state = noprog_state
607 IF ( dzrat .GT. dzratmax ) dzratmax = dzrat
609 IF ( z_state .GT. working_state ) final_dz_z = dz_z
616 IF ( x_state.NE.working_state )
THEN
617 IF ( ignore_cwise)
GOTO 666
618 IF ( z_state.EQ.noprog_state .OR. z_state.EQ.conv_state )
620 IF ( z_state.EQ.unstable_state .AND. cnt.GT.1 )
GOTO 666
623 IF ( incr_prec )
THEN
625 y_prec_state = y_prec_state + 1
636 IF ( y_prec_state .LT. extra_y )
THEN
637 CALL saxpy( n, 1.0, dy, 1, y( 1, j ), 1 )
648 IF ( x_state .EQ. working_state ) final_dx_x = dx_x
649 IF ( z_state .EQ. working_state ) final_dz_z = dz_z
653 IF (n_norms .GE. 1)
THEN
654 errs_n( j, la_linrx_err_i ) =
655 $ final_dx_x / (1 - dxratmax)
657 IF ( n_norms .GE. 2 )
THEN
658 errs_c( j, la_linrx_err_i ) =
659 $ final_dz_z / (1 - dzratmax)
670 CALL scopy( n, b( 1, j ), 1, res, 1 )
671 CALL sgemv( trans, n, n, -1.0, a, lda, y(1,j), 1, 1.0, res, 1 )
674 ayb( i ) = abs( b( i, j ) )
680 $ a, lda, y(1, j), 1, 1.0, ayb, 1 )
subroutine sgetrs(TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SGETRS
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
character *1 function chla_transtype(TRANS)
CHLA_TRANSTYPE
subroutine sla_geamv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SLA_GEAMV computes a matrix-vector product using a general matrix to calculate error bounds...
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
subroutine sla_gerfsx_extended(PREC_TYPE, TRANS_TYPE, N, NRHS, A, LDA, AF, LDAF, IPIV, COLEQU, C, B, LDB, Y, LDY, BERR_OUT, N_NORMS, ERRS_N, ERRS_C, RES, AYB, DY, Y_TAIL, RCOND, ITHRESH, RTHRESH, DZ_UB, IGNORE_CWISE, INFO)
SLA_GERFSX_EXTENDED improves the computed solution to a system of linear equations for general matric...
real function slamch(CMACH)
SLAMCH
subroutine sla_lin_berr(N, NZ, NRHS, RES, AYB, BERR)
SLA_LIN_BERR computes a component-wise relative backward error.
subroutine sla_wwaddw(N, X, Y, W)
SLA_WWADDW adds a vector into a doubled-single vector.
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY