diff --git a/fvnlib.f90 b/fvnlib.f90 index baf1248..e49511b 100644 --- a/fvnlib.f90 +++ b/fvnlib.f90 @@ -2510,21 +2510,25 @@ implicit none double precision, external :: f double precision, intent(in) :: a,b,epsabs,epsrel integer, intent(in) :: key -integer, intent(in) :: limit +integer, intent(in),optional :: limit double precision, intent(out) :: res,abserr integer, intent(out) :: ier double precision, allocatable :: work(:) integer, allocatable :: iwork(:) integer :: lenw,neval,last +integer :: limitw ! imsl value for limit is 500 -lenw=limit*4 +limitw=500 +if (present(limit)) limitw=limit -allocate(iwork(limit)) +lenw=limitw*4 + +allocate(iwork(limitw)) allocate(work(lenw)) -call dqag(f,a,b,epsabs,epsrel,key,res,abserr,neval,ier,limit,lenw,last,iwork,work) +call dqag(f,a,b,epsabs,epsrel,key,res,abserr,neval,ier,limitw,lenw,last,iwork,work) deallocate(work) deallocate(iwork) @@ -2597,21 +2601,26 @@ subroutine fvn_d_integ_2_gk(f,a,b,g,h,epsabs,epsrel,key,res,abserr,ier,limit) implicit none double precision, external:: f,g,h double precision, intent(in) :: a,b,epsabs,epsrel -integer, intent(in) :: key,limit +integer, intent(in) :: key +integer, intent(in), optional :: limit integer, intent(out) :: ier double precision, intent(out) :: res,abserr double precision, allocatable :: work(:) +integer :: limitw integer, allocatable :: iwork(:) integer :: lenw,neval,last ! imsl value for limit is 500 -lenw=limit*4 +limitw=500 +if (present(limit)) limitw=limit + +lenw=limitw*4 allocate(work(lenw)) -allocate(iwork(limit)) +allocate(iwork(limitw)) -call dqag_2d_outer(f,a,b,g,h,epsabs,epsrel,key,res,abserr,neval,ier,limit,lenw,last,iwork,work) +call dqag_2d_outer(f,a,b,g,h,epsabs,epsrel,key,res,abserr,neval,ier,limitw,lenw,last,iwork,work) deallocate(iwork) deallocate(work) @@ -2685,21 +2694,26 @@ subroutine fvn_d_integ_2_inner_gk(f,x,a,b,epsabs,epsrel,key,res,abserr,ier,limit implicit none double precision, external:: f double precision, intent(in) :: x,a,b,epsabs,epsrel -integer, intent(in) :: key,limit +integer, intent(in) :: key +integer, intent(in),optional :: limit integer, intent(out) :: ier double precision, intent(out) :: res,abserr double precision, allocatable :: work(:) +integer :: limitw integer, allocatable :: iwork(:) integer :: lenw,neval,last ! imsl value for limit is 500 -lenw=limit*4 +limitw=500 +if (present(limit)) limitw=limit + +lenw=limitw*4 allocate(work(lenw)) -allocate(iwork(limit)) +allocate(iwork(limitw)) -call dqag_2d_inner(f,x,a,b,epsabs,epsrel,key,res,abserr,neval,ier,limit,lenw,last,iwork,work) +call dqag_2d_inner(f,x,a,b,epsabs,epsrel,key,res,abserr,neval,ier,limitw,lenw,last,iwork,work) deallocate(iwork) deallocate(work)