mirror of
https://github.com/sfilippone/psblas3.git
synced 2026-10-20 12:52:14 +00:00
New stop criteria
This commit is contained in:
@@ -104,7 +104,7 @@
|
||||
!
|
||||
!
|
||||
subroutine psb_dfcg_vect(a,prec,b,x,eps,desc_a,info,&
|
||||
& itmax,iter,err,itrace,istop,cond)
|
||||
& itmax,iter,err,itrace,istop,cond,s1,s2)
|
||||
use psb_base_mod
|
||||
use psb_prec_mod
|
||||
use psb_d_linsolve_conv_mod
|
||||
@@ -120,6 +120,7 @@ subroutine psb_dfcg_vect(a,prec,b,x,eps,desc_a,info,&
|
||||
integer(psb_ipk_), Optional, Intent(in) :: itmax, itrace, istop
|
||||
integer(psb_ipk_), Optional, Intent(out) :: iter
|
||||
real(psb_dpk_), Optional, Intent(out) :: err,cond
|
||||
type(psb_d_vect_type), intent(inout), optional :: s1, s2
|
||||
! = Local data
|
||||
type(psb_d_vect_type) :: v, w, d , q, r
|
||||
real(psb_dpk_) :: alpha, beta, delta, gamma, theta
|
||||
@@ -164,9 +165,29 @@ subroutine psb_dfcg_vect(a,prec,b,x,eps,desc_a,info,&
|
||||
if (present(istop)) then
|
||||
istop_ = istop
|
||||
else
|
||||
istop_ = 2
|
||||
istop_ = psb_get_istop_default()
|
||||
endif
|
||||
|
||||
if (.not.psb_is_valid_istop(istop_)) then
|
||||
info=psb_err_invalid_istop_
|
||||
err=info
|
||||
call psb_errpush(info,name,i_err=(/istop_/))
|
||||
goto 9999
|
||||
end if
|
||||
!
|
||||
! istop_ = 1: normwise backward error, infinity norm
|
||||
! istop_ = 2: ||r||/||b|| norm 2
|
||||
!
|
||||
select case(istop_)
|
||||
case(psb_istop_ani_,psb_istop_bn2_,&
|
||||
& psb_istop_rn2_abs_, psb_istop_rrn2_)
|
||||
! nothing needed
|
||||
case default
|
||||
! should never get here
|
||||
info=psb_err_internal_error_
|
||||
err=info
|
||||
call psb_errpush(info,name,a_err="invalid istop_")
|
||||
goto 9999
|
||||
end select
|
||||
|
||||
call psb_chkvect(mglob,lone,x%get_nrows(),lone,lone,desc_a,info)
|
||||
if (info == psb_success_)&
|
||||
@@ -207,7 +228,7 @@ subroutine psb_dfcg_vect(a,prec,b,x,eps,desc_a,info,&
|
||||
& scratch=.true.,mold=x%v)
|
||||
|
||||
call psb_init_conv(methdname,istop_,itrace_,itmax_,&
|
||||
& a,x,b,eps,desc_a,stopdat,info)
|
||||
& a,x,b,eps,desc_a,stopdat,info,s1=s1,s2=s2)
|
||||
itx = 0
|
||||
|
||||
restart: do
|
||||
@@ -226,7 +247,7 @@ subroutine psb_dfcg_vect(a,prec,b,x,eps,desc_a,info,&
|
||||
end if
|
||||
|
||||
|
||||
if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) then
|
||||
if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info,s1=s1)) then
|
||||
if (debug.and.(me==0)) write(0,*) name,' Exit on convergence from restart'
|
||||
exit restart
|
||||
end if
|
||||
@@ -282,7 +303,7 @@ subroutine psb_dfcg_vect(a,prec,b,x,eps,desc_a,info,&
|
||||
|
||||
itx = itx + 1
|
||||
|
||||
if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info)) then
|
||||
if (psb_check_conv(methdname,itx,x,r,desc_a,stopdat,info,s1=s1)) then
|
||||
if (debug.and.(me==0)) write(0,*) name,' Exit on convergence from iteration'
|
||||
exit restart
|
||||
end if
|
||||
|
||||
Reference in New Issue
Block a user