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 )
466 INTRINSIC abs, max, min
470 IF ( info.NE.0 ) return
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 )