Fix possible lisp error when translating entier
[maxima.git] / share / hompack / lisp / sclgnp.lisp
blob6f71a53bebd586fb6ef082d0eaa1d889d4160de7
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)
11 ;;;
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")
20 (let ((dum 0.0)
21 (lmfpn 0.0)
22 (ntur 0.0)
23 (rtol 0.0)
24 (sum 0.0)
25 (i 0)
26 (iflag 0)
27 (f2cl-lib:index 0)
28 (irmax 0)
29 (j 0)
30 (jj 0)
31 (k 0)
32 (lenr 0)
33 (n2 0)
34 (s 0))
35 (declare (type (double-float) dum lmfpn ntur rtol sum)
36 (type (f2cl-lib:integer4) i iflag f2cl-lib:index irmax j jj k lenr
37 n2 s))
38 (defun sclgnp
39 (n nn mmaxt numt deg mode eps0 coef nnumt ddeg ccoef alpha beta rwork
40 xwork facv face coescl ierr)
41 (declare (type (array double-float (*)) coescl face facv xwork rwork beta
42 alpha ccoef coef)
43 (type (double-float) eps0)
44 (type (array f2cl-lib:integer4 (*)) ddeg nnumt deg numt)
45 (type (f2cl-lib:integer4) ierr mode mmaxt nn n))
46 (f2cl-lib:with-multi-array-data
47 ((numt f2cl-lib:integer4 numt-%data% numt-%offset%)
48 (deg f2cl-lib:integer4 deg-%data% deg-%offset%)
49 (nnumt f2cl-lib:integer4 nnumt-%data% nnumt-%offset%)
50 (ddeg f2cl-lib:integer4 ddeg-%data% ddeg-%offset%)
51 (coef double-float coef-%data% coef-%offset%)
52 (ccoef double-float ccoef-%data% ccoef-%offset%)
53 (alpha double-float alpha-%data% alpha-%offset%)
54 (beta double-float beta-%data% beta-%offset%)
55 (rwork double-float rwork-%data% rwork-%offset%)
56 (xwork double-float xwork-%data% xwork-%offset%)
57 (facv double-float facv-%data% facv-%offset%)
58 (face double-float face-%data% face-%offset%)
59 (coescl double-float coescl-%data% coescl-%offset%))
60 (prog ()
61 (declare)
62 (setf ierr 0)
63 (setf n2 (f2cl-lib:int-mul 2 n))
64 (setf lmfpn (f2cl-lib:d1mach 2))
65 (setf ntur (* (f2cl-lib:d1mach 4) n))
66 (setf lenr (the f2cl-lib:integer4 (truncate (* n (+ n 1)) 2)))
67 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
68 ((> i n) nil)
69 (tagbody
70 (setf jj 0)
71 (setf (f2cl-lib:fref nnumt-%data% (i) ((1 n)) nnumt-%offset%) 0)
72 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
73 ((> j (f2cl-lib:fref numt (i) ((1 nn)))) nil)
74 (tagbody
75 (cond
76 ((> (abs (f2cl-lib:fref coef (i j) ((1 nn) (1 mmaxt)))) eps0)
77 (setf jj (f2cl-lib:int-add jj 1))
78 (setf (f2cl-lib:fref nnumt-%data%
79 (i)
80 ((1 n))
81 nnumt-%offset%)
82 (f2cl-lib:int-add
83 (f2cl-lib:fref nnumt-%data%
84 (i)
85 ((1 n))
86 nnumt-%offset%)
87 1))
88 (setf (f2cl-lib:fref ccoef-%data%
89 (i jj)
90 ((1 n) (1 mmaxt))
91 ccoef-%offset%)
92 (f2cl-lib:fref coef-%data%
93 (i j)
94 ((1 nn) (1 mmaxt))
95 coef-%offset%))
96 (f2cl-lib:fdo (k 1 (f2cl-lib:int-add k 1))
97 ((> k n) nil)
98 (tagbody
99 (setf (f2cl-lib:fref ddeg-%data%
100 (i k jj)
101 ((1 n) (1 (f2cl-lib:int-add n 1))
102 (1 mmaxt))
103 ddeg-%offset%)
104 (f2cl-lib:fref deg-%data%
105 (i k j)
106 ((1 nn)
107 (1 (f2cl-lib:int-add nn 1))
108 (1 mmaxt))
109 deg-%offset%))
110 label20))))
111 label40))
112 label60))
113 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
114 ((> i n) nil)
115 (tagbody
116 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
117 ((> j (f2cl-lib:fref nnumt (i) ((1 n)))) nil)
118 (tagbody
119 (setf (f2cl-lib:fref coescl-%data%
120 (i j)
121 ((1 n) (1 mmaxt))
122 coescl-%offset%)
123 (f2cl-lib:log10
124 (abs
125 (f2cl-lib:fref ccoef-%data%
126 (i j)
127 ((1 n) (1 mmaxt))
128 ccoef-%offset%))))
129 label80))
130 label90))
131 (cond
132 ((= mode 0)
133 (tagbody
134 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
135 ((> s n) nil)
136 (tagbody
137 (f2cl-lib:fdo (k 1 (f2cl-lib:int-add k 1))
138 ((> k n) nil)
139 (tagbody
140 (setf (f2cl-lib:fref alpha-%data%
141 (s k)
142 ((1 (f2cl-lib:int-mul 2 n))
143 (1 (f2cl-lib:int-mul 2 n)))
144 alpha-%offset%)
145 (coerce (the f2cl-lib:integer4 0) 'double-float))
146 label110))))
147 label110
148 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
149 ((> s n) nil)
150 (tagbody
151 (setf (f2cl-lib:fref alpha-%data%
152 (s s)
153 ((1 (f2cl-lib:int-mul 2 n))
154 (1 (f2cl-lib:int-mul 2 n)))
155 alpha-%offset%)
156 (coerce
157 (the f2cl-lib:integer4
158 (f2cl-lib:fref nnumt-%data%
160 ((1 n))
161 nnumt-%offset%))
162 'double-float))
163 label200))
164 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
165 ((> s n) nil)
166 (tagbody
167 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
168 ((> i n) nil)
169 (tagbody
170 (setf sum
171 (coerce (the f2cl-lib:integer4 0) 'double-float))
172 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
173 ((> j (f2cl-lib:fref nnumt (i) ((1 n)))) nil)
174 (tagbody
175 (setf sum
176 (+ sum
177 (f2cl-lib:fref ddeg-%data%
178 (i s j)
179 ((1 n)
180 (1 (f2cl-lib:int-add n 1))
181 (1 mmaxt))
182 ddeg-%offset%)))
183 label220))
184 (setf (f2cl-lib:fref alpha-%data%
185 ((f2cl-lib:int-add n s) i)
186 ((1 (f2cl-lib:int-mul 2 n))
187 (1 (f2cl-lib:int-mul 2 n)))
188 alpha-%offset%)
189 sum)
190 label300))))
191 label300
192 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
193 ((> s n) nil)
194 (tagbody
195 (f2cl-lib:fdo (k 1 (f2cl-lib:int-add k 1))
196 ((> k n) nil)
197 (tagbody
198 (setf sum
199 (coerce (the f2cl-lib:integer4 0) 'double-float))
200 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
201 ((> i n) nil)
202 (tagbody
203 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
204 ((> j (f2cl-lib:fref nnumt (i) ((1 n))))
205 nil)
206 (tagbody
207 (setf sum
208 (+ sum
209 (f2cl-lib:int-mul
210 (f2cl-lib:fref ddeg-%data%
211 (i s j)
212 ((1 n)
214 (f2cl-lib:int-add n
216 (1 mmaxt))
217 ddeg-%offset%)
218 (f2cl-lib:fref ddeg-%data%
219 (i k j)
220 ((1 n)
222 (f2cl-lib:int-add n
224 (1 mmaxt))
225 ddeg-%offset%))))
226 label310))
227 label320))
228 (setf (f2cl-lib:fref alpha-%data%
229 ((f2cl-lib:int-add n s)
230 (f2cl-lib:int-add n k))
231 ((1 (f2cl-lib:int-mul 2 n))
232 (1 (f2cl-lib:int-mul 2 n)))
233 alpha-%offset%)
234 sum)
235 label330))
236 label400))
237 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
238 ((> s n) nil)
239 (tagbody
240 (f2cl-lib:fdo (k 1 (f2cl-lib:int-add k 1))
241 ((> k n) nil)
242 (tagbody
243 (setf sum
244 (coerce (the f2cl-lib:integer4 0) 'double-float))
245 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
246 ((> j (f2cl-lib:fref nnumt (s) ((1 n)))) nil)
247 (tagbody
248 (setf sum
249 (+ sum
250 (f2cl-lib:fref ddeg-%data%
251 (s k j)
252 ((1 n)
253 (1 (f2cl-lib:int-add n 1))
254 (1 mmaxt))
255 ddeg-%offset%)))
256 label420))
257 (setf (f2cl-lib:fref alpha-%data%
258 (s (f2cl-lib:int-add n k))
259 ((1 (f2cl-lib:int-mul 2 n))
260 (1 (f2cl-lib:int-mul 2 n)))
261 alpha-%offset%)
262 sum)
263 label500))))
264 label500
265 (multiple-value-bind (var-0 var-1 var-2 var-3)
266 (qrfaqf alpha rwork (f2cl-lib:int-mul 2 n) iflag)
267 (declare (ignore var-0 var-1 var-2))
268 (setf iflag var-3))
269 (setf irmax (idamax lenr rwork 1))
270 (setf rtol
272 (f2cl-lib:fref rwork-%data%
273 (irmax)
275 (f2cl-lib:int-mul n
276 (f2cl-lib:int-add
277 (f2cl-lib:int-mul 2
279 1))))
280 rwork-%offset%)
281 ntur))
282 (setf f2cl-lib:index 1)
283 (f2cl-lib:fdo (i n (f2cl-lib:int-add i (f2cl-lib:int-sub 1)))
284 ((> i 2) nil)
285 (tagbody
286 (cond
288 (abs
289 (f2cl-lib:fref rwork
290 (f2cl-lib:index)
292 (f2cl-lib:int-mul n
293 (f2cl-lib:int-add
294 (f2cl-lib:int-mul 2
296 1))))))
297 rtol)
298 (setf (f2cl-lib:fref rwork-%data%
299 (f2cl-lib:index)
301 (f2cl-lib:int-mul n
302 (f2cl-lib:int-add
303 (f2cl-lib:int-mul
306 1))))
307 rwork-%offset%)
308 lmfpn)
309 (setf ierr 1)))
310 (setf f2cl-lib:index (f2cl-lib:int-add f2cl-lib:index i))
311 label510))
312 (cond
314 (abs
315 (f2cl-lib:fref rwork
316 (f2cl-lib:index)
318 (f2cl-lib:int-mul n
319 (f2cl-lib:int-add
320 (f2cl-lib:int-mul 2 n)
321 1))))))
322 rtol)
323 (setf (f2cl-lib:fref rwork-%data%
324 (f2cl-lib:index)
326 (f2cl-lib:int-mul n
327 (f2cl-lib:int-add
328 (f2cl-lib:int-mul 2
330 1))))
331 rwork-%offset%)
332 lmfpn)
333 (setf ierr 1))))))
334 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
335 ((> s n) nil)
336 (tagbody
337 (setf sum (coerce (the f2cl-lib:integer4 0) 'double-float))
338 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
339 ((> j (f2cl-lib:fref nnumt (s) ((1 n)))) nil)
340 (tagbody
341 (setf sum
342 (+ sum
343 (f2cl-lib:fref coescl-%data%
344 (s j)
345 ((1 n) (1 mmaxt))
346 coescl-%offset%)))
347 label550))
348 (setf (f2cl-lib:fref beta-%data%
350 ((1 (f2cl-lib:int-mul 2 n)))
351 beta-%offset%)
352 (- sum))
353 label600))
354 (f2cl-lib:fdo (s 1 (f2cl-lib:int-add s 1))
355 ((> s n) nil)
356 (tagbody
357 (setf sum (coerce (the f2cl-lib:integer4 0) 'double-float))
358 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
359 ((> i n) nil)
360 (tagbody
361 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
362 ((> j (f2cl-lib:fref nnumt (i) ((1 n)))) nil)
363 (tagbody
364 (setf sum
365 (+ sum
367 (f2cl-lib:fref coescl-%data%
368 (i j)
369 ((1 n) (1 mmaxt))
370 coescl-%offset%)
371 (f2cl-lib:fref ddeg-%data%
372 (i s j)
373 ((1 n)
374 (1 (f2cl-lib:int-add n 1))
375 (1 mmaxt))
376 ddeg-%offset%))))
377 label610))
378 label620))
379 (setf (f2cl-lib:fref beta-%data%
380 ((f2cl-lib:int-add n s))
381 ((1 (f2cl-lib:int-mul 2 n)))
382 beta-%offset%)
383 (- sum))
384 label700))
385 (qrslqf alpha rwork beta xwork (f2cl-lib:int-mul 2 n))
386 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
387 ((> i n) nil)
388 (tagbody
389 (setf (f2cl-lib:fref face-%data% (i) ((1 n)) face-%offset%)
390 (f2cl-lib:fref beta-%data%
392 ((1 (f2cl-lib:int-mul 2 n)))
393 beta-%offset%))
394 (setf (f2cl-lib:fref facv-%data% (i) ((1 n)) facv-%offset%)
395 (f2cl-lib:fref beta-%data%
396 ((f2cl-lib:int-add n i))
397 ((1 (f2cl-lib:int-mul 2 n)))
398 beta-%offset%))
399 label800))
400 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
401 ((> i n) nil)
402 (tagbody
403 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
404 ((> j (f2cl-lib:fref numt (i) ((1 nn)))) nil)
405 (tagbody
406 (setf dum
407 (abs
408 (f2cl-lib:fref coef-%data%
409 (i j)
410 ((1 nn) (1 mmaxt))
411 coef-%offset%)))
412 (cond
413 ((= dum 0.0f0)
414 (setf (f2cl-lib:fref coescl-%data%
415 (i j)
416 ((1 n) (1 mmaxt))
417 coescl-%offset%)
418 (coerce 0.0f0 'double-float)))
420 (setf sum
422 (f2cl-lib:fref face-%data%
424 ((1 n))
425 face-%offset%)
426 (f2cl-lib:log10 dum)))
427 (f2cl-lib:fdo (k 1 (f2cl-lib:int-add k 1))
428 ((> k n) nil)
429 (tagbody
430 (setf sum
431 (+ sum
433 (f2cl-lib:fref facv-%data%
435 ((1 n))
436 facv-%offset%)
437 (f2cl-lib:fref deg-%data%
438 (i k j)
439 ((1 nn)
440 (1 (f2cl-lib:int-add nn 1))
441 (1 mmaxt))
442 deg-%offset%))))
443 label810))
444 (setf (f2cl-lib:fref coescl-%data%
445 (i j)
446 ((1 n) (1 mmaxt))
447 coescl-%offset%)
448 (f2cl-lib:sign (expt 10.0f0 sum)
449 (f2cl-lib:fref coef-%data%
450 (i j)
451 ((1 nn) (1 mmaxt))
452 coef-%offset%)))))
453 label820))
454 label900))
455 (go end_label)
456 end_label
457 (return
458 (values nil
476 ierr))))))
478 (in-package #:cl-user)
479 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
480 (eval-when (:load-toplevel :compile-toplevel :execute)
481 (setf (gethash 'fortran-to-lisp::sclgnp
482 fortran-to-lisp::*f2cl-function-info*)
483 (fortran-to-lisp::make-f2cl-finfo
484 :arg-types '((fortran-to-lisp::integer4) (fortran-to-lisp::integer4)
485 (fortran-to-lisp::integer4)
486 (array fortran-to-lisp::integer4 (*))
487 (array fortran-to-lisp::integer4 (*))
488 (fortran-to-lisp::integer4) (double-float)
489 (array double-float (*))
490 (array fortran-to-lisp::integer4 (*))
491 (array fortran-to-lisp::integer4 (*))
492 (array double-float (*)) (array double-float (*))
493 (array double-float (*)) (array double-float (*))
494 (array double-float (*)) (array double-float (*))
495 (array double-float (*)) (array double-float (*))
496 (fortran-to-lisp::integer4))
497 :return-values '(nil nil nil nil nil nil nil nil nil nil nil nil nil
498 nil nil nil nil nil fortran-to-lisp::ierr)
499 :calls '(fortran-to-lisp::idamax fortran-to-lisp::qrslqf
500 fortran-to-lisp::qrfaqf fortran-to-lisp::d1mach))))