From 035aa4dfdb574ffec0002493175ed0b95ab76c23 Mon Sep 17 00:00:00 2001 From: Salvatore Filippone Date: Thu, 5 Apr 2007 11:32:50 +0000 Subject: [PATCH] Fixed check for restart in GMRES. Changed opt arg passing in KRYLOV. --- krylov/psb_dgmresr.f90 | 12 ++++- krylov/psb_krylov_mod.f90 | 99 ++++++--------------------------------- 2 files changed, 24 insertions(+), 87 deletions(-) diff --git a/krylov/psb_dgmresr.f90 b/krylov/psb_dgmresr.f90 index 51be70c2..0ddb3cef 100644 --- a/krylov/psb_dgmresr.f90 +++ b/krylov/psb_dgmresr.f90 @@ -164,7 +164,14 @@ Subroutine psb_dgmresr(a,prec,b,x,eps,desc_a,info,& nl = 10 If (debug) Write(0,*) 'not present: irst: ',irst,nl Endif - + if (nl <=0 ) then + write(0,*) 'psb_dgmres: invalid irst ',nl + info=5001 + int_err(1)=nl + err=info + call psb_errpush(info,name,i_err=int_err) + goto 9999 + endif naux=4*n_col Allocate(aux(naux),h(nl+1,nl+1),& @@ -290,6 +297,7 @@ Subroutine psb_dgmresr(a,prec,b,x,eps,desc_a,info,& endif if (rerr < eps ) then + if (debug) write(0,*) 'GMRES TRSM',i,size(h,1),nl call dtrsm('l','u','n','n',i,1,done,h,size(h,1),rs,nl) if (debug) write(0,*) 'Rebuild x-> RS:',rs(21:nl) do k=1, i @@ -303,7 +311,7 @@ Subroutine psb_dgmresr(a,prec,b,x,eps,desc_a,info,& end If end Do inner - if (debug) write(0,*) 'Before DTRSM :',rs(1:nl) + if (debug) write(0,*) 'Before DTRSM :',rs(1:nl),i,size(h,1),nl call dtrsm('l','u','n','n',nl,1,done,h,size(h,1),rs,nl) if (debug) write(0,*) 'Rebuild x-> RS:',rs(21:nl) do k=1, nl diff --git a/krylov/psb_krylov_mod.f90 b/krylov/psb_krylov_mod.f90 index 898e2659..2242ec25 100644 --- a/krylov/psb_krylov_mod.f90 +++ b/krylov/psb_krylov_mod.f90 @@ -196,66 +196,30 @@ contains Integer, Optional, Intent(out) :: iter Real(Kind(1.d0)), Optional, Intent(out) :: err - integer :: itmax_, itrace_, irst_, istop_, iter_ - real(kind(1.d0)) :: err_ - - if (present(itmax)) then - itmax_ = itmax - else - itmax_ = 1000 - end if - - if (present(itrace)) then - itrace_ = itrace - else - itrace_ = -1 - end if - - if (present(irst)) then - irst_ = irst - else - irst_ = 1 - end if - - if (present(istop)) then - istop_ = istop - else - istop_ = 1 - end if - - select case(toupper(method)) case('CG') call psb_cg(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) case('CGS') call psb_cgs(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) case('BICG') call psb_bicg(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) case('BICGSTAB') call psb_bicgstab(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) case('RGMRES') call psb_rgmres(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,irst_,istop_) + &itmax,iter,err,itrace,irst,istop) case('BICGSTABL') call psb_bicgstabl(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,irst_,istop_) + &itmax,iter,err,itrace,irst,istop) case default call psb_bicgstab(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) end select - if (present(err)) then - err = err_ - endif - - if (present(iter)) then - iter = iter_ - endif - end subroutine psb_dkrylov @@ -275,66 +239,31 @@ contains Integer, Optional, Intent(out) :: iter Real(Kind(1.d0)), Optional, Intent(out) :: err - integer :: itmax_, itrace_, irst_, istop_, iter_ - real(kind(1.d0)) :: err_ - - if (present(itmax)) then - itmax_ = itmax - else - itmax_ = 1000 - end if - - if (present(itrace)) then - itrace_ = itrace - else - itrace_ = -1 - end if - - if (present(irst)) then - irst_ = irst - else - irst_ = 1 - end if - - if (present(istop)) then - istop_ = istop - else - istop_ = 1 - end if - select case(toupper(method)) !!$ case('CG') !!$ call psb_cg(a,prec,b,x,eps,desc_a,info,& -!!$ &itmax_,iter_,err_,itrace_,istop_) +!!$ &itmax,iter,err,itrace,istop) case('CGS') call psb_cgs(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) !!$ case('BICG') !!$ call psb_bicg(a,prec,b,x,eps,desc_a,info,& -!!$ &itmax_,iter_,err_,itrace_,istop_) +!!$ &itmax,iter,err,itrace,istop) case('BICGSTAB') call psb_bicgstab(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) !!$ case('RGMRES') !!$ call psb_rgmres(a,prec,b,x,eps,desc_a,info,& -!!$ &itmax_,iter_,err_,itrace_,irst_,istop_) +!!$ &itmax,iter,err,itrace,irst,istop) !!$ case('BICGSTABL') !!$ call psb_bicgstabl(a,prec,b,x,eps,desc_a,info,& -!!$ &itmax_,iter_,err_,itrace_,irst_,istop_) +!!$ &itmax,iter,err,itrace,irst,istop) case default call psb_bicgstab(a,prec,b,x,eps,desc_a,info,& - &itmax_,iter_,err_,itrace_,istop_) + &itmax,iter,err,itrace,istop) end select - if (present(err)) then - err = err_ - endif - - if (present(iter)) then - iter = iter_ - endif - end subroutine psb_zkrylov