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 ':array)
14 ;;; (:array-slicing t) (:declare-common nil)
15 ;;; (:float-format double-float))
20 (let ((rttpi 0.398942280401433) (inlim 80))
21 (declare (type (double-float) rttpi
) (type (f2cl-lib:integer4
) inlim
))
22 (defun dbesi (x alpha kode n y nz
)
23 (declare (type (array double-float
(*)) y
)
24 (type (f2cl-lib:integer4
) nz n kode
)
25 (type (double-float) alpha x
))
26 (f2cl-lib:with-multi-array-data
27 ((y double-float y-%data% y-%offset%
))
28 (prog ((temp (make-array 3 :element-type
'double-float
)) (ain 0.0)
29 (ak 0.0) (akm 0.0) (ans 0.0) (ap 0.0) (arg 0.0) (atol 0.0)
30 (tolln 0.0) (dfn 0.0) (dtm 0.0) (dx 0.0) (earg 0.0) (elim 0.0)
31 (etx 0.0) (flgik 0.0) (fn 0.0) (fnf 0.0) (fni 0.0) (fnp1 0.0)
32 (fnu 0.0) (gln 0.0) (ra 0.0) (s 0.0) (sx 0.0) (sxo2 0.0) (s1 0.0)
33 (s2 0.0) (t$
0.0) (ta 0.0) (tb 0.0) (tfn 0.0) (tm 0.0) (tol 0.0)
34 (trx 0.0) (t2 0.0) (xo2 0.0) (xo2l 0.0) (z 0.0) (i 0) (ialp 0)
35 (in 0) (is 0) (i1 0) (k 0) (kk 0) (km 0) (kt 0) (nn 0) (ns 0))
36 (declare (type (f2cl-lib:integer4
) ns nn kt km kk k i1 is in ialp i
)
37 (type (array double-float
(3)) temp
)
38 (type (double-float) z xo2l xo2 t2 trx tol tm tfn tb ta t$ s2
39 s1 sxo2 sx s ra gln fnu fnp1 fni fnf fn
40 flgik etx elim earg dx dtm dfn tolln atol
41 arg ap ans akm ak ain
))
44 (setf ra
(f2cl-lib:d1mach
3))
45 (setf tol
(max ra
1.0e-15))
46 (setf i1
(f2cl-lib:int-sub
(f2cl-lib:i1mach
15)))
47 (setf gln
(f2cl-lib:d1mach
5))
48 (setf elim
(* 2.303 (- (* i1 gln
) 3.0)))
49 (setf i1
(f2cl-lib:int-add
(f2cl-lib:i1mach
14) 1))
50 (setf tolln
(* 2.303 gln i1
))
51 (setf tolln
(min tolln
34.5388))
52 (f2cl-lib:arithmetic-if
(f2cl-lib:int-sub n
1)
60 (if (or (< kode
1) (> kode
2)) (go label570
))
61 (f2cl-lib:arithmetic-if x
(go label600
) (go label30
) (go label80
))
63 (f2cl-lib:arithmetic-if alpha
(go label580
) (go label40
) (go label50
))
65 (setf (f2cl-lib:fref y-%data%
(1) ((1 *)) y-%offset%
) 1.0)
66 (if (= n
1) (go end_label
))
72 (f2cl-lib:fdo
(i i1
(f2cl-lib:int-add i
1))
75 (setf (f2cl-lib:fref y-%data%
(i) ((1 *)) y-%offset%
) 0.0)
79 (if (< alpha
0.0) (go label580
))
80 (setf ialp
(f2cl-lib:int alpha
))
83 (the f2cl-lib
:integer4
84 (f2cl-lib:int-sub
(f2cl-lib:int-add ialp n
) 1))
86 (setf fnf
(- alpha ialp
))
87 (setf dfn
(+ fni fnf
))
91 (setf sxo2
(* xo2 xo2
))
93 (coerce (the f2cl-lib
:integer4
(f2cl-lib:int-sub kode
1))
96 (if (<= sxo2
(+ fnu
1.0)) (go label90
))
97 (if (<= x
12.0) (go label110
))
98 (setf fn
(* 0.55 fnu fnu
))
99 (setf fn
(max 17.0 fn
))
100 (if (>= x fn
) (go label430
))
101 (setf ans
(max (- 36.0 fnu
) 0.0))
102 (setf ns
(f2cl-lib:int ans
))
103 (setf fni
(+ fni ns
))
104 (setf dfn
(+ fni fnf
))
107 (setf km
(f2cl-lib:int-add
(f2cl-lib:int-sub n
1) ns
))
108 (if (> km
0) (setf is
3))
112 (setf fnp1
(+ fn
1.0))
113 (setf xo2l
(f2cl-lib:flog xo2
))
115 (if (<= x
0.5) (go label230
))
118 (setf fni
(+ fni ns
))
119 (setf dfn
(+ fni fnf
))
121 (setf fnp1
(+ fn
1.0))
123 (if (> (f2cl-lib:int-add
(f2cl-lib:int-sub n
1) ns
) 0) (setf is
3))
126 (setf xo2l
(f2cl-lib:flog xo2
))
127 (setf ns
(f2cl-lib:int
(- sxo2 fnu
)))
130 (if (= kode
2) (go label130
))
131 (if (< alpha
1.0) (go label150
))
133 (setf ra
(f2cl-lib:fsqrt
(+ 1.0 (* z z
))))
134 (setf gln
(f2cl-lib:flog
(/ (+ 1.0 ra
) z
)))
135 (setf t$
(+ (* ra
(- 1.0 etx
)) (/ etx
(+ z ra
))))
136 (setf arg
(* alpha
(- t$ gln
)))
137 (if (> arg elim
) (go label610
))
138 (if (= km
0) (go label140
))
141 (setf ra
(f2cl-lib:fsqrt
(+ 1.0 (* z z
))))
142 (setf gln
(f2cl-lib:flog
(/ (+ 1.0 ra
) z
)))
143 (setf t$
(+ (* ra
(- 1.0 etx
)) (/ etx
(+ z ra
))))
144 (setf arg
(* fn
(- t$ gln
)))
146 (if (< arg
(- elim
)) (go label280
))
149 (if (> x elim
) (go label610
))
152 (if (/= km
0) (go label170
))
153 (setf (f2cl-lib:fref y-%data%
(1) ((1 *)) y-%offset%
)
154 (f2cl-lib:fref temp
(3) ((1 3))))
157 (setf (f2cl-lib:fref temp
(1) ((1 3)))
158 (f2cl-lib:fref temp
(3) ((1 3))))
164 (setf fni
(- fni
1.0))
165 (setf dfn
(+ fni fnf
))
167 (if (= i1
2) (go label350
))
169 (setf ra
(f2cl-lib:fsqrt
(+ 1.0 (* z z
))))
170 (setf gln
(f2cl-lib:flog
(/ (+ 1.0 ra
) z
)))
171 (setf t$
(+ (* ra
(- 1.0 etx
)) (/ etx
(+ z ra
))))
172 (setf arg
(* fn
(- t$ gln
)))
174 (setf i1
(abs (f2cl-lib:int-sub
3 is
)))
175 (setf i1
(max (the f2cl-lib
:integer4 i1
) (the f2cl-lib
:integer4
1)))
177 (multiple-value-bind (var-0 var-1 var-2 var-3 var-4 var-5 var-6 var-7
)
178 (dasyik x fn kode flgik ra arg i1
179 (f2cl-lib:array-slice temp double-float
(is) ((1 3))))
180 (declare (ignore var-0 var-1 var-2 var-3 var-6 var-7
))
183 (f2cl-lib:computed-goto
(label180 label350 label510
) is
)
185 (setf gln
(dlngam fnp1
))
186 (setf arg
(- (* fn xo2l
) gln sx
))
187 (if (< arg
(- elim
)) (go label300
))
188 (setf earg
(exp arg
))
191 (if (< x tol
) (go label260
))
196 (f2cl-lib:fdo
(k 1 (f2cl-lib:int-add k
1))
200 (setf t$
(/ (* t$ sxo2
) s2
))
202 (if (< (abs t$
) tol
) (go label260
))
208 (setf (f2cl-lib:fref temp
(is) ((1 3))) (* s earg
))
209 (f2cl-lib:computed-goto
(label270 label350 label500
) is
)
211 (setf earg
(/ (* earg fn
) xo2
))
212 (setf fni
(- fni
1.0))
213 (setf dfn
(+ fni fnf
))
218 (setf (f2cl-lib:fref y-%data%
(nn) ((1 *)) y-%offset%
) 0.0)
219 (setf nn
(f2cl-lib:int-sub nn
1))
220 (setf fni
(- fni
1.0))
221 (setf dfn
(+ fni fnf
))
223 (f2cl-lib:arithmetic-if
(f2cl-lib:int-sub nn
1)
232 (setf (f2cl-lib:fref y-%data%
(nn) ((1 *)) y-%offset%
) 0.0)
233 (setf nn
(f2cl-lib:int-sub nn
1))
235 (setf fni
(- fni
1.0))
236 (setf dfn
(+ fni fnf
))
238 (f2cl-lib:arithmetic-if
(f2cl-lib:int-sub nn
1)
246 (if (<= sxo2 fnp1
) (go label330
))
249 (setf arg
(+ (- arg xo2l
) (f2cl-lib:flog fnp1
)))
250 (if (< arg
(- elim
)) (go label300
))
253 (setf nz
(f2cl-lib:int-sub n nn
))
256 (setf nz
(f2cl-lib:int-sub n nn
))
258 (if (= kt
2) (go label420
))
259 (setf s1
(f2cl-lib:fref temp
(1) ((1 3))))
260 (setf s2
(f2cl-lib:fref temp
(2) ((1 3))))
263 (setf tm
(* (+ dtm fnf
) trx
))
264 (if (= in
0) (go label390
))
265 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
269 (setf s2
(+ (* tm s2
) s1
))
271 (setf dtm
(- dtm
1.0))
272 (setf tm
(* (+ dtm fnf
) trx
))
274 (setf (f2cl-lib:fref y-%data%
(nn) ((1 *)) y-%offset%
) s1
)
275 (if (= nn
1) (go end_label
))
276 (setf (f2cl-lib:fref y-%data%
277 ((f2cl-lib:int-sub nn
1))
281 (if (= nn
2) (go end_label
))
284 (setf (f2cl-lib:fref y-%data%
(nn) ((1 *)) y-%offset%
) s1
)
285 (setf (f2cl-lib:fref y-%data%
286 ((f2cl-lib:int-sub nn
1))
290 (if (= nn
2) (go end_label
))
292 (setf k
(f2cl-lib:int-add nn
1))
293 (f2cl-lib:fdo
(i 3 (f2cl-lib:int-add i
1))
296 (setf k
(f2cl-lib:int-sub k
1))
297 (setf (f2cl-lib:fref y-%data%
298 ((f2cl-lib:int-sub k
2))
303 (f2cl-lib:fref y-%data%
304 ((f2cl-lib:int-sub k
1))
307 (f2cl-lib:fref y-%data%
(k) ((1 *)) y-%offset%
)))
308 (setf dtm
(- dtm
1.0))
309 (setf tm
(* (+ dtm fnf
) trx
))
313 (setf (f2cl-lib:fref y-%data%
(1) ((1 *)) y-%offset%
)
314 (f2cl-lib:fref temp
(2) ((1 3))))
317 (setf earg
(/ rttpi
(f2cl-lib:fsqrt x
)))
318 (if (= kode
2) (go label440
))
319 (if (> x elim
) (go label610
))
320 (setf earg
(* earg
(exp x
)))
327 (setf dx
(+ fni fni
))
329 (if (and (= fni
0.0) (< (abs fnf
) tol
)) (go label460
))
330 (setf tm
(* 4.0 fnf
(+ fni fni fnf
)))
334 (setf trx
(- dtm
1.0))
335 (setf dx
(/ (- (+ trx tm
)) etx
))
338 (setf atol
(* tol
(abs s
)))
341 (f2cl-lib:fdo
(k 1 (f2cl-lib:int-add k
1))
348 (setf t$
(/ (* (- t$
) ap
) s1
))
350 (if (<= (abs t$
) atol
) (go label480
))
354 (setf (f2cl-lib:fref temp
(is) ((1 3))) (* s earg
))
355 (if (= is
2) (go label360
))
357 (setf fni
(- fni
1.0))
358 (setf dfn
(+ fni fnf
))
362 (setf akm
(max (- 3.0 fn
) 0.0))
363 (setf km
(f2cl-lib:int akm
))
366 (/ (+ (- (+ gln tfn
) 0.9189385332) (/ -
0.0833333333 tfn
))
368 (setf ta
(- xo2l ta
))
369 (setf tb
(/ (- (+ 1.0 (/ (* -
1 1.0) tfn
))) tfn
))
371 (+ (/ tolln
(- (f2cl-lib:fsqrt
(- (* ta ta
) (* tolln tb
))) ta
))
373 (setf in
(f2cl-lib:int ain
))
374 (setf in
(f2cl-lib:int-add in km
))
377 (setf t$
(/ 1.0 (* fn ra
)))
381 (+ gln
(f2cl-lib:fsqrt
(+ (* gln gln
) (* t$ tolln
)))))
383 (setf in
(f2cl-lib:int ain
))
384 (if (> in inlim
) (go label160
))
387 (setf dtm
(+ fni in
))
388 (setf tm
(* (+ dtm fnf
) trx
))
393 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
397 (setf tb
(+ (* tm tb
) ta
))
399 (setf dtm
(- dtm
1.0))
400 (setf tm
(* (+ dtm fnf
) trx
))
402 (if (/= kk
1) (go label550
))
403 (setf ta
(* (/ ta tb
) (f2cl-lib:fref temp
(3) ((1 3)))))
404 (setf tb
(f2cl-lib:fref temp
(3) ((1 3))))
407 (if (/= ns
0) (go label530
))
409 (setf (f2cl-lib:fref y-%data%
(nn) ((1 *)) y-%offset%
) tb
)
410 (setf nz
(f2cl-lib:int-sub n nn
))
411 (if (= nn
1) (go end_label
))
412 (setf tb
(+ (* tm tb
) ta
))
413 (setf k
(f2cl-lib:int-sub nn
1))
414 (setf (f2cl-lib:fref y-%data%
(k) ((1 *)) y-%offset%
) tb
)
415 (if (= nn
2) (go end_label
))
416 (setf dtm
(- dtm
1.0))
417 (setf tm
(* (+ dtm fnf
) trx
))
418 (setf km
(f2cl-lib:int-sub k
1))
419 (f2cl-lib:fdo
(i 1 (f2cl-lib:int-add i
1))
422 (setf (f2cl-lib:fref y-%data%
423 ((f2cl-lib:int-sub k
1))
426 (+ (* tm
(f2cl-lib:fref y-%data%
(k) ((1 *)) y-%offset%
))
427 (f2cl-lib:fref y-%data%
428 ((f2cl-lib:int-add k
1))
431 (setf dtm
(- dtm
1.0))
432 (setf tm
(* (+ dtm fnf
) trx
))
433 (setf k
(f2cl-lib:int-sub k
1))
437 (xermsg "SLATEC" "DBESI" "SCALING OPTION, KODE, NOT 1 OR 2." 2 1)
440 (xermsg "SLATEC" "DBESI" "ORDER, ALPHA, LESS THAN ZERO." 2 1)
443 (xermsg "SLATEC" "DBESI" "N LESS THAN ONE." 2 1)
446 (xermsg "SLATEC" "DBESI" "X LESS THAN ZERO." 2 1)
449 (xermsg "SLATEC" "DBESI" "OVERFLOW, X TOO LARGE FOR KODE = 1." 6 1)
452 (return (values nil nil nil nil nil nz
))))))
454 (in-package #:cl-user
)
455 #+#.
(cl:if
(cl:find-package
'#:f2cl
) '(and) '(or))
456 (eval-when (:load-toplevel
:compile-toplevel
:execute
)
457 (setf (gethash 'fortran-to-lisp
::dbesi fortran-to-lisp
::*f2cl-function-info
*)
458 (fortran-to-lisp::make-f2cl-finfo
459 :arg-types
'((double-float) (double-float)
460 (fortran-to-lisp::integer4
) (fortran-to-lisp::integer4
)
461 (array double-float
(*)) (fortran-to-lisp::integer4
))
462 :return-values
'(nil nil nil nil nil fortran-to-lisp
::nz
)
463 :calls
'(fortran-to-lisp::xermsg fortran-to-lisp
::dlngam
464 fortran-to-lisp
::dasyik fortran-to-lisp
::i1mach
465 fortran-to-lisp
::d1mach
))))