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")
22 :element-type
'single-float
23 :initial-contents
'(0.8735115f0
0.1531947f0
0.03191815f0
24 3.339946f-11
0.4677788f0
6.970123f-4
25 1.980863f-6
1.122789f-9
)))
28 :element-type
'single-float
29 :initial-contents
'(0.9043128f0 -
0.7075675f0 -
4.667383f0
30 -
3.677482f0
0.8516099f0 -
0.1953119f0
31 -
4.830636f0 -
0.9770528f0
1.040061f0
32 0.03793395f0
1.042177f0
0.04450706f0
)))
64 (declare (type (array single-float
(8)) wrge
)
65 (type (array single-float
(12)) acof
)
66 (type f2cl-lib
:logical failed
)
67 (type (f2cl-lib:integer4
) i itcnt litfh j lk lst np1 pcgwk zu
)
68 (type (double-float) alpha cordis dels fouru gamma hfail htemp
69 idlerr omega one p0 p1 pp0 pp1 sigma temp theta
70 twou wkold xstep lambda$
))
72 (n nfe iflag lenqr start crash hold h wk relerr abserr s y yp yold
73 ypold a qr pivot pp rhovec z0 dz t$ work sspar par ipar
)
74 (declare (type (array f2cl-lib
:integer4
(*)) ipar
)
75 (type (array double-float
(*)) par
)
76 (type (array double-float
(*)) sspar
)
77 (type (array f2cl-lib
:integer4
(*)) pivot
)
78 (type (array double-float
(*)) work t$ dz z0 rhovec pp qr a ypold
80 (type (double-float) s abserr relerr wk h hold
)
81 (type f2cl-lib
:logical crash start
)
82 (type (f2cl-lib:integer4
) lenqr iflag nfe n
))
83 (f2cl-lib:with-multi-array-data
84 ((y double-float y-%data% y-%offset%
)
85 (yp double-float yp-%data% yp-%offset%
)
86 (yold double-float yold-%data% yold-%offset%
)
87 (ypold double-float ypold-%data% ypold-%offset%
)
88 (a double-float a-%data% a-%offset%
)
89 (qr double-float qr-%data% qr-%offset%
)
90 (pp double-float pp-%data% pp-%offset%
)
91 (rhovec double-float rhovec-%data% rhovec-%offset%
)
92 (z0 double-float z0-%data% z0-%offset%
)
93 (dz double-float dz-%data% dz-%offset%
)
94 (t$ double-float t$-%data% t$-%offset%
)
95 (work double-float work-%data% work-%offset%
)
96 (pivot f2cl-lib
:integer4 pivot-%data% pivot-%offset%
)
97 (sspar double-float sspar-%data% sspar-%offset%
)
98 (par double-float par-%data% par-%offset%
)
99 (ipar f2cl-lib
:integer4 ipar-%data% ipar-%offset%
))
100 (labels ((dd01 (p0 p1 dels
)
101 (f2cl-lib:f2cl
/ (+ p1
(- p0
)) dels
))
102 (dd001 (p0 pp0 p1 dels
)
103 (/ (- (dd01 p0 p1 dels
) pp0
) dels
))
104 (dd011 (p0 p1 pp1 dels
)
105 (/ (- pp1
(dd01 p0 p1 dels
)) dels
))
106 (dd0011 (p0 pp0 p1 pp1 dels
)
107 (/ (- (dd011 p0 p1 pp1 dels
) (dd001 p0 pp0 p1 dels
)) dels
))
108 (qofs (p0 pp0 p1 pp1 dels s
)
113 (+ (* (dd0011 p0 pp0 p1 pp1 dels
) (- s dels
))
114 (dd001 p0 pp0 p1 dels
))
119 (declare (ftype (function (double-float double-float double-float
)
120 (values double-float
&rest t
))
122 (declare (ftype (function
123 (double-float double-float double-float double-float
)
124 (values double-float
&rest t
))
126 (declare (ftype (function
127 (double-float double-float double-float double-float
)
128 (values double-float
&rest t
))
130 (declare (ftype (function
131 (double-float double-float double-float double-float
133 (values double-float
&rest t
))
135 (declare (ftype (function
136 (double-float double-float double-float double-float
137 double-float double-float
)
138 (values double-float
&rest t
))
142 (setf one
(coerce 1.0f0
'double-float
))
143 (setf twou
(* 2.0f0
(f2cl-lib:d1mach
4)))
144 (setf fouru
(+ twou twou
))
145 (setf np1
(f2cl-lib:int-add n
1))
146 (setf failed f2cl-lib
:%false%
)
147 (setf crash f2cl-lib
:%true%
)
149 (setf pcgwk
(f2cl-lib:int-add
(f2cl-lib:int-mul
2 n
) 3))
150 (setf zu
(f2cl-lib:int-add
(f2cl-lib:int-mul
3 n
) 4))
151 (if (< s
0.0f0
) (go end_label
))
153 ((< h
(* fouru
(+ 1.0f0 s
)))
154 (setf h
(* fouru
(+ 1.0f0 s
)))
156 (setf temp
(+ (dnrm2 np1 y
1) 1.0f0
))
158 ((< (* 0.5f0
(+ (* relerr temp
) abserr
)) (* twou temp
))
161 (setf relerr
(* fouru
(+ 1.0f0 fouru
)))
162 (setf temp
(coerce 0.0f0
'double-float
))
163 (setf abserr
(max abserr temp
)))
165 (setf abserr
(* fouru temp
))))
167 (setf crash f2cl-lib
:%false%
)
170 (setf idlerr
(f2cl-lib:fsqrt
(f2cl-lib:fsqrt abserr
)))
171 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
172 ((> j
(f2cl-lib:int-add
(f2cl-lib:int-mul
2 n
) 2))
175 (setf (f2cl-lib:fref work-%data%
184 (coerce 0.0f0
'double-float
))
187 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8 var-9
188 var-10 var-11 var-12 var-13 var-14
)
189 (tangqs y yp ypold a qr pivot pp rhovec work n lenqr iflag nfe
191 (declare (ignore var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7
192 var-8 var-9 var-10 var-13 var-14
))
195 (if (> iflag
0) (go end_label
))))
200 (daxpy np1 h yp
1 z0
1))
202 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
205 (setf (f2cl-lib:fref z0-%data%
207 ((1 (f2cl-lib:int-add n
1)))
210 (f2cl-lib:fref yold-%data%
212 ((1 (f2cl-lib:int-add n
1)))
214 (f2cl-lib:fref ypold-%data%
216 ((1 (f2cl-lib:int-add n
1)))
218 (f2cl-lib:fref y-%data%
220 ((1 (f2cl-lib:int-add n
1)))
222 (f2cl-lib:fref yp-%data%
224 ((1 (f2cl-lib:int-add n
1)))
228 (f2cl-lib:fdo
(itcnt 1 (f2cl-lib:int-add itcnt
1))
229 ((> itcnt litfh
) nil
)
231 (f2cl-lib:fdo
(j zu
(f2cl-lib:int-add j
1))
233 (f2cl-lib:int-add zu
(f2cl-lib:int-mul
2 n
) 1))
236 (setf (f2cl-lib:fref work-%data%
245 (coerce 0.0f0
'double-float
))
248 (f2cl-lib:fref z0-%data%
250 ((1 (f2cl-lib:int-add n
1)))
253 ((= iflag
(f2cl-lib:int-sub
2))
254 (rhojs a lambda$ z0 qr lenqr pivot pp par ipar
)
255 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5
)
256 (rho a lambda$ z0 rhovec par ipar
)
257 (declare (ignore var-0 var-2 var-3 var-4 var-5
))
258 (setf lambda$ var-1
)))
259 ((= iflag
(f2cl-lib:int-sub
1))
260 (fjacs z0 qr lenqr pivot
)
261 (dscal lenqr lambda$ qr
1)
262 (setf sigma
(- 1.0f0 lambda$
))
263 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
266 (setf (f2cl-lib:fref qr-%data%
267 ((f2cl-lib:fref pivot
275 (f2cl-lib:fref qr-%data%
276 ((f2cl-lib:fref pivot
286 (dcopy n z0
1 rhovec
1)
287 (daxpy n
(- one
) a
1 rhovec
1)
289 (dscal n
(- one
) pp
1)
290 (daxpy n one rhovec
1 pp
1)
291 (daxpy n
(- lambda$
) pp
1 rhovec
1))
293 (fjacs z0 qr lenqr pivot
)
294 (dscal lenqr
(- lambda$
) qr
1)
295 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
298 (setf (f2cl-lib:fref qr-%data%
299 ((f2cl-lib:fref pivot
307 (f2cl-lib:fref qr-%data%
308 ((f2cl-lib:fref pivot
318 (dcopy n z0
1 rhovec
1)
319 (daxpy n
(- one
) a
1 rhovec
1)
321 (daxpy n
(- one
) a
1 pp
1)
322 (daxpy n
(- lambda$
) pp
1 rhovec
1)))
323 (setf (f2cl-lib:fref rhovec-%data%
325 ((1 (f2cl-lib:int-add n
1)))
327 (coerce 0.0f0
'double-float
))
328 (setf nfe
(f2cl-lib:int-add nfe
1))
330 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8
332 (pcgqs n qr lenqr pivot pp yp rhovec dz
333 (f2cl-lib:array-slice work-%data%
345 (declare (ignore var-0 var-1 var-2 var-3 var-4 var-5 var-6
348 (if (> iflag
0) (go end_label
))
349 (daxpy np1 one dz
1 z0
1)
350 (setf xstep
(dnrm2 np1 dz
1))
352 ((<= xstep
(+ (* relerr
(dnrm2 np1 z0
1)) abserr
))
356 (setf failed f2cl-lib
:%true%
)
359 ((<= h
(* fouru
(+ 1.0f0 s
)))
363 (setf h
(* 0.5f0 h
))))
367 (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7 var-8 var-9
368 var-10 var-11 var-12 var-13 var-14
)
369 (tangqs z0 t$ yp a qr pivot pp rhovec work n lenqr iflag nfe par
371 (declare (ignore var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7
372 var-8 var-9 var-10 var-13 var-14
))
375 (if (> iflag
0) (go end_label
))
376 (setf alpha
(ddot np1 t$
1 yp
1))
377 (if (< alpha
0.5f0
) (go label150
))
378 (setf alpha
(acos alpha
))
382 (f2cl-lib:array-slice work-%data%
394 (f2cl-lib:array-slice work-%data%
406 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
409 (setf (f2cl-lib:fref work-%data%
411 (f2cl-lib:int-add pcgwk i
)
421 (f2cl-lib:fref yold-%data%
423 ((1 (f2cl-lib:int-add n
1)))
425 (f2cl-lib:fref ypold-%data%
427 ((1 (f2cl-lib:int-add n
1)))
429 (f2cl-lib:fref y-%data%
431 ((1 (f2cl-lib:int-add n
1)))
433 (f2cl-lib:fref yp-%data%
435 ((1 (f2cl-lib:int-add n
1)))
439 (daxpy np1
(- one
) z0
1
440 (f2cl-lib:array-slice work-%data%
445 (f2cl-lib:int-mul
8 (f2cl-lib:int-add n
1))
451 (f2cl-lib:array-slice work-%data%
463 (dcopy np1 y
1 yold
1)
465 (dcopy np1 yp
1 ypold
1)
466 (dcopy np1 t$
1 yp
1)
468 (daxpy np1
(- one
) yold
1 z0
1)
469 (setf hold
(dnrm2 np1 z0
1))
473 (setf theta
(coerce 8.0f0
'double-float
)))
475 (setf theta
(coerce 1.0f0
'double-float
)))
477 (setf omega
(/ xstep cordis
))
480 (setf lk
(f2cl-lib:int-sub
(f2cl-lib:int-mul
4 itcnt
) 7))
482 ((>= omega
(f2cl-lib:fref wrge
(lk) ((1 8))))
483 (setf theta
(coerce 1.0f0
'double-float
)))
485 (f2cl-lib:fref wrge
((f2cl-lib:int-add lk
1)) ((1 8))))
487 (+ (f2cl-lib:fref acof
(lk) ((1 12)))
490 ((f2cl-lib:int-add lk
1))
492 (f2cl-lib:flog omega
)))))
494 (f2cl-lib:fref wrge
((f2cl-lib:int-add lk
2)) ((1 8))))
498 ((f2cl-lib:int-add lk
2))
502 ((f2cl-lib:int-add lk
3))
504 (f2cl-lib:flog omega
)))))
506 (setf theta
(coerce 8.0f0
'double-float
)))))
508 (setf theta
(coerce 0.125f0
'double-float
)))
510 (setf lk
(f2cl-lib:int-sub
(f2cl-lib:int-mul
4 itcnt
) 16))
512 ((> omega
(f2cl-lib:fref wrge
(lk) ((1 8))))
513 (setf lst
(f2cl-lib:int-sub
(f2cl-lib:int-mul
2 itcnt
) 1))
515 (+ (f2cl-lib:fref acof
(lst) ((1 12)))
518 ((f2cl-lib:int-add lst
1))
520 (f2cl-lib:flog omega
)))))
522 (setf theta
(coerce 0.125f0
'double-float
))))))))
523 (setf idlerr
(* theta idlerr
))
524 (setf idlerr
(min (* 0.5f0 hold
) idlerr
))
526 (setf wk
(/ (* 2.0f0
(abs (sin (* 0.5f0 alpha
)))) hold
))
531 (setf gamma
(+ wk
(* (/ hold
(+ hold htemp
)) (- wk wkold
))))))
532 (setf gamma
(max gamma
(* 0.01f0 one
)))
533 (setf h
(f2cl-lib:fsqrt
(/ (* 2.0f0 idlerr
) gamma
)))
536 (max (f2cl-lib:fref sspar-%data%
(1) ((1 4)) sspar-%offset%
)
538 (f2cl-lib:fref sspar-%data%
544 (* (f2cl-lib:fref sspar-%data%
(4) ((1 4)) sspar-%offset%
)
546 (f2cl-lib:fref sspar-%data%
(2) ((1 4)) sspar-%offset%
)))
547 (if failed
(setf h
(min hfail h
)))
548 (setf start f2cl-lib
:%false%
)
581 (in-package #:cl-user
)
582 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
583 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
584 (setf (gethash 'fortran-to-lisp
::stepqs
585 fortran-to-lisp
::*f2cl-function-info
*)
586 (fortran-to-lisp::make-f2cl-finfo
587 :arg-types
'((fortran-to-lisp::integer4
) (fortran-to-lisp::integer4
)
588 (fortran-to-lisp::integer4
) (fortran-to-lisp::integer4
)
589 fortran-to-lisp
::logical fortran-to-lisp
::logical
590 (double-float) (double-float) (double-float)
591 (double-float) (double-float) (double-float)
592 (array double-float
(*)) (array double-float
(*))
593 (array double-float
(*)) (array double-float
(*))
594 (array double-float
(*)) (array double-float
(*))
595 (array fortran-to-lisp
::integer4
(*))
596 (array double-float
(*)) (array double-float
(*))
597 (array double-float
(*)) (array double-float
(*))
598 (array double-float
(*)) (array double-float
(*))
599 (array double-float
(*)) (array double-float
(*))
600 (array fortran-to-lisp
::integer4
(*)))
601 :return-values
'(nil fortran-to-lisp
::nfe fortran-to-lisp
::iflag nil
602 fortran-to-lisp
::start fortran-to-lisp
::crash
603 fortran-to-lisp
::hold fortran-to-lisp
::h
604 fortran-to-lisp
::wk fortran-to-lisp
::relerr
605 fortran-to-lisp
::abserr fortran-to-lisp
::s nil nil
606 nil nil nil nil nil nil nil nil nil nil nil nil nil
608 :calls
'(fortran-to-lisp::f fortran-to-lisp
::fjacs
609 fortran-to-lisp
::rhojs fortran-to-lisp
::ddot
610 fortran-to-lisp
::dscal fortran-to-lisp
::daxpy
611 fortran-to-lisp
::dcopy fortran-to-lisp
::dnrm2
612 fortran-to-lisp
::pcgqs fortran-to-lisp
::rho
613 fortran-to-lisp
::tangqs fortran-to-lisp
::d1mach
))))