Add some basic letsimp tests based on bug #3950
[maxima.git] / share / lapack / blas / dtrsv.lisp
blob657d479eb12987a00d2d58faff6ffe38346d034f
1 ;;; Compiled by f2cl version:
2 ;;; ("f2cl1.l,v 2edcbd958861 2012/05/30 03:34:52 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 3fe93de3be82 2012/05/06 02:17:14 toy $"
7 ;;; "f2cl6.l,v 1d5cbacbb977 2008/08/24 00:56:27 rtoy $"
8 ;;; "macros.l,v 3fe93de3be82 2012/05/06 02:17:14 toy $")
10 ;;; Using Lisp CMU Common Lisp 20d (20D 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 :blas)
20 (let* ((zero 0.0))
21 (declare (type (double-float 0.0 0.0) zero) (ignorable zero))
22 (defun dtrsv (uplo trans diag n a lda x incx)
23 (declare (type (array double-float (*)) x a)
24 (type (f2cl-lib:integer4) incx lda n)
25 (type (simple-string *) diag trans uplo))
26 (f2cl-lib:with-multi-array-data
27 ((uplo character uplo-%data% uplo-%offset%)
28 (trans character trans-%data% trans-%offset%)
29 (diag character diag-%data% diag-%offset%)
30 (a double-float a-%data% a-%offset%)
31 (x double-float x-%data% x-%offset%))
32 (prog ((nounit nil) (i 0) (info 0) (ix 0) (j 0) (jx 0) (kx 0) (temp 0.0))
33 (declare (type f2cl-lib:logical nounit)
34 (type (f2cl-lib:integer4) i info ix j jx kx)
35 (type (double-float) temp))
36 (setf info 0)
37 (cond
38 ((and (not (lsame uplo "U")) (not (lsame uplo "L")))
39 (setf info 1))
40 ((and (not (lsame trans "N"))
41 (not (lsame trans "T"))
42 (not (lsame trans "C")))
43 (setf info 2))
44 ((and (not (lsame diag "U")) (not (lsame diag "N")))
45 (setf info 3))
46 ((< n 0)
47 (setf info 4))
48 ((< lda (max (the f2cl-lib:integer4 1) (the f2cl-lib:integer4 n)))
49 (setf info 6))
50 ((= incx 0)
51 (setf info 8)))
52 (cond
53 ((/= info 0)
54 (xerbla "DTRSV " info)
55 (go end_label)))
56 (if (= n 0) (go end_label))
57 (setf nounit (lsame diag "N"))
58 (cond
59 ((<= incx 0)
60 (setf kx
61 (f2cl-lib:int-sub 1
62 (f2cl-lib:int-mul (f2cl-lib:int-sub n 1)
63 incx))))
64 ((/= incx 1)
65 (setf kx 1)))
66 (cond
67 ((lsame trans "N")
68 (cond
69 ((lsame uplo "U")
70 (cond
71 ((= incx 1)
72 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
73 ((> j 1) nil)
74 (tagbody
75 (cond
76 ((/= (f2cl-lib:fref x (j) ((1 *))) zero)
77 (if nounit
78 (setf (f2cl-lib:fref x-%data%
79 (j)
80 ((1 *))
81 x-%offset%)
83 (f2cl-lib:fref x-%data%
84 (j)
85 ((1 *))
86 x-%offset%)
87 (f2cl-lib:fref a-%data%
88 (j j)
89 ((1 lda) (1 *))
90 a-%offset%))))
91 (setf temp
92 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
93 (f2cl-lib:fdo (i
94 (f2cl-lib:int-add j
95 (f2cl-lib:int-sub 1))
96 (f2cl-lib:int-add i
97 (f2cl-lib:int-sub 1)))
98 ((> i 1) nil)
99 (tagbody
100 (setf (f2cl-lib:fref x-%data%
102 ((1 *))
103 x-%offset%)
105 (f2cl-lib:fref x-%data%
107 ((1 *))
108 x-%offset%)
109 (* temp
110 (f2cl-lib:fref a-%data%
111 (i j)
112 ((1 lda) (1 *))
113 a-%offset%))))
114 label10))))
115 label20)))
117 (setf jx
118 (f2cl-lib:int-add kx
119 (f2cl-lib:int-mul
120 (f2cl-lib:int-sub n 1)
121 incx)))
122 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
123 ((> j 1) nil)
124 (tagbody
125 (cond
126 ((/= (f2cl-lib:fref x (jx) ((1 *))) zero)
127 (if nounit
128 (setf (f2cl-lib:fref x-%data%
129 (jx)
130 ((1 *))
131 x-%offset%)
133 (f2cl-lib:fref x-%data%
134 (jx)
135 ((1 *))
136 x-%offset%)
137 (f2cl-lib:fref a-%data%
138 (j j)
139 ((1 lda) (1 *))
140 a-%offset%))))
141 (setf temp
142 (f2cl-lib:fref x-%data%
143 (jx)
144 ((1 *))
145 x-%offset%))
146 (setf ix jx)
147 (f2cl-lib:fdo (i
148 (f2cl-lib:int-add j
149 (f2cl-lib:int-sub 1))
150 (f2cl-lib:int-add i
151 (f2cl-lib:int-sub 1)))
152 ((> i 1) nil)
153 (tagbody
154 (setf ix (f2cl-lib:int-sub ix incx))
155 (setf (f2cl-lib:fref x-%data%
156 (ix)
157 ((1 *))
158 x-%offset%)
160 (f2cl-lib:fref x-%data%
161 (ix)
162 ((1 *))
163 x-%offset%)
164 (* temp
165 (f2cl-lib:fref a-%data%
166 (i j)
167 ((1 lda) (1 *))
168 a-%offset%))))
169 label30))))
170 (setf jx (f2cl-lib:int-sub jx incx))
171 label40)))))
173 (cond
174 ((= incx 1)
175 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
176 ((> j n) nil)
177 (tagbody
178 (cond
179 ((/= (f2cl-lib:fref x (j) ((1 *))) zero)
180 (if nounit
181 (setf (f2cl-lib:fref x-%data%
183 ((1 *))
184 x-%offset%)
186 (f2cl-lib:fref x-%data%
188 ((1 *))
189 x-%offset%)
190 (f2cl-lib:fref a-%data%
191 (j j)
192 ((1 lda) (1 *))
193 a-%offset%))))
194 (setf temp
195 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
196 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
197 (f2cl-lib:int-add i 1))
198 ((> i n) nil)
199 (tagbody
200 (setf (f2cl-lib:fref x-%data%
202 ((1 *))
203 x-%offset%)
205 (f2cl-lib:fref x-%data%
207 ((1 *))
208 x-%offset%)
209 (* temp
210 (f2cl-lib:fref a-%data%
211 (i j)
212 ((1 lda) (1 *))
213 a-%offset%))))
214 label50))))
215 label60)))
217 (setf jx kx)
218 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
219 ((> j n) nil)
220 (tagbody
221 (cond
222 ((/= (f2cl-lib:fref x (jx) ((1 *))) zero)
223 (if nounit
224 (setf (f2cl-lib:fref x-%data%
225 (jx)
226 ((1 *))
227 x-%offset%)
229 (f2cl-lib:fref x-%data%
230 (jx)
231 ((1 *))
232 x-%offset%)
233 (f2cl-lib:fref a-%data%
234 (j j)
235 ((1 lda) (1 *))
236 a-%offset%))))
237 (setf temp
238 (f2cl-lib:fref x-%data%
239 (jx)
240 ((1 *))
241 x-%offset%))
242 (setf ix jx)
243 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
244 (f2cl-lib:int-add i 1))
245 ((> i n) nil)
246 (tagbody
247 (setf ix (f2cl-lib:int-add ix incx))
248 (setf (f2cl-lib:fref x-%data%
249 (ix)
250 ((1 *))
251 x-%offset%)
253 (f2cl-lib:fref x-%data%
254 (ix)
255 ((1 *))
256 x-%offset%)
257 (* temp
258 (f2cl-lib:fref a-%data%
259 (i j)
260 ((1 lda) (1 *))
261 a-%offset%))))
262 label70))))
263 (setf jx (f2cl-lib:int-add jx incx))
264 label80)))))))
266 (cond
267 ((lsame uplo "U")
268 (cond
269 ((= incx 1)
270 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
271 ((> j n) nil)
272 (tagbody
273 (setf temp
274 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
275 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
276 ((> i
277 (f2cl-lib:int-add j
278 (f2cl-lib:int-sub 1)))
279 nil)
280 (tagbody
281 (setf temp
282 (- temp
284 (f2cl-lib:fref a-%data%
285 (i j)
286 ((1 lda) (1 *))
287 a-%offset%)
288 (f2cl-lib:fref x-%data%
290 ((1 *))
291 x-%offset%))))
292 label90))
293 (if nounit
294 (setf temp
295 (/ temp
296 (f2cl-lib:fref a-%data%
297 (j j)
298 ((1 lda) (1 *))
299 a-%offset%))))
300 (setf (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%)
301 temp)
302 label100)))
304 (setf jx kx)
305 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
306 ((> j n) nil)
307 (tagbody
308 (setf temp
309 (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%))
310 (setf ix kx)
311 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
312 ((> i
313 (f2cl-lib:int-add j
314 (f2cl-lib:int-sub 1)))
315 nil)
316 (tagbody
317 (setf temp
318 (- temp
320 (f2cl-lib:fref a-%data%
321 (i j)
322 ((1 lda) (1 *))
323 a-%offset%)
324 (f2cl-lib:fref x-%data%
325 (ix)
326 ((1 *))
327 x-%offset%))))
328 (setf ix (f2cl-lib:int-add ix incx))
329 label110))
330 (if nounit
331 (setf temp
332 (/ temp
333 (f2cl-lib:fref a-%data%
334 (j j)
335 ((1 lda) (1 *))
336 a-%offset%))))
337 (setf (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%)
338 temp)
339 (setf jx (f2cl-lib:int-add jx incx))
340 label120)))))
342 (cond
343 ((= incx 1)
344 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
345 ((> j 1) nil)
346 (tagbody
347 (setf temp
348 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
349 (f2cl-lib:fdo (i n
350 (f2cl-lib:int-add i (f2cl-lib:int-sub 1)))
351 ((> i (f2cl-lib:int-add j 1)) nil)
352 (tagbody
353 (setf temp
354 (- temp
356 (f2cl-lib:fref a-%data%
357 (i j)
358 ((1 lda) (1 *))
359 a-%offset%)
360 (f2cl-lib:fref x-%data%
362 ((1 *))
363 x-%offset%))))
364 label130))
365 (if nounit
366 (setf temp
367 (/ temp
368 (f2cl-lib:fref a-%data%
369 (j j)
370 ((1 lda) (1 *))
371 a-%offset%))))
372 (setf (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%)
373 temp)
374 label140)))
376 (setf kx
377 (f2cl-lib:int-add kx
378 (f2cl-lib:int-mul
379 (f2cl-lib:int-sub n 1)
380 incx)))
381 (setf jx kx)
382 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
383 ((> j 1) nil)
384 (tagbody
385 (setf temp
386 (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%))
387 (setf ix kx)
388 (f2cl-lib:fdo (i n
389 (f2cl-lib:int-add i (f2cl-lib:int-sub 1)))
390 ((> i (f2cl-lib:int-add j 1)) nil)
391 (tagbody
392 (setf temp
393 (- temp
395 (f2cl-lib:fref a-%data%
396 (i j)
397 ((1 lda) (1 *))
398 a-%offset%)
399 (f2cl-lib:fref x-%data%
400 (ix)
401 ((1 *))
402 x-%offset%))))
403 (setf ix (f2cl-lib:int-sub ix incx))
404 label150))
405 (if nounit
406 (setf temp
407 (/ temp
408 (f2cl-lib:fref a-%data%
409 (j j)
410 ((1 lda) (1 *))
411 a-%offset%))))
412 (setf (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%)
413 temp)
414 (setf jx (f2cl-lib:int-sub jx incx))
415 label160))))))))
416 (go end_label)
417 end_label
418 (return (values nil nil nil nil nil nil nil nil))))))
420 (in-package #-gcl #:cl-user #+gcl "CL-USER")
421 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
422 (eval-when (:load-toplevel :compile-toplevel :execute)
423 (setf (gethash 'fortran-to-lisp::dtrsv fortran-to-lisp::*f2cl-function-info*)
424 (fortran-to-lisp::make-f2cl-finfo
425 :arg-types '((simple-string) (simple-string) (simple-string)
426 (fortran-to-lisp::integer4) (array double-float (*))
427 (fortran-to-lisp::integer4) (array double-float (*))
428 (fortran-to-lisp::integer4))
429 :return-values '(nil nil nil nil nil nil nil nil)
430 :calls '(fortran-to-lisp::xerbla fortran-to-lisp::lsame))))