GNU Octave 10.1.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 
Loading...
Searching...
No Matches
qpsrt.f
Go to the documentation of this file.
1 subroutine qpsrt(limit,last,maxerr,ermax,elist,iord,nrmax)
2c***begin prologue qpsrt
3c***refer to qage,qagie,qagpe,qagse,qawce,qawse,qawoe
4c***routines called (none)
5c***keywords sequential sorting
6c***description
7c
8c 1. qpsrt
9c ordering routine
10c standard fortran subroutine
11c real version
12c
13c 2. purpose
14c this routine maintains the descending ordering
15c in the list of the local error estimates resulting from
16c the interval subdivision process. at each call two error
17c estimates are inserted using the sequential search
18c method, top-down for the largest error estimate
19c and bottom-up for the smallest error estimate.
20c
21c 3. calling sequence
22c call qpsrt(limit,last,maxerr,ermax,elist,iord,nrmax)
23c
24c parameters (meaning at output)
25c limit - integer
26c maximum number of error estimates the list
27c can contain
28c
29c last - integer
30c number of error estimates currently
31c in the list
32c
33c maxerr - integer
34c maxerr points to the nrmax-th largest error
35c estimate currently in the list
36c
37c ermax - real
38c nrmax-th largest error estimate
39c ermax = elist(maxerr)
40c
41c elist - real
42c vector of dimension last containing
43c the error estimates
44c
45c iord - integer
46c vector of dimension last, the first k
47c elements of which contain pointers
48c to the error estimates, such that
49c elist(iord(1)),... , elist(iord(k))
50c form a decreasing sequence, with
51c k = last if last.le.(limit/2+2), and
52c k = limit+1-last otherwise
53c
54c nrmax - integer
55c maxerr = iord(nrmax)
56c
57c 4. no subroutines or functions needed
58c***end prologue qpsrt
59c
60 real elist,ermax,errmax,errmin
61 integer i,ibeg,ido,iord,isucc,j,jbnd,jupbn,k,last,limit,maxerr,
62 * nrmax
63 dimension elist(last),iord(last)
64c
65c check whether the list contains more than
66c two error estimates.
67c
68c***first executable statement qpsrt
69 if(last.gt.2) go to 10
70 iord(1) = 1
71 iord(2) = 2
72 go to 90
73c
74c this part of the routine is only executed
75c if, due to a difficult integrand, subdivision
76c increased the error estimate. in the normal case
77c the insert procedure should start after the
78c nrmax-th largest error estimate.
79c
80 10 errmax = elist(maxerr)
81 if(nrmax.eq.1) go to 30
82 ido = nrmax-1
83 do 20 i = 1,ido
84 isucc = iord(nrmax-1)
85c ***jump out of do-loop
86 if(errmax.le.elist(isucc)) go to 30
87 iord(nrmax) = isucc
88 nrmax = nrmax-1
89 20 continue
90c
91c compute the number of elements in the list to
92c be maintained in descending order. this number
93c depends on the number of subdivisions still
94c allowed.
95c
96 30 jupbn = last
97 if(last.gt.(limit/2+2)) jupbn = limit+3-last
98 errmin = elist(last)
99c
100c insert errmax by traversing the list top-down,
101c starting comparison from the element elist(iord(nrmax+1)).
102c
103 jbnd = jupbn-1
104 ibeg = nrmax+1
105 if(ibeg.gt.jbnd) go to 50
106 do 40 i=ibeg,jbnd
107 isucc = iord(i)
108c ***jump out of do-loop
109 if(errmax.ge.elist(isucc)) go to 60
110 iord(i-1) = isucc
111 40 continue
112 50 iord(jbnd) = maxerr
113 iord(jupbn) = last
114 go to 90
115c
116c insert errmin by traversing the list bottom-up.
117c
118 60 iord(i-1) = maxerr
119 k = jbnd
120 do 70 j=i,jbnd
121 isucc = iord(k)
122c ***jump out of do-loop
123 if(errmin.lt.elist(isucc)) go to 80
124 iord(k+1) = isucc
125 k = k-1
126 70 continue
127 iord(i) = last
128 go to 90
129 80 iord(k+1) = last
130c
131c set maxerr and ermax.
132c
133 90 maxerr = iord(nrmax)
134 ermax = elist(maxerr)
135 return
136 end
subroutine qpsrt(limit, last, maxerr, ermax, elist, iord, nrmax)
Definition qpsrt.f:2