1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 46c1f6a93b0d 2012/05/03 04:40:28 toy $"
3 ;;; "f2cl2.l,v 96616d88fb7e 2008/02/22 22:19:34 rtoy $"
4 ;;; "f2cl3.l,v 96616d88fb7e 2008/02/22 22:19:34 rtoy $"
5 ;;; "f2cl4.l,v 96616d88fb7e 2008/02/22 22:19:34 rtoy $"
6 ;;; "f2cl5.l,v 46c1f6a93b0d 2012/05/03 04:40:28 toy $"
7 ;;; "f2cl6.l,v 1d5cbacbb977 2008/08/24 00:56:27 rtoy $"
8 ;;; "macros.l,v fceac530ef0c 2011/11/26 04:02:26 toy $")
10 ;;; Using Lisp CMU Common Lisp snapshot-2012-04 (20C Unicode)
12 ;;; Options: ((:prune-labels nil) (:auto-save t) (:relaxed-array-decls t)
13 ;;; (:coerce-assigns :as-needed) (:array-type ':array)
14 ;;; (:array-slicing t) (:declare-common nil)
15 ;;; (:float-format double-float))
21 (f a b npts2 points epsabs epsrel limit result abserr neval ier alist
22 blist rlist elist pts iord level ndin last$
)
23 (declare (type (array f2cl-lib
:integer4
(*)) ndin level iord
)
24 (type (array double-float
(*)) pts elist rlist blist alist points
)
25 (type (f2cl-lib:integer4
) last$ ier neval limit npts2
)
26 (type (double-float) abserr result epsrel epsabs b a
))
27 (f2cl-lib:with-multi-array-data
28 ((points double-float points-%data% points-%offset%
)
29 (alist double-float alist-%data% alist-%offset%
)
30 (blist double-float blist-%data% blist-%offset%
)
31 (rlist double-float rlist-%data% rlist-%offset%
)
32 (elist double-float elist-%data% elist-%offset%
)
33 (pts double-float pts-%data% pts-%offset%
)
34 (iord f2cl-lib
:integer4 iord-%data% iord-%offset%
)
35 (level f2cl-lib
:integer4 level-%data% level-%offset%
)
36 (ndin f2cl-lib
:integer4 ndin-%data% ndin-%offset%
))
37 (prog ((res3la (make-array 3 :element-type
'double-float
))
38 (rlist2 (make-array 52 :element-type
'double-float
)) (extrap nil
)
39 (noext nil
) (i 0) (id 0) (ierro 0) (ind1 0) (ind2 0) (ip1 0)
40 (iroff1 0) (iroff2 0) (iroff3 0) (j 0) (jlow 0) (jupbnd 0) (k 0)
41 (ksgn 0) (ktmin 0) (levcur 0) (levmax 0) (maxerr 0) (nintp1 0)
42 (npts 0) (nres 0) (nrmax 0) (numrl2 0) (abseps 0.0) (area 0.0)
43 (area1 0.0) (area12 0.0) (area2 0.0) (a1 0.0) (a2 0.0) (b1 0.0)
44 (b2 0.0) (correc 0.0) (defabs 0.0) (defab1 0.0) (defab2 0.0)
45 (dres 0.0) (epmach 0.0) (erlarg 0.0) (erlast 0.0) (errbnd 0.0)
46 (errmax 0.0) (error1 0.0) (erro12 0.0) (error2 0.0) (errsum 0.0)
47 (ertest 0.0) (oflow 0.0) (resa 0.0) (resabs 0.0) (reseps 0.0)
48 (sign$
0.0) (temp 0.0) (uflow 0.0) (nint$
0))
49 (declare (type (array double-float
(52)) rlist2
)
50 (type (array double-float
(3)) res3la
)
51 (type (double-float) uflow temp sign$ reseps resabs resa oflow
52 ertest errsum error2 erro12 error1 errmax
53 errbnd erlast erlarg epmach dres defab2
54 defab1 defabs correc b2 b1 a2 a1 area2
55 area12 area1 area abseps
)
56 (type (f2cl-lib:integer4
) nint$ numrl2 nrmax nres npts nintp1
57 maxerr levmax levcur ktmin ksgn k
58 jupbnd jlow j iroff3 iroff2 iroff1 ip1
60 (type f2cl-lib
:logical noext extrap
))
61 (setf epmach
(f2cl-lib:d1mach
4))
67 (setf (f2cl-lib:fref alist-%data%
(1) ((1 *)) alist-%offset%
) a
)
68 (setf (f2cl-lib:fref blist-%data%
(1) ((1 *)) blist-%offset%
) b
)
69 (setf (f2cl-lib:fref rlist-%data%
(1) ((1 *)) rlist-%offset%
) 0.0)
70 (setf (f2cl-lib:fref elist-%data%
(1) ((1 *)) elist-%offset%
) 0.0)
71 (setf (f2cl-lib:fref iord-%data%
(1) ((1 *)) iord-%offset%
) 0)
72 (setf (f2cl-lib:fref level-%data%
(1) ((1 *)) level-%offset%
) 0)
73 (setf npts
(f2cl-lib:int-sub npts2
2))
77 (and (<= epsabs
0.0) (< epsrel
(max (* 50.0 epmach
) 5.0e-29))))
79 (if (= ier
6) (go label999
))
81 (if (> a b
) (setf sign$ -
1.0))
82 (setf (f2cl-lib:fref pts-%data%
(1) ((1 *)) pts-%offset%
) (min a b
))
83 (if (= npts
0) (go label15
))
84 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
87 (setf (f2cl-lib:fref pts-%data%
88 ((f2cl-lib:int-add i
1))
91 (f2cl-lib:fref points-%data%
(i) ((1 *)) points-%offset%
))
94 (setf (f2cl-lib:fref pts-%data%
95 ((f2cl-lib:int-add npts
2))
99 (setf nint$
(f2cl-lib:int-add npts
1))
100 (setf a1
(f2cl-lib:fref pts-%data%
(1) ((1 *)) pts-%offset%
))
101 (if (= npts
0) (go label40
))
102 (setf nintp1
(f2cl-lib:int-add nint$
1))
103 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
106 (setf ip1
(f2cl-lib:int-add i
1))
107 (f2cl-lib:fdo
(j ip1
(f2cl-lib:int-add j
1))
111 (<= (f2cl-lib:fref pts-%data%
(i) ((1 *)) pts-%offset%
)
112 (f2cl-lib:fref pts-%data%
(j) ((1 *)) pts-%offset%
))
114 (setf temp
(f2cl-lib:fref pts-%data%
(i) ((1 *)) pts-%offset%
))
115 (setf (f2cl-lib:fref pts-%data%
(i) ((1 *)) pts-%offset%
)
116 (f2cl-lib:fref pts-%data%
(j) ((1 *)) pts-%offset%
))
117 (setf (f2cl-lib:fref pts-%data%
(j) ((1 *)) pts-%offset%
) temp
)
121 (or (/= (f2cl-lib:fref pts-%data%
(1) ((1 *)) pts-%offset%
) (min a b
))
122 (/= (f2cl-lib:fref pts-%data%
(nintp1) ((1 *)) pts-%offset%
)
125 (if (= ier
6) (go label999
))
128 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
132 (f2cl-lib:fref pts-%data%
133 ((f2cl-lib:int-add i
1))
136 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5 var-6
)
137 (dqk21 f a1 b1 area1 error1 defabs resa
)
138 (declare (ignore var-0 var-1 var-2
))
143 (setf abserr
(+ abserr error1
))
144 (setf result
(+ result area1
))
145 (setf (f2cl-lib:fref ndin-%data%
(i) ((1 *)) ndin-%offset%
) 0)
146 (if (and (= error1 resa
) (/= error1
0.0))
147 (setf (f2cl-lib:fref ndin-%data%
(i) ((1 *)) ndin-%offset%
) 1))
148 (setf resabs
(+ resabs defabs
))
149 (setf (f2cl-lib:fref level-%data%
(i) ((1 *)) level-%offset%
) 0)
150 (setf (f2cl-lib:fref elist-%data%
(i) ((1 *)) elist-%offset%
) error1
)
151 (setf (f2cl-lib:fref alist-%data%
(i) ((1 *)) alist-%offset%
) a1
)
152 (setf (f2cl-lib:fref blist-%data%
(i) ((1 *)) blist-%offset%
) b1
)
153 (setf (f2cl-lib:fref rlist-%data%
(i) ((1 *)) rlist-%offset%
) area1
)
154 (setf (f2cl-lib:fref iord-%data%
(i) ((1 *)) iord-%offset%
) i
)
158 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
161 (if (= (f2cl-lib:fref ndin-%data%
(i) ((1 *)) ndin-%offset%
) 1)
162 (setf (f2cl-lib:fref elist-%data%
(i) ((1 *)) elist-%offset%
)
166 (f2cl-lib:fref elist-%data%
(i) ((1 *)) elist-%offset%
)))
169 (setf neval
(f2cl-lib:int-mul
21 nint$
))
170 (setf dres
(abs result
))
171 (setf errbnd
(max epsabs
(* epsrel dres
)))
172 (if (and (<= abserr
(* 100.0 epmach resabs
)) (> abserr errbnd
))
174 (if (= nint$
1) (go label80
))
175 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
178 (setf jlow
(f2cl-lib:int-add i
1))
179 (setf ind1
(f2cl-lib:fref iord-%data%
(i) ((1 *)) iord-%offset%
))
180 (f2cl-lib:fdo
(j jlow
(f2cl-lib:int-add j
1))
183 (setf ind2
(f2cl-lib:fref iord-%data%
(j) ((1 *)) iord-%offset%
))
185 (> (f2cl-lib:fref elist-%data%
(ind1) ((1 *)) elist-%offset%
)
186 (f2cl-lib:fref elist-%data%
(ind2) ((1 *)) elist-%offset%
))
191 (if (= ind1
(f2cl-lib:fref iord-%data%
(i) ((1 *)) iord-%offset%
))
193 (setf (f2cl-lib:fref iord-%data%
(k) ((1 *)) iord-%offset%
)
194 (f2cl-lib:fref iord-%data%
(i) ((1 *)) iord-%offset%
))
195 (setf (f2cl-lib:fref iord-%data%
(i) ((1 *)) iord-%offset%
) ind1
)
197 (if (< limit npts2
) (setf ier
1))
199 (if (or (/= ier
0) (<= abserr errbnd
)) (go label999
))
200 (setf (f2cl-lib:fref rlist2
(1) ((1 52))) result
)
201 (setf maxerr
(f2cl-lib:fref iord-%data%
(1) ((1 *)) iord-%offset%
))
203 (f2cl-lib:fref elist-%data%
(maxerr) ((1 *)) elist-%offset%
))
209 (setf extrap f2cl-lib
:%false%
)
210 (setf noext f2cl-lib
:%false%
)
218 (setf uflow
(f2cl-lib:d1mach
1))
219 (setf oflow
(f2cl-lib:d1mach
2))
222 (if (>= dres
(* (- 1.0 (* 50.0 epmach
)) resabs
)) (setf ksgn
1))
223 (f2cl-lib:fdo
(last$ npts2
(f2cl-lib:int-add last$
1))
224 ((> last$ limit
) nil
)
228 (f2cl-lib:fref level-%data%
(maxerr) ((1 *)) level-%offset%
)
231 (f2cl-lib:fref alist-%data%
(maxerr) ((1 *)) alist-%offset%
))
235 (f2cl-lib:fref alist-%data%
239 (f2cl-lib:fref blist-%data%
245 (f2cl-lib:fref blist-%data%
(maxerr) ((1 *)) blist-%offset%
))
247 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5 var-6
)
248 (dqk21 f a1 b1 area1 error1 resa defab1
)
249 (declare (ignore var-0 var-1 var-2
))
254 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5 var-6
)
255 (dqk21 f a2 b2 area2 error2 resa defab2
)
256 (declare (ignore var-0 var-1 var-2
))
261 (setf neval
(f2cl-lib:int-add neval
42))
262 (setf area12
(+ area1 area2
))
263 (setf erro12
(+ error1 error2
))
264 (setf errsum
(- (+ errsum erro12
) errmax
))
267 (f2cl-lib:fref rlist-%data%
271 (if (or (= defab1 error1
) (= defab2 error2
)) (go label95
))
276 (- (f2cl-lib:fref rlist-%data%
(maxerr) ((1 *)) rlist-%offset%
)
278 (* 1.0e-5 (abs area12
)))
279 (< erro12
(* 0.99 errmax
)))
281 (if extrap
(setf iroff2
(f2cl-lib:int-add iroff2
1)))
282 (if (not extrap
) (setf iroff1
(f2cl-lib:int-add iroff1
1)))
284 (if (and (> last$
10) (> erro12 errmax
))
285 (setf iroff3
(f2cl-lib:int-add iroff3
1)))
287 (setf (f2cl-lib:fref level-%data%
(maxerr) ((1 *)) level-%offset%
)
289 (setf (f2cl-lib:fref level-%data%
(last$
) ((1 *)) level-%offset%
)
291 (setf (f2cl-lib:fref rlist-%data%
(maxerr) ((1 *)) rlist-%offset%
)
293 (setf (f2cl-lib:fref rlist-%data%
(last$
) ((1 *)) rlist-%offset%
)
295 (setf errbnd
(max epsabs
(* epsrel
(abs area
))))
296 (if (or (>= (f2cl-lib:int-add iroff1 iroff2
) 10) (>= iroff3
20))
298 (if (>= iroff2
5) (setf ierro
3))
299 (if (= last$ limit
) (setf ier
1))
301 (<= (max (abs a1
) (abs b2
))
302 (* (+ 1.0 (* 100.0 epmach
)) (+ (abs a2
) (* 1000.0 uflow
))))
304 (if (> error2 error1
) (go label100
))
305 (setf (f2cl-lib:fref alist-%data%
(last$
) ((1 *)) alist-%offset%
) a2
)
306 (setf (f2cl-lib:fref blist-%data%
(maxerr) ((1 *)) blist-%offset%
)
308 (setf (f2cl-lib:fref blist-%data%
(last$
) ((1 *)) blist-%offset%
) b2
)
309 (setf (f2cl-lib:fref elist-%data%
(maxerr) ((1 *)) elist-%offset%
)
311 (setf (f2cl-lib:fref elist-%data%
(last$
) ((1 *)) elist-%offset%
)
315 (setf (f2cl-lib:fref alist-%data%
(maxerr) ((1 *)) alist-%offset%
)
317 (setf (f2cl-lib:fref alist-%data%
(last$
) ((1 *)) alist-%offset%
) a1
)
318 (setf (f2cl-lib:fref blist-%data%
(last$
) ((1 *)) blist-%offset%
) b1
)
319 (setf (f2cl-lib:fref rlist-%data%
(maxerr) ((1 *)) rlist-%offset%
)
321 (setf (f2cl-lib:fref rlist-%data%
(last$
) ((1 *)) rlist-%offset%
)
323 (setf (f2cl-lib:fref elist-%data%
(maxerr) ((1 *)) elist-%offset%
)
325 (setf (f2cl-lib:fref elist-%data%
(last$
) ((1 *)) elist-%offset%
)
328 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5 var-6
)
329 (dqpsrt limit last$ maxerr errmax elist iord nrmax
)
330 (declare (ignore var-0 var-1 var-4 var-5
))
334 (if (<= errsum errbnd
) (go label190
))
335 (if (/= ier
0) (go label170
))
336 (if noext
(go label160
))
337 (setf erlarg
(- erlarg erlast
))
338 (if (<= (f2cl-lib:int-add levcur
1) levmax
)
339 (setf erlarg
(+ erlarg erro12
)))
340 (if extrap
(go label120
))
344 (f2cl-lib:fref level-%data%
(maxerr) ((1 *)) level-%offset%
)
348 (setf extrap f2cl-lib
:%true%
)
351 (if (or (= ierro
3) (<= erlarg ertest
)) (go label140
))
354 (if (> last$
(+ 2 (the f2cl-lib
:integer4
(truncate limit
2))))
356 (f2cl-lib:int-sub
(f2cl-lib:int-add limit
3) last$
)))
357 (f2cl-lib:fdo
(k id
(f2cl-lib:int-add k
1))
361 (f2cl-lib:fref iord-%data%
366 (f2cl-lib:fref elist-%data%
373 (f2cl-lib:fref level-%data%
(maxerr) ((1 *)) level-%offset%
)
377 (setf nrmax
(f2cl-lib:int-add nrmax
1))
380 (setf numrl2
(f2cl-lib:int-add numrl2
1))
381 (setf (f2cl-lib:fref rlist2
(numrl2) ((1 52))) area
)
382 (if (<= numrl2
2) (go label155
))
383 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5
)
384 (dqelg numrl2 rlist2 reseps abseps res3la nres
)
385 (declare (ignore var-1 var-4
))
390 (setf ktmin
(f2cl-lib:int-add ktmin
1))
391 (if (and (> ktmin
5) (< abserr
(* 0.001 errsum
))) (setf ier
5))
392 (if (>= abseps abserr
) (go label150
))
397 (setf ertest
(max epsabs
(* epsrel
(abs reseps
))))
398 (if (< abserr ertest
) (go label170
))
400 (if (= numrl2
1) (setf noext f2cl-lib
:%true%
))
401 (if (>= ier
5) (go label170
))
403 (setf maxerr
(f2cl-lib:fref iord-%data%
(1) ((1 *)) iord-%offset%
))
405 (f2cl-lib:fref elist-%data%
(maxerr) ((1 *)) elist-%offset%
))
407 (setf extrap f2cl-lib
:%false%
)
408 (setf levmax
(f2cl-lib:int-add levmax
1))
412 (if (= abserr oflow
) (go label190
))
413 (if (= (f2cl-lib:int-add ier ierro
) 0) (go label180
))
414 (if (= ierro
3) (setf abserr
(+ abserr correc
)))
415 (if (= ier
0) (setf ier
3))
416 (if (and (/= result
0.0) (/= area
0.0)) (go label175
))
417 (if (> abserr errsum
) (go label190
))
418 (if (= area
0.0) (go label210
))
421 (if (> (/ abserr
(abs result
)) (/ errsum
(abs area
))) (go label190
))
423 (if (and (= ksgn -
1) (<= (max (abs result
) (abs area
)) (* resabs
0.01)))
426 (or (> 0.01 (/ result area
))
427 (> (/ result area
) 100.0)
428 (> errsum
(abs area
)))
433 (f2cl-lib:fdo
(k 1 (f2cl-lib:int-add k
1))
438 (f2cl-lib:fref rlist-%data%
(k) ((1 *)) rlist-%offset%
)))
442 (if (> ier
2) (setf ier
(f2cl-lib:int-sub ier
1)))
443 (setf result
(* result sign$
))
470 (in-package #:cl-user
)
471 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
472 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
473 (setf (gethash 'fortran-to-lisp
::dqagpe
474 fortran-to-lisp
::*f2cl-function-info
*)
475 (fortran-to-lisp::make-f2cl-finfo
476 :arg-types
'(t (double-float) (double-float)
477 (fortran-to-lisp::integer4
) (array double-float
(*))
478 (double-float) (double-float)
479 (fortran-to-lisp::integer4
) (double-float)
480 (double-float) (fortran-to-lisp::integer4
)
481 (fortran-to-lisp::integer4
) (array double-float
(*))
482 (array double-float
(*)) (array double-float
(*))
483 (array double-float
(*)) (array double-float
(*))
484 (array fortran-to-lisp
::integer4
(*))
485 (array fortran-to-lisp
::integer4
(*))
486 (array fortran-to-lisp
::integer4
(*))
487 (fortran-to-lisp::integer4
))
488 :return-values
'(nil nil nil nil nil nil nil nil
489 fortran-to-lisp
::result fortran-to-lisp
::abserr
490 fortran-to-lisp
::neval fortran-to-lisp
::ier nil nil
491 nil nil nil nil nil nil fortran-to-lisp
::last$
)
492 :calls
'(fortran-to-lisp::dqelg fortran-to-lisp
::dqpsrt
493 fortran-to-lisp
::dqk21 fortran-to-lisp
::d1mach
))))