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 ':simple-array)
14 ;;; (:array-slicing nil) (:declare-common nil)
15 ;;; (:float-format double-float))
22 (pi$
3.14159265358979)
23 (rthpi 1.2533141373155)
26 :element-type
'double-float
27 :initial-contents
'(0.577215664901533 -
0.0420026350340952
28 -
0.0421977345555443 0.007218943246663
29 -
2.152416741149e-4 -
2.01348547807e-5
30 1.133027232e-6 6.116095e-9))))
31 (declare (type (double-float) x1 x2 pi$ rthpi
)
32 (type (simple-array double-float
(8)) cc
))
33 (defun dbsknu (x fnu kode n y nz
)
34 (declare (type (simple-array double-float
(*)) y
)
35 (type (f2cl-lib:integer4
) nz n kode
)
36 (type (double-float) fnu x
))
37 (prog ((a (make-array 160 :element-type
'double-float
))
38 (b (make-array 160 :element-type
'double-float
)) (ak 0.0) (a1 0.0)
39 (a2 0.0) (bk 0.0) (ck 0.0) (coef 0.0) (cx 0.0) (dk 0.0) (dnu 0.0)
40 (dnu2 0.0) (elim 0.0) (etest 0.0) (ex 0.0) (f 0.0) (fc 0.0)
41 (fhs 0.0) (fk 0.0) (fks 0.0) (flrx 0.0) (fmu 0.0) (g1 0.0) (g2 0.0)
42 (p 0.0) (pt 0.0) (p1 0.0) (p2 0.0) (q 0.0) (rx 0.0) (s 0.0)
43 (smu 0.0) (sqk 0.0) (st 0.0) (s1 0.0) (s2 0.0) (tm 0.0) (tol 0.0)
44 (t1 0.0) (t2 0.0) (i 0) (iflag 0) (inu 0) (j 0) (k 0) (kk 0)
46 (declare (type (f2cl-lib:integer4
) nn koded kk k j inu iflag i
)
47 (type (double-float) t2 t1 tol tm s2 s1 st sqk smu s rx q p2 p1
48 pt p g2 g1 fmu flrx fks fk fhs fc f ex
49 etest elim dnu2 dnu dk cx coef ck bk a2 a1
51 (type (simple-array double-float
(160)) b a
))
52 (setf kk
(f2cl-lib:int-sub
(f2cl-lib:i1mach
15)))
53 (setf elim
(* 2.303 (- (* kk
(f2cl-lib:d1mach
5)) 3.0)))
54 (setf ak
(f2cl-lib:d1mach
3))
55 (setf tol
(max ak
1.0e-15))
56 (if (<= x
0.0) (go label350
))
57 (if (< fnu
0.0) (go label360
))
58 (if (or (< kode
1) (> kode
2)) (go label370
))
59 (if (< n
1) (go label380
))
64 (setf inu
(f2cl-lib:int
(+ fnu
0.5)))
65 (setf dnu
(- fnu inu
))
66 (if (= (abs dnu
) 0.5) (go label120
))
68 (if (< (abs dnu
) tol
) (go label10
))
69 (setf dnu2
(* dnu dnu
))
71 (if (> x x1
) (go label120
))
74 (setf t1
(/ 1.0 (dgamma a1
)))
75 (setf t2
(/ 1.0 (dgamma a2
)))
76 (if (> (abs dnu
) 0.1) (go label40
))
77 (setf s
(f2cl-lib:fref cc
(1) ((1 8))))
79 (f2cl-lib:fdo
(k 2 (f2cl-lib:int-add k
1))
83 (setf tm
(* (f2cl-lib:fref cc
(k) ((1 8))) ak
))
85 (if (< (abs tm
) tol
) (go label30
))
91 (setf g1
(/ (- t1 t2
) (+ dnu dnu
)))
93 (setf g2
(* (+ t1 t2
) 0.5))
96 (setf flrx
(f2cl-lib:flog rx
))
97 (setf fmu
(* dnu flrx
))
98 (if (= dnu
0.0) (go label60
))
100 (setf fc
(/ fc
(sin fc
)))
101 (if (/= fmu
0.0) (setf smu
(/ (sinh fmu
) fmu
)))
103 (setf f
(* fc
(+ (* g1
(cosh fmu
)) (* g2 flrx smu
))))
105 (setf p
(/ (* 0.5 fc
) t2
))
106 (setf q
(/ 0.5 (* fc t1
)))
112 (if (or (> inu
0) (> n
1)) (go label90
))
113 (if (< x tol
) (go label80
))
114 (setf cx
(* x x
0.25))
116 (setf f
(/ (+ (* ak f
) p q
) (- bk dnu2
)))
117 (setf p
(/ p
(- ak dnu
)))
118 (setf q
(/ q
(+ ak dnu
)))
119 (setf ck
(/ (* ck cx
) ak
))
122 (setf bk
(+ bk ak ak
1.0))
124 (setf s
(/ (abs t1
) (+ 1.0 (abs s1
))))
125 (if (> s tol
) (go label70
))
127 (setf (f2cl-lib:fref y
(1) ((1 *))) s1
)
128 (if (= koded
1) (go end_label
))
129 (setf (f2cl-lib:fref y
(1) ((1 *))) (* s1
(exp x
)))
132 (if (< x tol
) (go label110
))
133 (setf cx
(* x x
0.25))
135 (setf f
(/ (+ (* ak f
) p q
) (- bk dnu2
)))
136 (setf p
(/ p
(- ak dnu
)))
137 (setf q
(/ q
(+ ak dnu
)))
138 (setf ck
(/ (* ck cx
) ak
))
141 (setf t2
(* ck
(- p
(* ak f
))))
143 (setf bk
(+ bk ak ak
1.0))
145 (setf s
(+ (/ (abs t1
) (+ 1.0 (abs s1
))) (/ (abs t2
) (+ 1.0 (abs s2
)))))
146 (if (> s tol
) (go label100
))
149 (if (= koded
1) (go label170
))
155 (setf coef
(/ rthpi
(f2cl-lib:fsqrt x
)))
156 (if (= koded
2) (go label130
))
157 (if (> x elim
) (go label330
))
158 (setf coef
(* coef
(exp (- x
))))
160 (if (= (abs dnu
) 0.5) (go label340
))
161 (if (> x x2
) (go label280
))
162 (setf etest
(/ (cos (* pi$ dnu
)) (* pi$ x tol
)))
166 (setf ck
(+ x x
2.0))
171 (setf k
(f2cl-lib:int-add k
1))
173 (setf ak
(/ (- fhs dnu2
) (+ fks fk
)))
174 (setf bk
(/ ck
(+ fk
1.0)))
176 (setf p2
(- (* bk p2
) (* ak p1
)))
178 (setf (f2cl-lib:fref a
(k) ((1 160))) ak
)
179 (setf (f2cl-lib:fref b
(k) ((1 160))) bk
)
181 (setf fks
(+ fks fk fk
1.0))
182 (setf fhs
(+ fhs fk fk
))
183 (if (> etest
(* fk p1
)) (go label140
))
188 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
193 (/ (- (* (f2cl-lib:fref b
(kk) ((1 160))) p2
) p1
)
194 (f2cl-lib:fref a
(kk) ((1 160)))))
197 (setf kk
(f2cl-lib:int-sub kk
1))
199 (setf s1
(* coef
(/ p2 s
)))
200 (if (or (> inu
0) (> n
1)) (go label160
))
203 (setf s2
(/ (* s1
(+ x dnu
0.5 (/ (- p1
) p2
))) x
))
205 (setf ck
(/ (+ dnu dnu
2.0) x
))
206 (if (= n
1) (setf inu
(f2cl-lib:int-sub inu
1)))
207 (if (> inu
0) (go label180
))
208 (if (> n
1) (go label200
))
212 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
216 (setf s2
(+ (* ck s2
) s1
))
220 (if (= n
1) (setf s1 s2
))
222 (if (= iflag
1) (go label220
))
223 (setf (f2cl-lib:fref y
(1) ((1 *))) s1
)
224 (if (= n
1) (go end_label
))
225 (setf (f2cl-lib:fref y
(2) ((1 *))) s2
)
226 (if (= n
2) (go end_label
))
227 (f2cl-lib:fdo
(i 3 (f2cl-lib:int-add i
1))
230 (setf (f2cl-lib:fref y
(i) ((1 *)))
231 (+ (* ck
(f2cl-lib:fref y
((f2cl-lib:int-sub i
1)) ((1 *))))
232 (f2cl-lib:fref y
((f2cl-lib:int-sub i
2)) ((1 *)))))
237 (setf s
(- (f2cl-lib:flog s1
) x
))
238 (setf (f2cl-lib:fref y
(1) ((1 *))) 0.0)
240 (if (< s
(- elim
)) (go label230
))
241 (setf (f2cl-lib:fref y
(1) ((1 *))) (exp s
))
244 (if (= n
1) (go end_label
))
245 (setf s
(- (f2cl-lib:flog s2
) x
))
246 (setf (f2cl-lib:fref y
(2) ((1 *))) 0.0)
247 (setf nz
(f2cl-lib:int-add nz
1))
248 (if (< s
(- elim
)) (go label240
))
249 (setf nz
(f2cl-lib:int-sub nz
1))
250 (setf (f2cl-lib:fref y
(2) ((1 *))) (exp s
))
252 (if (= n
2) (go end_label
))
254 (if (< nz
2) (go label260
))
255 (f2cl-lib:fdo
(i 3 (f2cl-lib:int-add i
1))
260 (setf s2
(+ (* ck s2
) s1
))
263 (setf s
(- (f2cl-lib:flog s2
) x
))
264 (setf nz
(f2cl-lib:int-add nz
1))
265 (setf (f2cl-lib:fref y
(i) ((1 *))) 0.0)
266 (if (< s
(- elim
)) (go label250
))
267 (setf (f2cl-lib:fref y
(i) ((1 *))) (exp s
))
268 (setf nz
(f2cl-lib:int-sub nz
1))
273 (if (= kk n
) (go end_label
))
274 (setf s2
(+ (* s2 ck
) s1
))
276 (setf kk
(f2cl-lib:int-add kk
1))
277 (setf (f2cl-lib:fref y
(kk) ((1 *))) (exp (- (f2cl-lib:flog s2
) x
)))
278 (if (= kk n
) (go end_label
))
279 (setf kk
(f2cl-lib:int-add kk
1))
280 (f2cl-lib:fdo
(i kk
(f2cl-lib:int-add i
1))
283 (setf (f2cl-lib:fref y
(i) ((1 *)))
284 (+ (* ck
(f2cl-lib:fref y
((f2cl-lib:int-sub i
1)) ((1 *))))
285 (f2cl-lib:fref y
((f2cl-lib:int-sub i
2)) ((1 *)))))
291 (if (and (= inu
0) (= n
1)) (setf nn
1))
292 (setf dnu2
(+ dnu dnu
))
294 (if (< (abs dnu2
) tol
) (go label290
))
295 (setf fmu
(* dnu2 dnu2
))
299 (f2cl-lib:fdo
(k 1 (f2cl-lib:int-add k
1))
308 (f2cl-lib:fdo
(j 1 (f2cl-lib:int-add j
1))
311 (setf ck
(/ (* ck
(- fmu sqk
)) dk
))
315 (setf sqk
(+ sqk ak
))
316 (if (< (abs ck
) tol
) (go label310
))
320 (setf fmu
(+ fmu
(* 8.0 dnu
) 4.0))
322 (if (> nn
1) (go label170
))
334 (xermsg "SLATEC" "DBSKNU" "X NOT GREATER THAN ZERO" 2 1)
337 (xermsg "SLATEC" "DBSKNU" "FNU NOT ZERO OR POSITIVE" 2 1)
340 (xermsg "SLATEC" "DBSKNU" "KODE NOT 1 OR 2" 2 1)
343 (xermsg "SLATEC" "DBSKNU" "N NOT GREATER THAN 0" 2 1)
346 (return (values nil nil nil nil nil nz
)))))
348 (in-package #:cl-user
)
349 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
350 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
351 (setf (gethash 'fortran-to-lisp
::dbsknu
352 fortran-to-lisp
::*f2cl-function-info
*)
353 (fortran-to-lisp::make-f2cl-finfo
354 :arg-types
'((double-float) (double-float)
355 (fortran-to-lisp::integer4
) (fortran-to-lisp::integer4
)
356 (simple-array double-float
(*))
357 (fortran-to-lisp::integer4
))
358 :return-values
'(nil nil nil nil nil fortran-to-lisp
::nz
)
359 :calls
'(fortran-to-lisp::xermsg fortran-to-lisp
::dgamma
360 fortran-to-lisp
::d1mach fortran-to-lisp
::i1mach
))))