Add some basic letsimp tests based on bug #3950
[maxima.git] / share / lapack / blas / ztbsv.lisp
bloba8b101b925855d0123fa715a1134b6b512817247
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 (f2cl-lib:cmplx 0.0 0.0)))
21 (declare (type (f2cl-lib:complex16) zero) (ignorable zero))
22 (defun ztbsv (uplo trans diag n k a lda x incx)
23 (declare (type (array f2cl-lib:complex16 (*)) x a)
24 (type (f2cl-lib:integer4) incx lda k 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 f2cl-lib:complex16 a-%data% a-%offset%)
31 (x f2cl-lib:complex16 x-%data% x-%offset%))
32 (prog ((noconj nil) (nounit nil) (i 0) (info 0) (ix 0) (j 0) (jx 0)
33 (kplus1 0) (kx 0) (l 0) (temp #C(0.0 0.0)))
34 (declare (type f2cl-lib:logical noconj nounit)
35 (type (f2cl-lib:integer4) i info ix j jx kplus1 kx l)
36 (type (f2cl-lib:complex16) temp))
37 (setf info 0)
38 (cond
39 ((and (not (lsame uplo "U")) (not (lsame uplo "L")))
40 (setf info 1))
41 ((and (not (lsame trans "N"))
42 (not (lsame trans "T"))
43 (not (lsame trans "C")))
44 (setf info 2))
45 ((and (not (lsame diag "U")) (not (lsame diag "N")))
46 (setf info 3))
47 ((< n 0)
48 (setf info 4))
49 ((< k 0)
50 (setf info 5))
51 ((< lda (f2cl-lib:int-add k 1))
52 (setf info 7))
53 ((= incx 0)
54 (setf info 9)))
55 (cond
56 ((/= info 0)
57 (xerbla "ZTBSV " info)
58 (go end_label)))
59 (if (= n 0) (go end_label))
60 (setf noconj (lsame trans "T"))
61 (setf nounit (lsame diag "N"))
62 (cond
63 ((<= incx 0)
64 (setf kx
65 (f2cl-lib:int-sub 1
66 (f2cl-lib:int-mul (f2cl-lib:int-sub n 1)
67 incx))))
68 ((/= incx 1)
69 (setf kx 1)))
70 (cond
71 ((lsame trans "N")
72 (cond
73 ((lsame uplo "U")
74 (setf kplus1 (f2cl-lib:int-add k 1))
75 (cond
76 ((= incx 1)
77 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
78 ((> j 1) nil)
79 (tagbody
80 (cond
81 ((/= (f2cl-lib:fref x (j) ((1 *))) zero)
82 (setf l (f2cl-lib:int-sub kplus1 j))
83 (if nounit
84 (setf (f2cl-lib:fref x-%data%
85 (j)
86 ((1 *))
87 x-%offset%)
89 (f2cl-lib:fref x-%data%
90 (j)
91 ((1 *))
92 x-%offset%)
93 (f2cl-lib:fref a-%data%
94 (kplus1 j)
95 ((1 lda) (1 *))
96 a-%offset%))))
97 (setf temp
98 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
99 (f2cl-lib:fdo (i
100 (f2cl-lib:int-add j
101 (f2cl-lib:int-sub 1))
102 (f2cl-lib:int-add i
103 (f2cl-lib:int-sub 1)))
104 ((> i
105 (max (the f2cl-lib:integer4 1)
106 (the f2cl-lib:integer4
107 (f2cl-lib:int-add j
108 (f2cl-lib:int-sub
109 k)))))
110 nil)
111 (tagbody
112 (setf (f2cl-lib:fref x-%data%
114 ((1 *))
115 x-%offset%)
117 (f2cl-lib:fref x-%data%
119 ((1 *))
120 x-%offset%)
121 (* temp
122 (f2cl-lib:fref a-%data%
123 ((f2cl-lib:int-add l i)
125 ((1 lda) (1 *))
126 a-%offset%))))
127 label10))))
128 label20)))
130 (setf kx
131 (f2cl-lib:int-add kx
132 (f2cl-lib:int-mul
133 (f2cl-lib:int-sub n 1)
134 incx)))
135 (setf jx kx)
136 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
137 ((> j 1) nil)
138 (tagbody
139 (setf kx (f2cl-lib:int-sub kx incx))
140 (cond
141 ((/= (f2cl-lib:fref x (jx) ((1 *))) zero)
142 (setf ix kx)
143 (setf l (f2cl-lib:int-sub kplus1 j))
144 (if nounit
145 (setf (f2cl-lib:fref x-%data%
146 (jx)
147 ((1 *))
148 x-%offset%)
150 (f2cl-lib:fref x-%data%
151 (jx)
152 ((1 *))
153 x-%offset%)
154 (f2cl-lib:fref a-%data%
155 (kplus1 j)
156 ((1 lda) (1 *))
157 a-%offset%))))
158 (setf temp
159 (f2cl-lib:fref x-%data%
160 (jx)
161 ((1 *))
162 x-%offset%))
163 (f2cl-lib:fdo (i
164 (f2cl-lib:int-add j
165 (f2cl-lib:int-sub 1))
166 (f2cl-lib:int-add i
167 (f2cl-lib:int-sub 1)))
168 ((> i
169 (max (the f2cl-lib:integer4 1)
170 (the f2cl-lib:integer4
171 (f2cl-lib:int-add j
172 (f2cl-lib:int-sub
173 k)))))
174 nil)
175 (tagbody
176 (setf (f2cl-lib:fref x-%data%
177 (ix)
178 ((1 *))
179 x-%offset%)
181 (f2cl-lib:fref x-%data%
182 (ix)
183 ((1 *))
184 x-%offset%)
185 (* temp
186 (f2cl-lib:fref a-%data%
187 ((f2cl-lib:int-add l i)
189 ((1 lda) (1 *))
190 a-%offset%))))
191 (setf ix (f2cl-lib:int-sub ix incx))
192 label30))))
193 (setf jx (f2cl-lib:int-sub jx incx))
194 label40)))))
196 (cond
197 ((= incx 1)
198 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
199 ((> j n) nil)
200 (tagbody
201 (cond
202 ((/= (f2cl-lib:fref x (j) ((1 *))) zero)
203 (setf l (f2cl-lib:int-sub 1 j))
204 (if nounit
205 (setf (f2cl-lib:fref x-%data%
207 ((1 *))
208 x-%offset%)
210 (f2cl-lib:fref x-%data%
212 ((1 *))
213 x-%offset%)
214 (f2cl-lib:fref a-%data%
215 (1 j)
216 ((1 lda) (1 *))
217 a-%offset%))))
218 (setf temp
219 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
220 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
221 (f2cl-lib:int-add i 1))
222 ((> i
223 (min (the f2cl-lib:integer4 n)
224 (the f2cl-lib:integer4
225 (f2cl-lib:int-add j k))))
226 nil)
227 (tagbody
228 (setf (f2cl-lib:fref x-%data%
230 ((1 *))
231 x-%offset%)
233 (f2cl-lib:fref x-%data%
235 ((1 *))
236 x-%offset%)
237 (* temp
238 (f2cl-lib:fref a-%data%
239 ((f2cl-lib:int-add l i)
241 ((1 lda) (1 *))
242 a-%offset%))))
243 label50))))
244 label60)))
246 (setf jx kx)
247 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
248 ((> j n) nil)
249 (tagbody
250 (setf kx (f2cl-lib:int-add kx incx))
251 (cond
252 ((/= (f2cl-lib:fref x (jx) ((1 *))) zero)
253 (setf ix kx)
254 (setf l (f2cl-lib:int-sub 1 j))
255 (if nounit
256 (setf (f2cl-lib:fref x-%data%
257 (jx)
258 ((1 *))
259 x-%offset%)
261 (f2cl-lib:fref x-%data%
262 (jx)
263 ((1 *))
264 x-%offset%)
265 (f2cl-lib:fref a-%data%
266 (1 j)
267 ((1 lda) (1 *))
268 a-%offset%))))
269 (setf temp
270 (f2cl-lib:fref x-%data%
271 (jx)
272 ((1 *))
273 x-%offset%))
274 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
275 (f2cl-lib:int-add i 1))
276 ((> i
277 (min (the f2cl-lib:integer4 n)
278 (the f2cl-lib:integer4
279 (f2cl-lib:int-add j k))))
280 nil)
281 (tagbody
282 (setf (f2cl-lib:fref x-%data%
283 (ix)
284 ((1 *))
285 x-%offset%)
287 (f2cl-lib:fref x-%data%
288 (ix)
289 ((1 *))
290 x-%offset%)
291 (* temp
292 (f2cl-lib:fref a-%data%
293 ((f2cl-lib:int-add l i)
295 ((1 lda) (1 *))
296 a-%offset%))))
297 (setf ix (f2cl-lib:int-add ix incx))
298 label70))))
299 (setf jx (f2cl-lib:int-add jx incx))
300 label80)))))))
302 (cond
303 ((lsame uplo "U")
304 (setf kplus1 (f2cl-lib:int-add k 1))
305 (cond
306 ((= incx 1)
307 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
308 ((> j n) nil)
309 (tagbody
310 (setf temp
311 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
312 (setf l (f2cl-lib:int-sub kplus1 j))
313 (cond
314 (noconj
315 (f2cl-lib:fdo (i
316 (max (the f2cl-lib:integer4 1)
317 (the f2cl-lib:integer4
318 (f2cl-lib:int-add j
319 (f2cl-lib:int-sub
320 k))))
321 (f2cl-lib:int-add i 1))
322 ((> i
323 (f2cl-lib:int-add j
324 (f2cl-lib:int-sub
325 1)))
326 nil)
327 (tagbody
328 (setf temp
329 (- temp
331 (f2cl-lib:fref a-%data%
332 ((f2cl-lib:int-add l i)
334 ((1 lda) (1 *))
335 a-%offset%)
336 (f2cl-lib:fref x-%data%
338 ((1 *))
339 x-%offset%))))
340 label90))
341 (if nounit
342 (setf temp
343 (/ temp
344 (f2cl-lib:fref a-%data%
345 (kplus1 j)
346 ((1 lda) (1 *))
347 a-%offset%)))))
349 (f2cl-lib:fdo (i
350 (max (the f2cl-lib:integer4 1)
351 (the f2cl-lib:integer4
352 (f2cl-lib:int-add j
353 (f2cl-lib:int-sub
354 k))))
355 (f2cl-lib:int-add i 1))
356 ((> i
357 (f2cl-lib:int-add j
358 (f2cl-lib:int-sub
359 1)))
360 nil)
361 (tagbody
362 (setf temp
363 (- temp
365 (f2cl-lib:dconjg
366 (f2cl-lib:fref a-%data%
367 ((f2cl-lib:int-add l i)
369 ((1 lda) (1 *))
370 a-%offset%))
371 (f2cl-lib:fref x-%data%
373 ((1 *))
374 x-%offset%))))
375 label100))
376 (if nounit
377 (setf temp
378 (/ temp
379 (f2cl-lib:dconjg
380 (f2cl-lib:fref a-%data%
381 (kplus1 j)
382 ((1 lda) (1 *))
383 a-%offset%)))))))
384 (setf (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%)
385 temp)
386 label110)))
388 (setf jx kx)
389 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
390 ((> j n) nil)
391 (tagbody
392 (setf temp
393 (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%))
394 (setf ix kx)
395 (setf l (f2cl-lib:int-sub kplus1 j))
396 (cond
397 (noconj
398 (f2cl-lib:fdo (i
399 (max (the f2cl-lib:integer4 1)
400 (the f2cl-lib:integer4
401 (f2cl-lib:int-add j
402 (f2cl-lib:int-sub
403 k))))
404 (f2cl-lib:int-add i 1))
405 ((> i
406 (f2cl-lib:int-add j
407 (f2cl-lib:int-sub
408 1)))
409 nil)
410 (tagbody
411 (setf temp
412 (- temp
414 (f2cl-lib:fref a-%data%
415 ((f2cl-lib:int-add l i)
417 ((1 lda) (1 *))
418 a-%offset%)
419 (f2cl-lib:fref x-%data%
420 (ix)
421 ((1 *))
422 x-%offset%))))
423 (setf ix (f2cl-lib:int-add ix incx))
424 label120))
425 (if nounit
426 (setf temp
427 (/ temp
428 (f2cl-lib:fref a-%data%
429 (kplus1 j)
430 ((1 lda) (1 *))
431 a-%offset%)))))
433 (f2cl-lib:fdo (i
434 (max (the f2cl-lib:integer4 1)
435 (the f2cl-lib:integer4
436 (f2cl-lib:int-add j
437 (f2cl-lib:int-sub
438 k))))
439 (f2cl-lib:int-add i 1))
440 ((> i
441 (f2cl-lib:int-add j
442 (f2cl-lib:int-sub
443 1)))
444 nil)
445 (tagbody
446 (setf temp
447 (- temp
449 (f2cl-lib:dconjg
450 (f2cl-lib:fref a-%data%
451 ((f2cl-lib:int-add l i)
453 ((1 lda) (1 *))
454 a-%offset%))
455 (f2cl-lib:fref x-%data%
456 (ix)
457 ((1 *))
458 x-%offset%))))
459 (setf ix (f2cl-lib:int-add ix incx))
460 label130))
461 (if nounit
462 (setf temp
463 (/ temp
464 (f2cl-lib:dconjg
465 (f2cl-lib:fref a-%data%
466 (kplus1 j)
467 ((1 lda) (1 *))
468 a-%offset%)))))))
469 (setf (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%)
470 temp)
471 (setf jx (f2cl-lib:int-add jx incx))
472 (if (> j k) (setf kx (f2cl-lib:int-add kx incx)))
473 label140)))))
475 (cond
476 ((= incx 1)
477 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
478 ((> j 1) nil)
479 (tagbody
480 (setf temp
481 (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%))
482 (setf l (f2cl-lib:int-sub 1 j))
483 (cond
484 (noconj
485 (f2cl-lib:fdo (i
486 (min (the f2cl-lib:integer4 n)
487 (the f2cl-lib:integer4
488 (f2cl-lib:int-add j k)))
489 (f2cl-lib:int-add i
490 (f2cl-lib:int-sub 1)))
491 ((> i (f2cl-lib:int-add j 1)) nil)
492 (tagbody
493 (setf temp
494 (- temp
496 (f2cl-lib:fref a-%data%
497 ((f2cl-lib:int-add l i)
499 ((1 lda) (1 *))
500 a-%offset%)
501 (f2cl-lib:fref x-%data%
503 ((1 *))
504 x-%offset%))))
505 label150))
506 (if nounit
507 (setf temp
508 (/ temp
509 (f2cl-lib:fref a-%data%
510 (1 j)
511 ((1 lda) (1 *))
512 a-%offset%)))))
514 (f2cl-lib:fdo (i
515 (min (the f2cl-lib:integer4 n)
516 (the f2cl-lib:integer4
517 (f2cl-lib:int-add j k)))
518 (f2cl-lib:int-add i
519 (f2cl-lib:int-sub 1)))
520 ((> i (f2cl-lib:int-add j 1)) nil)
521 (tagbody
522 (setf temp
523 (- temp
525 (f2cl-lib:dconjg
526 (f2cl-lib:fref a-%data%
527 ((f2cl-lib:int-add l i)
529 ((1 lda) (1 *))
530 a-%offset%))
531 (f2cl-lib:fref x-%data%
533 ((1 *))
534 x-%offset%))))
535 label160))
536 (if nounit
537 (setf temp
538 (/ temp
539 (f2cl-lib:dconjg
540 (f2cl-lib:fref a-%data%
541 (1 j)
542 ((1 lda) (1 *))
543 a-%offset%)))))))
544 (setf (f2cl-lib:fref x-%data% (j) ((1 *)) x-%offset%)
545 temp)
546 label170)))
548 (setf kx
549 (f2cl-lib:int-add kx
550 (f2cl-lib:int-mul
551 (f2cl-lib:int-sub n 1)
552 incx)))
553 (setf jx kx)
554 (f2cl-lib:fdo (j n (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
555 ((> j 1) nil)
556 (tagbody
557 (setf temp
558 (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%))
559 (setf ix kx)
560 (setf l (f2cl-lib:int-sub 1 j))
561 (cond
562 (noconj
563 (f2cl-lib:fdo (i
564 (min (the f2cl-lib:integer4 n)
565 (the f2cl-lib:integer4
566 (f2cl-lib:int-add j k)))
567 (f2cl-lib:int-add i
568 (f2cl-lib:int-sub 1)))
569 ((> i (f2cl-lib:int-add j 1)) nil)
570 (tagbody
571 (setf temp
572 (- temp
574 (f2cl-lib:fref a-%data%
575 ((f2cl-lib:int-add l i)
577 ((1 lda) (1 *))
578 a-%offset%)
579 (f2cl-lib:fref x-%data%
580 (ix)
581 ((1 *))
582 x-%offset%))))
583 (setf ix (f2cl-lib:int-sub ix incx))
584 label180))
585 (if nounit
586 (setf temp
587 (/ temp
588 (f2cl-lib:fref a-%data%
589 (1 j)
590 ((1 lda) (1 *))
591 a-%offset%)))))
593 (f2cl-lib:fdo (i
594 (min (the f2cl-lib:integer4 n)
595 (the f2cl-lib:integer4
596 (f2cl-lib:int-add j k)))
597 (f2cl-lib:int-add i
598 (f2cl-lib:int-sub 1)))
599 ((> i (f2cl-lib:int-add j 1)) nil)
600 (tagbody
601 (setf temp
602 (- temp
604 (f2cl-lib:dconjg
605 (f2cl-lib:fref a-%data%
606 ((f2cl-lib:int-add l i)
608 ((1 lda) (1 *))
609 a-%offset%))
610 (f2cl-lib:fref x-%data%
611 (ix)
612 ((1 *))
613 x-%offset%))))
614 (setf ix (f2cl-lib:int-sub ix incx))
615 label190))
616 (if nounit
617 (setf temp
618 (/ temp
619 (f2cl-lib:dconjg
620 (f2cl-lib:fref a-%data%
621 (1 j)
622 ((1 lda) (1 *))
623 a-%offset%)))))))
624 (setf (f2cl-lib:fref x-%data% (jx) ((1 *)) x-%offset%)
625 temp)
626 (setf jx (f2cl-lib:int-sub jx incx))
627 (if (>= (f2cl-lib:int-sub n j) k)
628 (setf kx (f2cl-lib:int-sub kx incx)))
629 label200))))))))
630 (go end_label)
631 end_label
632 (return (values nil nil nil nil nil nil nil nil nil))))))
634 (in-package #-gcl #:cl-user #+gcl "CL-USER")
635 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
636 (eval-when (:load-toplevel :compile-toplevel :execute)
637 (setf (gethash 'fortran-to-lisp::ztbsv fortran-to-lisp::*f2cl-function-info*)
638 (fortran-to-lisp::make-f2cl-finfo
639 :arg-types '((simple-string) (simple-string) (simple-string)
640 (fortran-to-lisp::integer4) (fortran-to-lisp::integer4)
641 (array fortran-to-lisp::complex16 (*))
642 (fortran-to-lisp::integer4)
643 (array fortran-to-lisp::complex16 (*))
644 (fortran-to-lisp::integer4))
645 :return-values '(nil nil nil nil nil nil nil nil nil)
646 :calls '(fortran-to-lisp::xerbla fortran-to-lisp::lsame))))