2 SUBROUTINE DQPSRT
(LIMIT
, LAST
, MAXERR
, ERMAX
, ELIST
, IORD
, NRMAX
)
3 C***BEGIN PROLOGUE DQPSRT
5 C***PURPOSE This routine maintains the descending ordering in the
6 C list of the local error estimated resulting from the
7 C interval subdivision process. At each call two error
8 C estimates are inserted using the sequential search
9 C method, top-down for the largest error estimate and
10 C bottom-up for the smallest error estimate.
12 C***TYPE DOUBLE PRECISION (QPSRT-S, DQPSRT-D)
13 C***KEYWORDS SEQUENTIAL SORTING
14 C***AUTHOR Piessens, Robert
15 C Applied Mathematics and Programming Division
18 C Applied Mathematics and Programming Division
23 C Standard fortran subroutine
24 C Double precision version
26 C PARAMETERS (MEANING AT OUTPUT)
28 C Maximum number of error estimates the list
32 C Number of error estimates currently in the list
35 C MAXERR points to the NRMAX-th largest error
36 C estimate currently in the list
38 C ERMAX - Double precision
39 C NRMAX-th largest error estimate
40 C ERMAX = ELIST(MAXERR)
42 C ELIST - Double precision
43 C Vector of dimension LAST containing
47 C Vector of dimension LAST, the first K elements
48 C of which contain pointers to the error
49 C estimates, such that
50 C ELIST(IORD(1)),..., ELIST(IORD(K))
51 C form a decreasing sequence, with
52 C K = LAST if LAST.LE.(LIMIT/2+2), and
53 C K = LIMIT+1-LAST otherwise
56 C MAXERR = IORD(NRMAX)
58 C***SEE ALSO DQAGE, DQAGIE, DQAGPE, DQAWSE
59 C***ROUTINES CALLED (NONE)
60 C***REVISION HISTORY (YYMMDD)
62 C 890831 Modified array declarations. (WRB)
63 C 890831 REVISION DATE from Version 3.2
64 C 891214 Prologue converted to Version 4.0 format. (BAB)
65 C 900328 Added TYPE section. (WRB)
66 C***END PROLOGUE DQPSRT
68 DOUBLE PRECISION ELIST
,ERMAX
,ERRMAX
,ERRMIN
69 INTEGER I
,IBEG
,IDO
,IORD
,ISUCC
,J
,JBND
,JUPBN
,K
,LAST
,LIMIT
,MAXERR
,
71 DIMENSION ELIST
(*),IORD
(*)
73 C CHECK WHETHER THE LIST CONTAINS MORE THAN
74 C TWO ERROR ESTIMATES.
76 C***FIRST EXECUTABLE STATEMENT DQPSRT
77 IF(LAST
.GT
.2) GO TO 10
82 C THIS PART OF THE ROUTINE IS ONLY EXECUTED IF, DUE TO A
83 C DIFFICULT INTEGRAND, SUBDIVISION INCREASED THE ERROR
84 C ESTIMATE. IN THE NORMAL CASE THE INSERT PROCEDURE SHOULD
85 C START AFTER THE NRMAX-TH LARGEST ERROR ESTIMATE.
87 10 ERRMAX
= ELIST
(MAXERR
)
88 IF(NRMAX
.EQ
.1) GO TO 30
92 C ***JUMP OUT OF DO-LOOP
93 IF(ERRMAX
.LE
.ELIST
(ISUCC
)) GO TO 30
98 C COMPUTE THE NUMBER OF ELEMENTS IN THE LIST TO BE MAINTAINED
99 C IN DESCENDING ORDER. THIS NUMBER DEPENDS ON THE NUMBER OF
100 C SUBDIVISIONS STILL ALLOWED.
103 IF(LAST
.GT
.(LIMIT
/2+2)) JUPBN
= LIMIT
+3-LAST
106 C INSERT ERRMAX BY TRAVERSING THE LIST TOP-DOWN,
107 C STARTING COMPARISON FROM THE ELEMENT ELIST(IORD(NRMAX+1)).
111 IF(IBEG
.GT
.JBND
) GO TO 50
114 C ***JUMP OUT OF DO-LOOP
115 IF(ERRMAX
.GE
.ELIST
(ISUCC
)) GO TO 60
118 50 IORD
(JBND
) = MAXERR
122 C INSERT ERRMIN BY TRAVERSING THE LIST BOTTOM-UP.
124 60 IORD
(I
-1) = MAXERR
128 C ***JUMP OUT OF DO-LOOP
129 IF(ERRMIN
.LT
.ELIST
(ISUCC
)) GO TO 80
137 C SET MAXERR AND ERMAX.
139 90 MAXERR
= IORD
(NRMAX
)
140 ERMAX
= ELIST
(MAXERR
)