1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 95098eb54f13 2013/04/01 00:45:16 toy $"
3 ;;; "f2cl2.l,v 95098eb54f13 2013/04/01 00:45:16 toy $"
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 95098eb54f13 2013/04/01 00:45:16 toy $"
7 ;;; "f2cl6.l,v 1d5cbacbb977 2008/08/24 00:56:27 rtoy $"
8 ;;; "macros.l,v 1409c1352feb 2013/03/24 20:44:50 toy $")
10 ;;; Using Lisp CMU Common Lisp snapshot-2013-11 (20E 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 single-float))
17 (in-package "ODEPACK")
20 (defun dstodpk (neq y yh nyh yh1 ewt savf savx acor wm iwm f jac psol
)
21 (declare (type (f2cl-lib:integer4
) nyh
)
22 (type (array double-float
(*)) wm acor savx savf ewt yh1 yh y
)
23 (type (array f2cl-lib
:integer4
(*)) iwm neq
))
26 :element-type
'double-float
27 :displaced-to
(dls001-part-0 *dls001-common-block
*)
28 :displaced-index-offset
2))
31 :element-type
'double-float
32 :displaced-to
(dls001-part-0 *dls001-common-block
*)
33 :displaced-index-offset
15))
36 :element-type
'double-float
37 :displaced-to
(dls001-part-0 *dls001-common-block
*)
38 :displaced-index-offset
173)))
39 (symbol-macrolet ((conit (aref (dls001-part-0 *dls001-common-block
*) 0))
40 (crate (aref (dls001-part-0 *dls001-common-block
*) 1))
43 (hold (aref (dls001-part-0 *dls001-common-block
*) 171))
44 (rmax (aref (dls001-part-0 *dls001-common-block
*) 172))
46 (ccmax (aref (dls001-part-0 *dls001-common-block
*) 209))
47 (el0 (aref (dls001-part-0 *dls001-common-block
*) 210))
48 (h (aref (dls001-part-0 *dls001-common-block
*) 211))
49 (hmin (aref (dls001-part-0 *dls001-common-block
*) 212))
50 (hmxi (aref (dls001-part-0 *dls001-common-block
*) 213))
51 (hu (aref (dls001-part-0 *dls001-common-block
*) 214))
52 (rc (aref (dls001-part-0 *dls001-common-block
*) 215))
53 (tn (aref (dls001-part-0 *dls001-common-block
*) 216))
54 (ialth (aref (dls001-part-1 *dls001-common-block
*) 6))
55 (ipup (aref (dls001-part-1 *dls001-common-block
*) 7))
56 (lmax (aref (dls001-part-1 *dls001-common-block
*) 8))
57 (meo (aref (dls001-part-1 *dls001-common-block
*) 9))
58 (nqnyh (aref (dls001-part-1 *dls001-common-block
*) 10))
59 (nslp (aref (dls001-part-1 *dls001-common-block
*) 11))
60 (icf (aref (dls001-part-1 *dls001-common-block
*) 12))
61 (ierpj (aref (dls001-part-1 *dls001-common-block
*) 13))
62 (iersl (aref (dls001-part-1 *dls001-common-block
*) 14))
63 (jcur (aref (dls001-part-1 *dls001-common-block
*) 15))
64 (jstart (aref (dls001-part-1 *dls001-common-block
*) 16))
65 (kflag (aref (dls001-part-1 *dls001-common-block
*) 17))
66 (l (aref (dls001-part-1 *dls001-common-block
*) 18))
67 (meth (aref (dls001-part-1 *dls001-common-block
*) 25))
68 (miter (aref (dls001-part-1 *dls001-common-block
*) 26))
69 (maxord (aref (dls001-part-1 *dls001-common-block
*) 27))
70 (maxcor (aref (dls001-part-1 *dls001-common-block
*) 28))
71 (msbp (aref (dls001-part-1 *dls001-common-block
*) 29))
72 (mxncf (aref (dls001-part-1 *dls001-common-block
*) 30))
73 (n (aref (dls001-part-1 *dls001-common-block
*) 31))
74 (nq (aref (dls001-part-1 *dls001-common-block
*) 32))
75 (nst (aref (dls001-part-1 *dls001-common-block
*) 33))
76 (nfe (aref (dls001-part-1 *dls001-common-block
*) 34))
77 (nqu (aref (dls001-part-1 *dls001-common-block
*) 36))
78 (epcon (aref (dlpk01-part-0 *dlpk01-common-block
*) 1))
79 (jacflg (aref (dlpk01-part-1 *dlpk01-common-block
*) 1))
80 (mnewt (aref (dlpk01-part-1 *dlpk01-common-block
*) 7))
81 (ncfn (aref (dlpk01-part-1 *dlpk01-common-block
*) 11)))
82 (f2cl-lib:with-multi-array-data
83 ((neq f2cl-lib
:integer4 neq-%data% neq-%offset%
)
84 (iwm f2cl-lib
:integer4 iwm-%data% iwm-%offset%
)
85 (y double-float y-%data% y-%offset%
)
86 (yh double-float yh-%data% yh-%offset%
)
87 (yh1 double-float yh1-%data% yh1-%offset%
)
88 (ewt double-float ewt-%data% ewt-%offset%
)
89 (savf double-float savf-%data% savf-%offset%
)
90 (savx double-float savx-%data% savx-%offset%
)
91 (acor double-float acor-%data% acor-%offset%
)
92 (wm double-float wm-%data% wm-%offset%
))
93 (prog ((newq 0) (ncf 0) (m 0) (jb 0) (j 0) (iret 0) (iredo 0) (i1 0)
94 (i 0) (told 0.0d0
) (rhup 0.0d0
) (rhsm 0.0d0
) (rhdn 0.0d0
)
95 (rh 0.0d0
) (r 0.0d0
) (exup 0.0d0
) (exsm 0.0d0
) (exdn 0.0d0
)
96 (dup 0.0d0
) (dsm 0.0d0
) (delp 0.0d0
) (del 0.0d0
) (ddn 0.0d0
)
98 (declare (type (double-float) dcon ddn del delp dsm dup exdn exsm
99 exup r rh rhdn rhsm rhup told
)
100 (type (f2cl-lib:integer4
) i i1 iredo iret j jb m ncf newq
))
109 (if (> jstart
0) (go label200
))
110 (if (= jstart -
1) (go label100
))
111 (if (= jstart -
2) (go label160
))
112 (setf lmax
(f2cl-lib:int-add maxord
1))
116 (setf rmax
10000.0d0
)
128 (setf lmax
(f2cl-lib:int-add maxord
1))
129 (if (= ialth
1) (setf ialth
2))
130 (if (= meth meo
) (go label110
))
131 (dcfode meth elco tesco
)
133 (if (> nq maxord
) (go label120
))
138 (if (<= nq maxord
) (go label160
))
142 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
146 (setf (f2cl-lib:fref el
(i) ((1 13)))
147 (f2cl-lib:fref elco
(i nq
) ((1 13) (1 12))))))
148 (setf nqnyh
(f2cl-lib:int-mul nq nyh
))
149 (setf rc
(/ (* rc
(f2cl-lib:fref el
(1) ((1 13)))) el0
))
150 (setf el0
(f2cl-lib:fref el
(1) ((1 13))))
151 (setf conit
(/ 0.5d0
(f2cl-lib:int-add nq
2)))
152 (setf epcon
(* conit
(f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12)))))
154 (/ (dvnorm n savf ewt
)
155 (f2cl-lib:fref tesco
(1 l
) ((1 3) (1 12)))))
156 (setf exdn
(/ 1.0d0 l
))
157 (setf rhdn
(/ 1.0d0
(+ (* 1.3d0
(expt ddn exdn
)) 1.3d-6
)))
158 (setf rh
(min rhdn
1.0d0
))
160 (if (= h hold
) (go label170
))
161 (setf rh
(min rh
(abs (/ h hold
))))
165 (dcfode meth elco tesco
)
167 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
171 (setf (f2cl-lib:fref el
(i) ((1 13)))
172 (f2cl-lib:fref elco
(i nq
) ((1 13) (1 12))))))
173 (setf nqnyh
(f2cl-lib:int-mul nq nyh
))
174 (setf rc
(/ (* rc
(f2cl-lib:fref el
(1) ((1 13)))) el0
))
175 (setf el0
(f2cl-lib:fref el
(1) ((1 13))))
176 (setf conit
(/ 0.5d0
(f2cl-lib:int-add nq
2)))
177 (setf epcon
(* conit
(f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12)))))
178 (f2cl-lib:computed-goto
(label160 label170 label200
) iret
)
180 (if (= h hold
) (go label200
))
186 (setf rh
(max rh
(/ hmin
(abs h
))))
188 (setf rh
(min rh rmax
))
189 (setf rh
(/ rh
(max 1.0d0
(* (abs h
) hmxi rh
))))
191 (f2cl-lib:fdo
(j 2 (f2cl-lib:int-add j
1))
195 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
198 (setf (f2cl-lib:fref yh-%data%
203 (f2cl-lib:fref yh-%data%
212 (if (= iredo
0) (go label690
))
214 (if (/= jacflg
0) (go label202
))
219 (if (> (abs (- rc
1.0d0
)) ccmax
) (setf ipup miter
))
220 (if (>= nst
(f2cl-lib:int-add nslp msbp
)) (setf ipup miter
))
223 (setf i1
(f2cl-lib:int-add nqnyh
1))
224 (f2cl-lib:fdo
(jb 1 (f2cl-lib:int-add jb
1))
227 (setf i1
(f2cl-lib:int-sub i1 nyh
))
228 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
232 (setf (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
234 (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
235 (f2cl-lib:fref yh1-%data%
236 ((f2cl-lib:int-add i nyh
))
243 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
247 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
248 (f2cl-lib:fref yh-%data%
252 (multiple-value-bind (var-0 var-1 var-2 var-3
)
253 (funcall f neq tn y savf
)
254 (declare (ignore var-0 var-2 var-3
))
257 (setf nfe
(f2cl-lib:int-add nfe
1))
258 (if (<= ipup
0) (go label250
))
259 (dpkset neq y yh1 ewt acor savf wm iwm f jac
)
264 (if (/= ierpj
0) (go label430
))
266 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
270 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
273 (if (/= miter
0) (go label350
))
274 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
277 (setf (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
)
280 (f2cl-lib:fref savf-%data%
284 (f2cl-lib:fref yh-%data%
289 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
290 (- (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
)
291 (f2cl-lib:fref acor-%data%
295 (setf del
(dvnorm n y ewt
))
296 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
299 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
301 (f2cl-lib:fref yh-%data%
305 (* (f2cl-lib:fref el
(1) ((1 13)))
306 (f2cl-lib:fref savf-%data%
311 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
312 (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
))))
315 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
319 (setf (f2cl-lib:fref savx-%data%
(i) ((1 *)) savx-%offset%
)
322 (f2cl-lib:fref savf-%data%
327 (f2cl-lib:fref yh-%data%
331 (f2cl-lib:fref acor-%data%
335 (dsolpk neq y savf savx ewt wm iwm f psol
)
336 (if (< iersl
0) (go label430
))
337 (if (> iersl
0) (go label410
))
338 (setf del
(dvnorm n savx ewt
))
339 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
342 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
343 (+ (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
344 (f2cl-lib:fref savx-%data%
349 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
351 (f2cl-lib:fref yh-%data%
355 (* (f2cl-lib:fref el
(1) ((1 13)))
356 (f2cl-lib:fref acor-%data%
361 (if (/= m
0) (setf crate
(max (* 0.2d0 crate
) (/ del delp
))))
362 (setf dcon
(/ (* del
(min 1.0d0
(* 1.5d0 crate
))) epcon
))
363 (if (<= dcon
1.0d0
) (go label450
))
364 (setf m
(f2cl-lib:int-add m
1))
365 (if (= m maxcor
) (go label410
))
366 (if (and (>= m
2) (> del
(* 2.0d0 delp
))) (go label410
))
369 (multiple-value-bind (var-0 var-1 var-2 var-3
)
370 (funcall f neq tn y savf
)
371 (declare (ignore var-0 var-2 var-3
))
374 (setf nfe
(f2cl-lib:int-add nfe
1))
377 (if (or (= miter
0) (= jcur
1) (= jacflg
0)) (go label430
))
383 (setf ncf
(f2cl-lib:int-add ncf
1))
384 (setf ncfn
(f2cl-lib:int-add ncfn
1))
387 (setf i1
(f2cl-lib:int-add nqnyh
1))
388 (f2cl-lib:fdo
(jb 1 (f2cl-lib:int-add jb
1))
391 (setf i1
(f2cl-lib:int-sub i1 nyh
))
392 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
396 (setf (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
398 (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
399 (f2cl-lib:fref yh1-%data%
400 ((f2cl-lib:int-add i nyh
))
404 (if (or (< ierpj
0) (< iersl
0)) (go label680
))
405 (if (<= (abs h
) (* hmin
1.00001d0
)) (go label670
))
406 (if (= ncf mxncf
) (go label670
))
414 (setf dsm
(/ del
(f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12))))))
417 (/ (dvnorm n acor ewt
)
418 (f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12))))))
419 (if (> dsm
1.0d0
) (go label500
))
422 (setf nst
(f2cl-lib:int-add nst
1))
425 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
428 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
431 (setf (f2cl-lib:fref yh-%data%
436 (f2cl-lib:fref yh-%data%
440 (* (f2cl-lib:fref el
(j) ((1 13)))
441 (f2cl-lib:fref acor-%data%
444 acor-%offset%
))))))))
446 (setf ialth
(f2cl-lib:int-sub ialth
1))
447 (if (= ialth
0) (go label520
))
448 (if (> ialth
1) (go label700
))
449 (if (= l lmax
) (go label700
))
450 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
454 (setf (f2cl-lib:fref yh-%data%
458 (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
))))
461 (setf kflag
(f2cl-lib:int-sub kflag
1))
463 (setf i1
(f2cl-lib:int-add nqnyh
1))
464 (f2cl-lib:fdo
(jb 1 (f2cl-lib:int-add jb
1))
467 (setf i1
(f2cl-lib:int-sub i1 nyh
))
468 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
472 (setf (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
474 (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
475 (f2cl-lib:fref yh1-%data%
476 ((f2cl-lib:int-add i nyh
))
481 (if (<= (abs h
) (* hmin
1.00001d0
)) (go label660
))
482 (if (<= kflag -
3) (go label640
))
488 (if (= l lmax
) (go label540
))
489 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
493 (setf (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
)
494 (- (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
495 (f2cl-lib:fref yh-%data%
500 (/ (dvnorm n savf ewt
)
501 (f2cl-lib:fref tesco
(3 nq
) ((1 3) (1 12)))))
502 (setf exup
(/ 1.0d0
(f2cl-lib:int-add l
1)))
503 (setf rhup
(/ 1.0d0
(+ (* 1.4d0
(expt dup exup
)) 1.4d-6
)))
505 (setf exsm
(/ 1.0d0 l
))
506 (setf rhsm
(/ 1.0d0
(+ (* 1.2d0
(expt dsm exsm
)) 1.2d-6
)))
508 (if (= nq
1) (go label560
))
512 (f2cl-lib:array-slice yh-%data%
518 (f2cl-lib:fref tesco
(1 nq
) ((1 3) (1 12)))))
519 (setf exdn
(/ 1.0d0 nq
))
520 (setf rhdn
(/ 1.0d0
(+ (* 1.3d0
(expt ddn exdn
)) 1.3d-6
)))
522 (if (>= rhsm rhup
) (go label570
))
523 (if (> rhup rhdn
) (go label590
))
526 (if (< rhsm rhdn
) (go label580
))
531 (setf newq
(f2cl-lib:int-sub nq
1))
533 (if (and (< kflag
0) (> rh
1.0d0
)) (setf rh
1.0d0
))
538 (if (< rh
1.1d0
) (go label610
))
539 (setf r
(/ (f2cl-lib:fref el
(l) ((1 13))) l
))
540 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
544 (setf (f2cl-lib:fref yh-%data%
545 (i (f2cl-lib:int-add newq
1))
548 (* (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
555 (if (and (= kflag
0) (< rh
1.1d0
)) (go label610
))
556 (if (<= kflag -
2) (setf rh
(min rh
0.2d0
)))
557 (if (= newq nq
) (go label170
))
560 (setf l
(f2cl-lib:int-add nq
1))
564 (if (= kflag -
10) (go label660
))
566 (setf rh
(max (/ hmin
(abs h
)) rh
))
568 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
572 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
573 (f2cl-lib:fref yh-%data%
577 (multiple-value-bind (var-0 var-1 var-2 var-3
)
578 (funcall f neq tn y savf
)
579 (declare (ignore var-0 var-2 var-3
))
582 (setf nfe
(f2cl-lib:int-add nfe
1))
583 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
587 (setf (f2cl-lib:fref yh-%data%
(i 2) ((1 nyh
) (1 *)) yh-%offset%
)
589 (f2cl-lib:fref savf-%data%
595 (if (= nq
1) (go label200
))
612 (setf r
(/ 1.0d0
(f2cl-lib:fref tesco
(2 nqu
) ((1 3) (1 12)))))
613 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
617 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
618 (* (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
641 (in-package #:cl-user
)
642 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
643 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
644 (setf (gethash 'fortran-to-lisp
::dstodpk
645 fortran-to-lisp
::*f2cl-function-info
*)
646 (fortran-to-lisp::make-f2cl-finfo
647 :arg-types
'((array fortran-to-lisp
::integer4
(*))
648 (array double-float
(*)) (array double-float
(*))
649 (fortran-to-lisp::integer4
) (array double-float
(*))
650 (array double-float
(*)) (array double-float
(*))
651 (array double-float
(*)) (array double-float
(*))
652 (array double-float
(*))
653 (array fortran-to-lisp
::integer4
(*)) t t t
)
654 :return-values
'(nil nil nil nil nil nil nil nil nil nil nil nil nil
656 :calls
'(fortran-to-lisp::dsolpk fortran-to-lisp
::dpkset
657 fortran-to-lisp
::dvnorm fortran-to-lisp
::dcfode
))))