Remove the obsolete DEFMTRFUN-EXTERNAL macro
[maxima.git] / share / hompack / lisp / r1upqf.lisp
blobd8a82ee5d2ec1669e05cee92866f831996ba0c25
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 (defun r1upqf (n s t$ qt r w)
21 (declare (type (array double-float (*)) w r qt t$ s)
22 (type (f2cl-lib:integer4) n))
23 (f2cl-lib:with-multi-array-data
24 ((s double-float s-%data% s-%offset%)
25 (t$ double-float t$-%data% t$-%offset%)
26 (qt double-float qt-%data% qt-%offset%)
27 (r double-float r-%data% r-%offset%)
28 (w double-float w-%data% w-%offset%))
29 (prog ((tt (make-array 2 :element-type 'double-float)) (eta 0.0)
30 (skipup nil) (i 0) (indexr 0) (indxr2 0) (j 0) (k 0) (c 0.0)
31 (den 0.0) (one 0.0) (ss 0.0) (ww 0.0) (yy 0.0) (temp 0.0)
32 (ddot 0.0))
33 (declare (type (f2cl-lib:integer4) k j indxr2 indexr i)
34 (type f2cl-lib:logical skipup)
35 (type (double-float) ddot temp yy ww ss one den c eta)
36 (type (array double-float (2)) tt))
37 (setf k n)
38 label50
39 (if
40 (or (/= (f2cl-lib:fref t$-%data% (k) ((1 n)) t$-%offset%) 0.0f0)
41 (<= k 1))
42 (go label60))
43 (setf k (f2cl-lib:int-sub k 1))
44 (go label50)
45 label60
46 (setf indexr
48 (the f2cl-lib:integer4
49 (truncate (* (+ (- (+ n n) k) 3) (- k 2)) 2))
50 1))
51 (f2cl-lib:fdo (i (f2cl-lib:int-add k (f2cl-lib:int-sub 1))
52 (f2cl-lib:int-add i (f2cl-lib:int-sub 1)))
53 ((> i 1) nil)
54 (tagbody
55 (cond
56 ((= (f2cl-lib:fref t$ (i) ((1 n))) 0.0f0)
57 (setf c (coerce 0.0f0 'double-float))
58 (setf ss
60 (f2cl-lib:sign one
61 (f2cl-lib:fref t$-%data%
62 ((f2cl-lib:int-add i 1))
63 ((1 n))
64 t$-%offset%)))))
66 (setf den
67 (dnrm2 2
68 (f2cl-lib:array-slice t$-%data%
69 double-float
70 (i)
71 ((1 n))
72 t$-%offset%)
73 1))
74 (setf c (/ (f2cl-lib:fref t$-%data% (i) ((1 n)) t$-%offset%) den))
75 (setf ss
78 (f2cl-lib:fref t$-%data%
79 ((f2cl-lib:int-add i 1))
80 ((1 n))
81 t$-%offset%))
82 den))))
83 (setf yy
84 (f2cl-lib:fref r-%data%
85 (indexr)
86 ((1
87 (f2cl-lib:f2cl/
88 (f2cl-lib:int-mul n (f2cl-lib:int-add n 1))
89 2)))
90 r-%offset%))
91 (setf ww (coerce 0.0f0 'double-float))
92 (setf (f2cl-lib:fref r-%data%
93 (indexr)
94 ((1
95 (f2cl-lib:f2cl/
96 (f2cl-lib:int-mul n (f2cl-lib:int-add n 1))
97 2)))
98 r-%offset%)
99 (- (* c yy) (* ss ww)))
100 (setf (f2cl-lib:fref w-%data%
101 ((f2cl-lib:int-add i 1))
102 ((1 n))
103 w-%offset%)
104 (+ (* ss yy) (* c ww)))
105 (setf indexr (f2cl-lib:int-add indexr 1))
106 (setf indxr2 (f2cl-lib:int-sub (f2cl-lib:int-add indexr n) i))
107 (f2cl-lib:fdo (j (f2cl-lib:int-add i 1) (f2cl-lib:int-add j 1))
108 ((> j n) nil)
109 (tagbody
110 (setf yy
111 (f2cl-lib:fref r-%data%
112 (indexr)
114 (f2cl-lib:f2cl/
115 (f2cl-lib:int-mul n
116 (f2cl-lib:int-add n
118 2)))
119 r-%offset%))
120 (setf ww
121 (f2cl-lib:fref r-%data%
122 (indxr2)
124 (f2cl-lib:f2cl/
125 (f2cl-lib:int-mul n
126 (f2cl-lib:int-add n
128 2)))
129 r-%offset%))
130 (setf (f2cl-lib:fref r-%data%
131 (indexr)
133 (f2cl-lib:f2cl/
134 (f2cl-lib:int-mul n
135 (f2cl-lib:int-add n 1))
136 2)))
137 r-%offset%)
138 (- (* c yy) (* ss ww)))
139 (setf (f2cl-lib:fref r-%data%
140 (indxr2)
142 (f2cl-lib:f2cl/
143 (f2cl-lib:int-mul n
144 (f2cl-lib:int-add n 1))
145 2)))
146 r-%offset%)
147 (+ (* ss yy) (* c ww)))
148 (setf indexr (f2cl-lib:int-add indexr 1))
149 (setf indxr2 (f2cl-lib:int-add indxr2 1))
150 label70))
151 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
152 ((> j n) nil)
153 (tagbody
154 (setf yy
155 (f2cl-lib:fref qt-%data%
156 (i j)
157 ((1 n) (1 n))
158 qt-%offset%))
159 (setf ww
160 (f2cl-lib:fref qt-%data%
161 ((f2cl-lib:int-add i 1) j)
162 ((1 n) (1 n))
163 qt-%offset%))
164 (setf (f2cl-lib:fref qt-%data% (i j) ((1 n) (1 n)) qt-%offset%)
165 (- (* c yy) (* ss ww)))
166 (setf (f2cl-lib:fref qt-%data%
167 ((f2cl-lib:int-add i 1) j)
168 ((1 n) (1 n))
169 qt-%offset%)
170 (+ (* ss yy) (* c ww)))
171 label80))
172 (cond
173 ((= (f2cl-lib:fref t$ (i) ((1 n))) 0.0f0)
174 (setf (f2cl-lib:fref t$-%data% (i) ((1 n)) t$-%offset%)
175 (abs
176 (f2cl-lib:fref t$-%data%
177 ((f2cl-lib:int-add i 1))
178 ((1 n))
179 t$-%offset%))))
181 (setf (f2cl-lib:fref t$-%data% (i) ((1 n)) t$-%offset%)
182 (dnrm2 2
183 (f2cl-lib:array-slice t$-%data%
184 double-float
186 ((1 n))
187 t$-%offset%)
188 1))))
189 (setf indexr
190 (f2cl-lib:int-sub indexr
191 (f2cl-lib:int-mul 2 (f2cl-lib:int-sub n i))
193 label90))
194 (setf temp (f2cl-lib:fref t$-%data% (1) ((1 n)) t$-%offset%))
195 (daxpy n temp s 1 r 1)
196 (setf indexr 1)
197 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
198 ((> i (f2cl-lib:int-add k (f2cl-lib:int-sub 1))) nil)
199 (tagbody
200 (cond
202 (f2cl-lib:fref r
203 (indexr)
205 (f2cl-lib:f2cl/
206 (f2cl-lib:int-mul n (f2cl-lib:int-add n 1))
207 2))))
208 0.0f0)
209 (setf c (coerce 0.0f0 'double-float))
210 (setf ss
212 (f2cl-lib:sign one
213 (f2cl-lib:fref w-%data%
214 ((f2cl-lib:int-add i 1))
215 ((1 n))
216 w-%offset%)))))
218 (setf (f2cl-lib:fref tt (1) ((1 2)))
219 (f2cl-lib:fref r-%data%
220 (indexr)
222 (f2cl-lib:f2cl/
223 (f2cl-lib:int-mul n
224 (f2cl-lib:int-add n
226 2)))
227 r-%offset%))
228 (setf (f2cl-lib:fref tt (2) ((1 2)))
229 (f2cl-lib:fref w-%data%
230 ((f2cl-lib:int-add i 1))
231 ((1 n))
232 w-%offset%))
233 (setf den (dnrm2 2 tt 1))
234 (setf c
236 (f2cl-lib:fref r-%data%
237 (indexr)
239 (f2cl-lib:f2cl/
240 (f2cl-lib:int-mul n
241 (f2cl-lib:int-add n
243 2)))
244 r-%offset%)
245 den))
246 (setf ss
249 (f2cl-lib:fref w-%data%
250 ((f2cl-lib:int-add i 1))
251 ((1 n))
252 w-%offset%))
253 den))))
254 (setf yy
255 (f2cl-lib:fref r-%data%
256 (indexr)
258 (f2cl-lib:f2cl/
259 (f2cl-lib:int-mul n (f2cl-lib:int-add n 1))
260 2)))
261 r-%offset%))
262 (setf ww
263 (f2cl-lib:fref w-%data%
264 ((f2cl-lib:int-add i 1))
265 ((1 n))
266 w-%offset%))
267 (setf (f2cl-lib:fref r-%data%
268 (indexr)
270 (f2cl-lib:f2cl/
271 (f2cl-lib:int-mul n (f2cl-lib:int-add n 1))
272 2)))
273 r-%offset%)
274 (- (* c yy) (* ss ww)))
275 (setf (f2cl-lib:fref w-%data%
276 ((f2cl-lib:int-add i 1))
277 ((1 n))
278 w-%offset%)
279 (coerce 0.0f0 'double-float))
280 (setf indexr (f2cl-lib:int-add indexr 1))
281 (setf indxr2 (f2cl-lib:int-sub (f2cl-lib:int-add indexr n) i))
282 (f2cl-lib:fdo (j (f2cl-lib:int-add i 1) (f2cl-lib:int-add j 1))
283 ((> j n) nil)
284 (tagbody
285 (setf yy
286 (f2cl-lib:fref r-%data%
287 (indexr)
289 (f2cl-lib:f2cl/
290 (f2cl-lib:int-mul n
291 (f2cl-lib:int-add n
293 2)))
294 r-%offset%))
295 (setf ww
296 (f2cl-lib:fref r-%data%
297 (indxr2)
299 (f2cl-lib:f2cl/
300 (f2cl-lib:int-mul n
301 (f2cl-lib:int-add n
303 2)))
304 r-%offset%))
305 (setf (f2cl-lib:fref r-%data%
306 (indexr)
308 (f2cl-lib:f2cl/
309 (f2cl-lib:int-mul n
310 (f2cl-lib:int-add n 1))
311 2)))
312 r-%offset%)
313 (- (* c yy) (* ss ww)))
314 (setf (f2cl-lib:fref r-%data%
315 (indxr2)
317 (f2cl-lib:f2cl/
318 (f2cl-lib:int-mul n
319 (f2cl-lib:int-add n 1))
320 2)))
321 r-%offset%)
322 (+ (* ss yy) (* c ww)))
323 (setf indexr (f2cl-lib:int-add indexr 1))
324 (setf indxr2 (f2cl-lib:int-add indxr2 1))
325 label100))
326 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
327 ((> j n) nil)
328 (tagbody
329 (setf yy
330 (f2cl-lib:fref qt-%data%
331 (i j)
332 ((1 n) (1 n))
333 qt-%offset%))
334 (setf ww
335 (f2cl-lib:fref qt-%data%
336 ((f2cl-lib:int-add i 1) j)
337 ((1 n) (1 n))
338 qt-%offset%))
339 (setf (f2cl-lib:fref qt-%data% (i j) ((1 n) (1 n)) qt-%offset%)
340 (- (* c yy) (* ss ww)))
341 (setf (f2cl-lib:fref qt-%data%
342 ((f2cl-lib:int-add i 1) j)
343 ((1 n) (1 n))
344 qt-%offset%)
345 (+ (* ss yy) (* c ww)))
346 label110))
347 label120))
348 (go end_label)
349 end_label
350 (return (values nil nil nil nil nil nil)))))
352 (in-package #:cl-user)
353 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
354 (eval-when (:load-toplevel :compile-toplevel :execute)
355 (setf (gethash 'fortran-to-lisp::r1upqf
356 fortran-to-lisp::*f2cl-function-info*)
357 (fortran-to-lisp::make-f2cl-finfo
358 :arg-types '((fortran-to-lisp::integer4) (array double-float (*))
359 (array double-float (*)) (array double-float (*))
360 (array double-float (*)) (array double-float (*)))
361 :return-values '(nil nil nil nil nil nil)
362 :calls '(fortran-to-lisp::daxpy fortran-to-lisp::dnrm2))))