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 dstoka (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 (stifr (aref (dls002-part-0 *dls002-common-block
*) 0))
79 (newt (aref (dls002-part-1 *dls002-common-block
*) 0))
80 (nsfi (aref (dls002-part-1 *dls002-common-block
*) 1))
81 (nslj (aref (dls002-part-1 *dls002-common-block
*) 2))
82 (njev (aref (dls002-part-1 *dls002-common-block
*) 3))
83 (epcon (aref (dlpk01-part-0 *dlpk01-common-block
*) 1))
84 (jacflg (aref (dlpk01-part-1 *dlpk01-common-block
*) 1))
85 (mnewt (aref (dlpk01-part-1 *dlpk01-common-block
*) 7))
86 (ncfn (aref (dlpk01-part-1 *dlpk01-common-block
*) 11)))
87 (f2cl-lib:with-multi-array-data
88 ((neq f2cl-lib
:integer4 neq-%data% neq-%offset%
)
89 (iwm f2cl-lib
:integer4 iwm-%data% iwm-%offset%
)
90 (y double-float y-%data% y-%offset%
)
91 (yh double-float yh-%data% yh-%offset%
)
92 (yh1 double-float yh1-%data% yh1-%offset%
)
93 (ewt double-float ewt-%data% ewt-%offset%
)
94 (savf double-float savf-%data% savf-%offset%
)
95 (savx double-float savx-%data% savx-%offset%
)
96 (acor double-float acor-%data% acor-%offset%
)
97 (wm double-float wm-%data% wm-%offset%
))
98 (prog ((nslow 0) (newq 0) (ncf 0) (m 0) (jok 0) (jb 0) (j 0) (iret 0)
99 (iredo 0) (i1 0) (i 0) (told 0.0d0
) (stiff 0.0d0
) (roc 0.0d0
)
100 (rhup 0.0d0
) (rhsm 0.0d0
) (rhdn 0.0d0
) (rh 0.0d0
) (r 0.0d0
)
101 (dfnorm 0.0d0
) (exup 0.0d0
) (exsm 0.0d0
) (exdn 0.0d0
)
102 (dup 0.0d0
) (dsm 0.0d0
) (drc 0.0d0
) (delp 0.0d0
) (del 0.0d0
)
103 (ddn 0.0d0
) (dcon 0.0d0
))
104 (declare (type (double-float) dcon ddn del delp drc dsm dup exdn exsm
105 exup dfnorm r rh rhdn rhsm rhup roc
107 (type (f2cl-lib:integer4
) i i1 iredo iret j jb jok m ncf
117 (if (> jstart
0) (go label200
))
118 (if (= jstart -
1) (go label100
))
119 (if (= jstart -
2) (go label160
))
120 (setf lmax
(f2cl-lib:int-add maxord
1))
124 (setf rmax
10000.0d0
)
139 (setf lmax
(f2cl-lib:int-add maxord
1))
140 (if (= ialth
1) (setf ialth
2))
141 (if (= meth meo
) (go label110
))
142 (dcfode meth elco tesco
)
144 (if (> nq maxord
) (go label120
))
149 (if (<= nq maxord
) (go label160
))
153 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
157 (setf (f2cl-lib:fref el
(i) ((1 13)))
158 (f2cl-lib:fref elco
(i nq
) ((1 13) (1 12))))))
159 (setf nqnyh
(f2cl-lib:int-mul nq nyh
))
160 (setf rc
(/ (* rc
(f2cl-lib:fref el
(1) ((1 13)))) el0
))
161 (setf el0
(f2cl-lib:fref el
(1) ((1 13))))
162 (setf conit
(/ 0.5d0
(f2cl-lib:int-add nq
2)))
163 (setf epcon
(* conit
(f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12)))))
165 (/ (dvnorm n savf ewt
)
166 (f2cl-lib:fref tesco
(1 l
) ((1 3) (1 12)))))
167 (setf exdn
(/ 1.0d0 l
))
168 (setf rhdn
(/ 1.0d0
(+ (* 1.3d0
(expt ddn exdn
)) 1.3d-6
)))
169 (setf rh
(min rhdn
1.0d0
))
171 (if (= h hold
) (go label170
))
172 (setf rh
(min rh
(abs (/ h hold
))))
176 (dcfode meth elco tesco
)
178 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
182 (setf (f2cl-lib:fref el
(i) ((1 13)))
183 (f2cl-lib:fref elco
(i nq
) ((1 13) (1 12))))))
184 (setf nqnyh
(f2cl-lib:int-mul nq nyh
))
185 (setf rc
(/ (* rc
(f2cl-lib:fref el
(1) ((1 13)))) el0
))
186 (setf el0
(f2cl-lib:fref el
(1) ((1 13))))
187 (setf conit
(/ 0.5d0
(f2cl-lib:int-add nq
2)))
188 (setf epcon
(* conit
(f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12)))))
189 (f2cl-lib:computed-goto
(label160 label170 label200
) iret
)
191 (if (= h hold
) (go label200
))
197 (setf rh
(max rh
(/ hmin
(abs h
))))
199 (setf rh
(min rh rmax
))
200 (setf rh
(/ rh
(max 1.0d0
(* (abs h
) hmxi rh
))))
202 (f2cl-lib:fdo
(j 2 (f2cl-lib:int-add j
1))
206 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
209 (setf (f2cl-lib:fref yh-%data%
214 (f2cl-lib:fref yh-%data%
223 (if (= iredo
0) (go label690
))
226 ((or (= newt
0) (= jacflg
0))
231 (setf drc
(abs (- rc
1.0d0
)))
232 (if (> drc ccmax
) (setf ipup miter
))
233 (if (>= nst
(f2cl-lib:int-add nslp msbp
)) (setf ipup miter
))))
235 (setf i1
(f2cl-lib:int-add nqnyh
1))
236 (f2cl-lib:fdo
(jb 1 (f2cl-lib:int-add jb
1))
239 (setf i1
(f2cl-lib:int-sub i1 nyh
))
240 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
244 (setf (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
246 (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
247 (f2cl-lib:fref yh1-%data%
248 ((f2cl-lib:int-add i nyh
))
258 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
262 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
263 (f2cl-lib:fref yh-%data%
267 (multiple-value-bind (var-0 var-1 var-2 var-3
)
268 (funcall f neq tn y savf
)
269 (declare (ignore var-0 var-2 var-3
))
272 (setf nfe
(f2cl-lib:int-add nfe
1))
273 (if (or (= newt
0) (<= ipup
0)) (go label250
))
275 (if (or (= nst
0) (> nst
(f2cl-lib:int-add nslj
50))) (setf jok -
1))
276 (if (and (= icf
1) (< drc
0.2d0
)) (setf jok -
1))
277 (if (= icf
2) (setf jok -
1))
279 ((= jok
(f2cl-lib:int-sub
1))
281 (setf njev
(f2cl-lib:int-add njev
1))))
283 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8 var-9
285 (dsetpk neq y yh1 ewt acor savf jok wm iwm f jac
)
286 (declare (ignore var-0 var-1 var-2 var-3 var-4 var-5 var-7 var-8
294 (if (/= ierpj
0) (go label430
))
296 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
300 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
303 (if (/= newt
0) (go label350
))
304 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
307 (setf (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
)
310 (f2cl-lib:fref savf-%data%
314 (f2cl-lib:fref yh-%data%
319 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
320 (- (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
)
321 (f2cl-lib:fref acor-%data%
325 (setf del
(dvnorm n y ewt
))
326 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
329 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
331 (f2cl-lib:fref yh-%data%
335 (* (f2cl-lib:fref el
(1) ((1 13)))
336 (f2cl-lib:fref savf-%data%
341 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
342 (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
))))
346 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
350 (setf (f2cl-lib:fref savx-%data%
(i) ((1 *)) savx-%offset%
)
353 (f2cl-lib:fref savf-%data%
358 (f2cl-lib:fref yh-%data%
362 (f2cl-lib:fref acor-%data%
366 (setf dfnorm
(dvnorm n savx ewt
))
367 (dsolpk neq y savf savx ewt wm iwm f psol
)
368 (if (< iersl
0) (go label430
))
369 (if (> iersl
0) (go label410
))
370 (setf del
(dvnorm n savx ewt
))
371 (if (> del
1.0d-8
) (setf stiff
(max stiff
(/ dfnorm del
))))
372 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
375 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
376 (+ (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
377 (f2cl-lib:fref savx-%data%
382 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
384 (f2cl-lib:fref yh-%data%
388 (* (f2cl-lib:fref el
(1) ((1 13)))
389 (f2cl-lib:fref acor-%data%
396 (setf roc
(max 0.05d0
(/ del delp
)))
397 (setf crate
(max (* 0.2d0 crate
) roc
))))
398 (setf dcon
(/ (* del
(min 1.0d0
(* 1.5d0 crate
))) epcon
))
399 (if (<= dcon
1.0d0
) (go label450
))
400 (setf m
(f2cl-lib:int-add m
1))
401 (if (= m maxcor
) (go label410
))
402 (if (and (>= m
2) (> del
(* 2.0d0 delp
))) (go label410
))
403 (if (> roc
10.0d0
) (go label410
))
404 (if (> roc
0.8d0
) (setf nslow
(f2cl-lib:int-add nslow
1)))
405 (if (>= nslow
2) (go label410
))
408 (multiple-value-bind (var-0 var-1 var-2 var-3
)
409 (funcall f neq tn y savf
)
410 (declare (ignore var-0 var-2 var-3
))
413 (setf nfe
(f2cl-lib:int-add nfe
1))
419 (if (= nst
0) (go label430
))
420 (if (= miter
0) (go label430
))
422 (setf stifr
1023.0d0
)
425 (if (or (= jcur
1) (= jacflg
0)) (go label430
))
430 (setf ncf
(f2cl-lib:int-add ncf
1))
431 (setf ncfn
(f2cl-lib:int-add ncfn
1))
434 (setf i1
(f2cl-lib:int-add nqnyh
1))
435 (f2cl-lib:fdo
(jb 1 (f2cl-lib:int-add jb
1))
438 (setf i1
(f2cl-lib:int-sub i1 nyh
))
439 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
443 (setf (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
445 (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
446 (f2cl-lib:fref yh1-%data%
447 ((f2cl-lib:int-add i nyh
))
451 (if (or (< ierpj
0) (< iersl
0)) (go label680
))
452 (if (<= (abs h
) (* hmin
1.00001d0
)) (go label670
))
453 (if (= ncf mxncf
) (go label670
))
460 (if (> newt
0) (setf stifr
(* 0.5d0
(+ stifr stiff
))))
462 (setf dsm
(/ del
(f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12))))))
465 (/ (dvnorm n acor ewt
)
466 (f2cl-lib:fref tesco
(2 nq
) ((1 3) (1 12))))))
467 (if (> dsm
1.0d0
) (go label500
))
470 (setf nst
(f2cl-lib:int-add nst
1))
471 (if (= newt
0) (setf nsfi
(f2cl-lib:int-add nsfi
1)))
472 (if (and (> newt
0) (< stifr
1.5d0
)) (setf newt
0))
475 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
478 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
481 (setf (f2cl-lib:fref yh-%data%
486 (f2cl-lib:fref yh-%data%
490 (* (f2cl-lib:fref el
(j) ((1 13)))
491 (f2cl-lib:fref acor-%data%
494 acor-%offset%
))))))))
496 (setf ialth
(f2cl-lib:int-sub ialth
1))
497 (if (= ialth
0) (go label520
))
498 (if (> ialth
1) (go label700
))
499 (if (= l lmax
) (go label700
))
500 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
504 (setf (f2cl-lib:fref yh-%data%
508 (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
))))
511 (setf kflag
(f2cl-lib:int-sub kflag
1))
513 (setf i1
(f2cl-lib:int-add nqnyh
1))
514 (f2cl-lib:fdo
(jb 1 (f2cl-lib:int-add jb
1))
517 (setf i1
(f2cl-lib:int-sub i1 nyh
))
518 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
522 (setf (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
524 (f2cl-lib:fref yh1-%data%
(i) ((1 *)) yh1-%offset%
)
525 (f2cl-lib:fref yh1-%data%
526 ((f2cl-lib:int-add i nyh
))
531 (if (<= (abs h
) (* hmin
1.00001d0
)) (go label660
))
532 (if (<= kflag -
3) (go label640
))
538 (if (= l lmax
) (go label540
))
539 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
543 (setf (f2cl-lib:fref savf-%data%
(i) ((1 *)) savf-%offset%
)
544 (- (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
545 (f2cl-lib:fref yh-%data%
550 (/ (dvnorm n savf ewt
)
551 (f2cl-lib:fref tesco
(3 nq
) ((1 3) (1 12)))))
552 (setf exup
(/ 1.0d0
(f2cl-lib:int-add l
1)))
553 (setf rhup
(/ 1.0d0
(+ (* 1.4d0
(expt dup exup
)) 1.4d-6
)))
555 (setf exsm
(/ 1.0d0 l
))
556 (setf rhsm
(/ 1.0d0
(+ (* 1.2d0
(expt dsm exsm
)) 1.2d-6
)))
558 (if (= nq
1) (go label560
))
562 (f2cl-lib:array-slice yh-%data%
568 (f2cl-lib:fref tesco
(1 nq
) ((1 3) (1 12)))))
569 (setf exdn
(/ 1.0d0 nq
))
570 (setf rhdn
(/ 1.0d0
(+ (* 1.3d0
(expt ddn exdn
)) 1.3d-6
)))
572 (if (>= rhsm rhup
) (go label570
))
573 (if (> rhup rhdn
) (go label590
))
576 (if (< rhsm rhdn
) (go label580
))
581 (setf newq
(f2cl-lib:int-sub nq
1))
583 (if (and (< kflag
0) (> rh
1.0d0
)) (setf rh
1.0d0
))
588 (if (< rh
1.1d0
) (go label610
))
589 (setf r
(/ (f2cl-lib:fref el
(l) ((1 13))) l
))
590 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
594 (setf (f2cl-lib:fref yh-%data%
595 (i (f2cl-lib:int-add newq
1))
598 (* (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
605 (if (and (= kflag
0) (< rh
1.1d0
)) (go label610
))
606 (if (<= kflag -
2) (setf rh
(min rh
0.2d0
)))
607 (if (= newq nq
) (go label170
))
610 (setf l
(f2cl-lib:int-add nq
1))
614 (if (= kflag -
10) (go label660
))
616 (setf rh
(max (/ hmin
(abs h
)) rh
))
618 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
622 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
)
623 (f2cl-lib:fref yh-%data%
627 (multiple-value-bind (var-0 var-1 var-2 var-3
)
628 (funcall f neq tn y savf
)
629 (declare (ignore var-0 var-2 var-3
))
632 (setf nfe
(f2cl-lib:int-add nfe
1))
633 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
637 (setf (f2cl-lib:fref yh-%data%
(i 2) ((1 nyh
) (1 *)) yh-%offset%
)
639 (f2cl-lib:fref savf-%data%
645 (if (= nq
1) (go label200
))
662 (setf r
(/ 1.0d0
(f2cl-lib:fref tesco
(2 nqu
) ((1 3) (1 12)))))
663 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
667 (setf (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
668 (* (f2cl-lib:fref acor-%data%
(i) ((1 *)) acor-%offset%
)
691 (in-package #:cl-user
)
692 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
693 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
694 (setf (gethash 'fortran-to-lisp
::dstoka
695 fortran-to-lisp
::*f2cl-function-info
*)
696 (fortran-to-lisp::make-f2cl-finfo
697 :arg-types
'((array fortran-to-lisp
::integer4
(*))
698 (array double-float
(*)) (array double-float
(*))
699 (fortran-to-lisp::integer4
) (array double-float
(*))
700 (array double-float
(*)) (array double-float
(*))
701 (array double-float
(*)) (array double-float
(*))
702 (array double-float
(*))
703 (array fortran-to-lisp
::integer4
(*)) t t t
)
704 :return-values
'(nil nil nil nil nil nil nil nil nil nil nil nil nil
706 :calls
'(fortran-to-lisp::dsolpk fortran-to-lisp
::dsetpk
707 fortran-to-lisp
::dvnorm fortran-to-lisp
::dcfode
))))