1 subroutine qagpe(f,a,b,npts2,points,epsabs,epsrel,limit,result,
2 * abserr,neval,ier,alist,blist,rlist,elist,pts,iord,level,ndin,
189 real a,abseps,abserr,alist,area,area1,area12,area2,a1,
190 *
a2,b,blist,b1,b2,correc,defabs,defab1,defab2,
191 * dres,
r1mach,elist,epmach,epsabs,epsrel,erlarg,erlast,errbnd,
192 * errmax,error1,erro12,error2,errsum,ertest,oflow,points,pts,
193 * resa,resabs,reseps,
result,res3la,rlist,rlist2,sign,temp,
195 integer i,
id,ier,ierro,ind1,ind2,iord,ip1,iroff1,iroff2,
196 * iroff3,j,jlow,jupbnd,k,ksgn,ktmin,last,levcur,level,levmax,
197 *
limit,maxerr,ndin,neval,nint,nintp1,npts,npts2,nres,
203 * level(
limit),ndin(npts2),points(npts2),pts(npts2),res3la(3),
204 * rlist(
limit),rlist2(52)
278 if(npts2.lt.2.or.
limit.le.npts.or.(epsabs.le.0.0e+00.and.
279 * epsrel.lt.amax1(0.5e+02*epmach,0.5e-14))) ier = 6
280 if(ier.eq.6) go to 210
286 if(a.gt.b) sign = -1.0e+00
288 if(npts.eq.0) go to 15
292 15 pts(npts+2) = amax1(a,b)
295 if(npts.eq.0) go to 40
300 if(pts(i).le.pts(j)) go to 20
305 if(pts(1).ne.amin1(a,b).or.pts(nintp1).ne.
306 * amax1(a,b)) ier = 6
307 if(ier.eq.6) go to 999
315 call
qk21(
f,a1,b1,area1,error1,defabs,resa,ier)
317 abserr = abserr+error1
320 if(error1.eq.resa.and.error1.ne.0.0e+00) ndin(i) = 1
321 resabs = resabs+defabs
332 if(ndin(i).eq.1) elist(i) = abserr
333 errsum = errsum+elist(i)
341 errbnd = amax1(epsabs,epsrel*dres)
342 if(abserr.le.0.1e+03*epmach*resabs.and.abserr.gt.
344 if(nint.eq.1) go to 80
350 if(elist(ind1).gt.elist(ind2)) go to 60
354 if(ind1.eq.iord(i)) go to 70
358 if(
limit.lt.npts2) ier = 1
359 80
if(ier.ne.0.or.abserr.le.errbnd) go to 999
366 errmax = elist(maxerr)
385 if(dres.ge.(0.1e+01-0.5e+02*epmach)*resabs) ksgn = 1
390 do 160 last = npts2,
limit
395 levcur = level(maxerr)+1
397 b1 = 0.5e+00*(alist(maxerr)+blist(maxerr))
401 call
qk21(
f,a1,b1,area1,error1,resa,defab1,ier)
403 call
qk21(
f,
a2,b2,area2,error2,resa,defab2,ier)
411 erro12 = error1+error2
412 errsum = errsum+erro12-errmax
413 area = area+area12-rlist(maxerr)
414 if(defab1.eq.error1.or.defab2.eq.error2) go to 95
415 if(
abs(rlist(maxerr)-area12).gt.0.1e-04*
abs(area12)
416 * .or.erro12.lt.0.99e+00*errmax) go to 90
417 if(extrap) iroff2 = iroff2+1
418 if(.not.extrap) iroff1 = iroff1+1
419 90
if(last.gt.10.and.erro12.gt.errmax) iroff3 = iroff3+1
420 95 level(maxerr) = levcur
422 rlist(maxerr) = area1
424 errbnd = amax1(epsabs,epsrel*
abs(area))
429 if(iroff1+iroff2.ge.10.or.iroff3.ge.20) ier = 2
430 if(iroff2.ge.5) ierro = 3
435 if(last.eq.
limit) ier = 1
440 if(amax1(
abs(a1),
abs(b2)).le.(0.1e+01+0.1e+03*epmach)*
445 if(error2.gt.error1) go to 100
449 elist(maxerr) = error1
452 100 alist(maxerr) =
a2
455 rlist(maxerr) = area2
457 elist(maxerr) = error2
465 110 call
qpsrt(
limit,last,maxerr,errmax,elist,iord,nrmax)
467 if(errsum.le.errbnd) go to 190
469 if(ier.ne.0) go to 170
471 erlarg = erlarg-erlast
472 if(levcur+1.le.levmax) erlarg = erlarg+erro12
478 if(level(maxerr)+1.le.levmax) go to 160
481 120
if(ierro.eq.3.or.erlarg.le.ertest) go to 140
493 errmax = elist(maxerr)
495 if(level(maxerr)+1.le.levmax) go to 160
501 140 numrl2 = numrl2+1
502 rlist2(numrl2) = area
503 if(numrl2.le.2) go to 155
504 call
qelg(numrl2,rlist2,reseps,abseps,res3la,nres)
506 if(ktmin.gt.5.and.abserr.lt.0.1e-02*errsum) ier = 5
507 if(abseps.ge.abserr) go to 150
512 ertest = amax1(epsabs,epsrel*
abs(reseps))
514 if(abserr.lt.ertest) go to 170
518 150
if(numrl2.eq.1) noext = .true.
519 if(ier.ge.5) go to 170
521 errmax = elist(maxerr)
532 170
if(abserr.eq.oflow) go to 190
533 if((ier+ierro).eq.0) go to 180
534 if(ierro.eq.3) abserr = abserr+correc
536 if(
result.ne.0.0e+00.and.area.ne.0.0e+00)go to 175
537 if(abserr.gt.errsum)go to 190
538 if(area.eq.0.0e+00) go to 210
544 180
if(ksgn.eq.(-1).and.amax1(
abs(
result),
abs(area)).le.
545 * resabs*0.1e-01) go to 210
546 if(0.1e-01.gt.(
result/area).or.(
result/area).gt.0.1e+03.or.
547 * errsum.gt.
abs(area)) ier = 6
557 210
if(ier.gt.2) ier = ier - 1