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-2020-04 (21D 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))
17 (in-package "HOMPACK")
21 (declare (type (f2cl-lib:integer4
4 4) litfh
) (ignorable litfh
))
23 (n nfe iflag start crash hold h relerr abserr s y yp yold ypold a qr
24 alpha tz pivot w wp z0 z1 sspar par ipar
)
25 (declare (type (array f2cl-lib
:integer4
(*)) ipar
)
26 (type (array double-float
(*)) par
)
27 (type (array double-float
(*)) sspar
)
28 (type (array f2cl-lib
:integer4
(*)) pivot
)
29 (type (array double-float
(*)) z1 z0 wp w tz alpha qr a ypold yold
31 (type (double-float) s abserr relerr h hold
)
32 (type f2cl-lib
:logical crash start
)
33 (type (f2cl-lib:integer4
) iflag nfe n
))
34 (f2cl-lib:with-multi-array-data
35 ((y double-float y-%data% y-%offset%
)
36 (yp double-float yp-%data% yp-%offset%
)
37 (yold double-float yold-%data% yold-%offset%
)
38 (ypold double-float ypold-%data% ypold-%offset%
)
39 (a double-float a-%data% a-%offset%
)
40 (qr double-float qr-%data% qr-%offset%
)
41 (alpha double-float alpha-%data% alpha-%offset%
)
42 (tz double-float tz-%data% tz-%offset%
)
43 (w double-float w-%data% w-%offset%
)
44 (wp double-float wp-%data% wp-%offset%
)
45 (z0 double-float z0-%data% z0-%offset%
)
46 (z1 double-float z1-%data% z1-%offset%
)
47 (pivot f2cl-lib
:integer4 pivot-%data% pivot-%offset%
)
48 (sspar double-float sspar-%data% sspar-%offset%
)
49 (par double-float par-%data% par-%offset%
)
50 (ipar f2cl-lib
:integer4 ipar-%data% ipar-%offset%
))
51 (labels ((dd01 (f0 f1 dels
)
52 (f2cl-lib:f2cl
/ (+ f1
(- f0
)) dels
))
53 (dd001 (f0 fp0 f1 dels
)
54 (/ (- (dd01 f0 f1 dels
) fp0
) dels
))
55 (dd011 (f0 f1 fp1 dels
)
56 (/ (- fp1
(dd01 f0 f1 dels
)) dels
))
57 (dd0011 (f0 fp0 f1 fp1 dels
)
58 (/ (- (dd011 f0 f1 fp1 dels
) (dd001 f0 fp0 f1 dels
)) dels
))
59 (qofs (f0 fp0 f1 fp1 dels s
)
64 (+ (* (dd0011 f0 fp0 f1 fp1 dels
) (- s dels
))
65 (dd001 f0 fp0 f1 dels
))
70 (declare (ftype (function (double-float double-float double-float
)
71 (values double-float
&rest t
))
73 (declare (ftype (function
74 (double-float double-float double-float double-float
)
75 (values double-float
&rest t
))
77 (declare (ftype (function
78 (double-float double-float double-float double-float
)
79 (values double-float
&rest t
))
81 (declare (ftype (function
82 (double-float double-float double-float double-float
84 (values double-float
&rest t
))
86 (declare (ftype (function
87 (double-float double-float double-float double-float
88 double-float double-float
)
89 (values double-float
&rest t
))
91 (prog ((fail nil
) (itnum 0) (j 0) (judy 0) (np1 0) (dcalc 0.0)
92 (dels 0.0) (f0 0.0) (f1 0.0) (fouru 0.0) (fp0 0.0) (fp1 0.0)
93 (hfail 0.0) (ht 0.0) (lcalc 0.0) (rcalc 0.0) (rholen 0.0)
94 (temp 0.0) (twou 0.0))
95 (declare (type f2cl-lib
:logical fail
)
96 (type (f2cl-lib:integer4
) itnum j judy np1
)
97 (type (double-float) dcalc dels f0 f1 fouru fp0 fp1 hfail ht
98 lcalc rcalc rholen temp twou
))
99 (setf twou
(* 2.0f0
(f2cl-lib:d1mach
4)))
100 (setf fouru
(+ twou twou
))
101 (setf np1
(f2cl-lib:int-add n
1))
102 (setf crash f2cl-lib
:%true%
)
103 (if (< s
0.0f0
) (go end_label
))
105 ((< h
(* fouru
(+ 1.0f0 s
)))
106 (setf h
(* fouru
(+ 1.0f0 s
)))
108 (setf temp
(dnrm2 np1 y
1))
109 (if (>= (* 0.5f0
(+ (* relerr temp
) abserr
)) (* twou temp
))
113 (setf relerr
(* fouru
(+ 1.0f0 fouru
)))
114 (setf abserr
(max abserr
0.0)))
116 (setf abserr
(* fouru temp
))))
119 (setf crash f2cl-lib
:%false%
)
120 (if (not start
) (go label300
))
121 (setf fail f2cl-lib
:%false%
)
122 (setf start f2cl-lib
:%false%
)
127 (f2cl-lib:fsqrt
(+ (* relerr temp
) abserr
)))))
128 (setf (f2cl-lib:fref ypold-%data%
130 ((1 (f2cl-lib:int-add n
1)))
132 (coerce 1.0f0
'double-float
))
133 (f2cl-lib:fdo
(j 2 (f2cl-lib:int-add j
1))
136 (setf (f2cl-lib:fref ypold-%data%
138 ((1 (f2cl-lib:int-add n
1)))
140 (coerce 0.0f0
'double-float
))
143 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8 var-9
144 var-10 var-11 var-12 var-13
)
145 (tangnf s y yp ypold a qr alpha tz pivot nfe n iflag par ipar
)
146 (declare (ignore var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
147 var-10 var-12 var-13
))
151 (if (> iflag
0) (go end_label
))
153 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
158 (f2cl-lib:fref y-%data%
160 ((1 (f2cl-lib:int-add n
1)))
163 (f2cl-lib:fref yp-%data%
165 ((1 (f2cl-lib:int-add n
1)))
167 (setf (f2cl-lib:fref w-%data%
169 ((1 (f2cl-lib:int-add n
1)))
172 (setf (f2cl-lib:fref z0-%data%
174 ((1 (f2cl-lib:int-add n
1)))
178 (f2cl-lib:fdo
(judy 1 (f2cl-lib:int-add judy
1))
181 (setf rholen
(coerce -
1.0f0
'double-float
))
183 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
184 var-9 var-10 var-11 var-12 var-13
)
185 (tangnf rholen w wp ypold a qr alpha tz pivot nfe n iflag par
187 (declare (ignore var-1 var-2 var-3 var-4 var-5 var-6 var-7
188 var-8 var-10 var-12 var-13
))
192 (if (> iflag
0) (go end_label
))
193 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
196 (setf (f2cl-lib:fref w-%data%
198 ((1 (f2cl-lib:int-add n
1)))
201 (f2cl-lib:fref w-%data%
203 ((1 (f2cl-lib:int-add n
1)))
205 (f2cl-lib:fref tz-%data%
207 ((1 (f2cl-lib:int-add n
1)))
213 (setf lcalc
(dnrm2 np1 tz
1))
215 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
218 (setf (f2cl-lib:fref z1-%data%
220 ((1 (f2cl-lib:int-add n
1)))
222 (f2cl-lib:fref w-%data%
224 ((1 (f2cl-lib:int-add n
1)))
228 (setf lcalc
(/ (dnrm2 np1 tz
1) lcalc
))
229 (setf rcalc
(/ rholen rcalc
))))
230 (if (<= (dnrm2 np1 tz
1) (+ (* relerr
(dnrm2 np1 w
1)) abserr
))
234 ((<= h
(* fouru
(+ 1.0f0 s
)))
240 (setf fail f2cl-lib
:%false%
)
242 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
247 (f2cl-lib:fref yold-%data%
249 ((1 (f2cl-lib:int-add n
1)))
251 (f2cl-lib:fref ypold-%data%
253 ((1 (f2cl-lib:int-add n
1)))
255 (f2cl-lib:fref y-%data%
257 ((1 (f2cl-lib:int-add n
1)))
259 (f2cl-lib:fref yp-%data%
261 ((1 (f2cl-lib:int-add n
1)))
264 (setf (f2cl-lib:fref w-%data%
266 ((1 (f2cl-lib:int-add n
1)))
269 (setf (f2cl-lib:fref z0-%data%
271 ((1 (f2cl-lib:int-add n
1)))
275 (f2cl-lib:fdo
(judy 1 (f2cl-lib:int-add judy
1))
278 (setf rholen
(coerce -
1.0f0
'double-float
))
280 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
281 var-9 var-10 var-11 var-12 var-13
)
282 (tangnf rholen w wp yp a qr alpha tz pivot nfe n iflag par
284 (declare (ignore var-1 var-2 var-3 var-4 var-5 var-6 var-7
285 var-8 var-10 var-12 var-13
))
289 (if (> iflag
0) (go end_label
))
290 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
293 (setf (f2cl-lib:fref w-%data%
295 ((1 (f2cl-lib:int-add n
1)))
298 (f2cl-lib:fref w-%data%
300 ((1 (f2cl-lib:int-add n
1)))
302 (f2cl-lib:fref tz-%data%
304 ((1 (f2cl-lib:int-add n
1)))
310 (setf lcalc
(dnrm2 np1 tz
1))
312 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
315 (setf (f2cl-lib:fref z1-%data%
317 ((1 (f2cl-lib:int-add n
1)))
319 (f2cl-lib:fref w-%data%
321 ((1 (f2cl-lib:int-add n
1)))
325 (setf lcalc
(/ (dnrm2 np1 tz
1) lcalc
))
326 (setf rcalc
(/ rholen rcalc
))))
327 (if (<= (dnrm2 np1 tz
1) (+ (* relerr
(dnrm2 np1 w
1)) abserr
))
330 (setf fail f2cl-lib
:%true%
)
333 ((<= h
(* fouru
(+ 1.0f0 s
)))
339 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
342 (setf (f2cl-lib:fref yold-%data%
344 ((1 (f2cl-lib:int-add n
1)))
346 (f2cl-lib:fref y-%data%
348 ((1 (f2cl-lib:int-add n
1)))
350 (setf (f2cl-lib:fref ypold-%data%
352 ((1 (f2cl-lib:int-add n
1)))
354 (f2cl-lib:fref yp-%data%
356 ((1 (f2cl-lib:int-add n
1)))
358 (setf (f2cl-lib:fref y-%data%
360 ((1 (f2cl-lib:int-add n
1)))
362 (f2cl-lib:fref w-%data%
364 ((1 (f2cl-lib:int-add n
1)))
366 (setf (f2cl-lib:fref yp-%data%
368 ((1 (f2cl-lib:int-add n
1)))
370 (f2cl-lib:fref wp-%data%
372 ((1 (f2cl-lib:int-add n
1)))
374 (setf (f2cl-lib:fref w-%data%
376 ((1 (f2cl-lib:int-add n
1)))
379 (f2cl-lib:fref y-%data%
381 ((1 (f2cl-lib:int-add n
1)))
383 (f2cl-lib:fref yold-%data%
385 ((1 (f2cl-lib:int-add n
1)))
388 (setf hold
(dnrm2 np1 w
1))
391 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
394 (setf (f2cl-lib:fref tz-%data%
396 ((1 (f2cl-lib:int-add n
1)))
399 (f2cl-lib:fref z0-%data%
401 ((1 (f2cl-lib:int-add n
1)))
403 (f2cl-lib:fref y-%data%
405 ((1 (f2cl-lib:int-add n
1)))
407 (setf (f2cl-lib:fref w-%data%
409 ((1 (f2cl-lib:int-add n
1)))
412 (f2cl-lib:fref z1-%data%
414 ((1 (f2cl-lib:int-add n
1)))
416 (f2cl-lib:fref y-%data%
418 ((1 (f2cl-lib:int-add n
1)))
421 (setf dcalc
(dnrm2 np1 tz
1))
422 (if (/= dcalc
0.0f0
) (setf dcalc
(/ (dnrm2 np1 w
1) dcalc
)))
423 (if (= itnum
1) (setf lcalc
(coerce 0.0f0
'double-float
)))
425 ((= (+ lcalc rcalc dcalc
) 0.0f0
)
427 (* (f2cl-lib:fref sspar-%data%
(7) ((1 8)) sspar-%offset%
)
436 (f2cl-lib:fref sspar-%data%
441 (f2cl-lib:fref sspar-%data%
446 (f2cl-lib:fref sspar-%data%
451 (f2cl-lib:fref sspar-%data%
460 (f2cl-lib:fref sspar-%data%
465 (f2cl-lib:fref sspar-%data%
469 (* (f2cl-lib:fref sspar-%data%
(7) ((1 8)) sspar-%offset%
)
471 (f2cl-lib:fref sspar-%data%
(5) ((1 8)) sspar-%offset%
)))
474 (setf h
(max h hold
)))
476 (setf h
(min h hold
))))
477 (if fail
(setf h
(min h hfail
)))
508 (in-package #:cl-user
)
509 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
510 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
511 (setf (gethash 'fortran-to-lisp
::stepnf
512 fortran-to-lisp
::*f2cl-function-info
*)
513 (fortran-to-lisp::make-f2cl-finfo
514 :arg-types
'((fortran-to-lisp::integer4
) (fortran-to-lisp::integer4
)
515 (fortran-to-lisp::integer4
) fortran-to-lisp
::logical
516 fortran-to-lisp
::logical
(double-float) (double-float)
517 (double-float) (double-float) (double-float)
518 (array double-float
(*)) (array double-float
(*))
519 (array double-float
(*)) (array double-float
(*))
520 (array double-float
(*)) (array double-float
(*))
521 (array double-float
(*)) (array double-float
(*))
522 (array fortran-to-lisp
::integer4
(*))
523 (array double-float
(*)) (array double-float
(*))
524 (array double-float
(*)) (array double-float
(*))
525 (array double-float
(*)) (array double-float
(*))
526 (array fortran-to-lisp
::integer4
(*)))
527 :return-values
'(nil fortran-to-lisp
::nfe fortran-to-lisp
::iflag
528 fortran-to-lisp
::start fortran-to-lisp
::crash
529 fortran-to-lisp
::hold fortran-to-lisp
::h
530 fortran-to-lisp
::relerr fortran-to-lisp
::abserr
531 fortran-to-lisp
::s nil nil nil nil nil nil nil nil
532 nil nil nil nil nil nil nil nil
)
533 :calls
'(fortran-to-lisp::dnrm2 fortran-to-lisp
::tangnf
534 fortran-to-lisp
::d1mach
))))