5 * Revision 1.1.1.1 1996/04/01 15:02:13 mclareni
10 SUBROUTINE DADAPT(F,A,B,NSEG,RELTOL,ABSTOL,RES,ERR)
11 #if !defined(CERNLIB_DOUBLE)
12 #include "gen/imp128.inc"
15 CALL MTLPRT(NAME,'D102',
16 +'not available on this machine - see documentation')
20 #if defined(CERNLIB_DOUBLE)
21 IMPLICIT DOUBLE PRECISION (A-H,O-Z)
23 C RES = Estimated Integral of F from A to B,
24 C ERR = Estimated absolute error on RES.
25 C NSEG specifies how the adaptation is to be done:
26 C =0 means use previous binning,
27 C =1 means fully automatic, adapt until tolerance attained.
28 C =n>1 means first split interval into n equal segments,
29 C then adapt as necessary to attain tolerance.
30 C The specified tolerances are:
31 C relative: RELTOL ; absolute: ABSTOL.
32 C It stops when one OR the other is satisfied, or number of
33 C segments exceeds NDIM. Either TOLA or TOLR (but not both!)
34 C can be set to zero, in which case only the other is used.
39 PARAMETER (R1 = 1, HF = R1/2)
41 DIMENSION XLO(NDIM),XHI(NDIM),TVAL(NDIM),TERS(NDIM)
42 SAVE XLO,XHI,TVAL,TERS,NTER
53 CALL DGS56P(F,XLO(I),XHI(I),TVAL(I),TE)
68 IF(I .EQ. NSEGD) XHI(I)=B
70 CALL DGS56P(F,XLOB,XHIB,TVAL(I),TE)
82 IF(ROOT .LE. ABSTOL .OR. ROOT .LE. RELTOL*ABS(TVALS)) GO TO 9
83 IF(NTER .EQ. NDIM) GO TO 9
87 IF(TERS(I) .GT. BIGE) THEN
94 XNEW=HF*(XLO(IBIG)+XHI(IBIG))
97 CALL DGS56P(F,XLO(IBIG),XHI(IBIG),TVAL(IBIG),TE)
99 CALL DGS56P(F,XLO(NTER),XHI(NTER),TVAL(NTER),TE)