Add some basic letsimp tests based on bug #3950
[maxima.git] / share / lapack / blas / zherk.lisp
blobbdc8eedd5e7bfc8256ae04a6c704e04902848bf3
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* ((one 1.0) (zero 0.0))
21 (declare (type (double-float 1.0 1.0) one)
22 (type (double-float 0.0 0.0) zero)
23 (ignorable one zero))
24 (defun zherk (uplo trans n k alpha a lda beta c ldc)
25 (declare (type (array f2cl-lib:complex16 (*)) c a)
26 (type (double-float) beta alpha)
27 (type (f2cl-lib:integer4) ldc lda k n)
28 (type (simple-string *) trans uplo))
29 (f2cl-lib:with-multi-array-data
30 ((uplo character uplo-%data% uplo-%offset%)
31 (trans character trans-%data% trans-%offset%)
32 (a f2cl-lib:complex16 a-%data% a-%offset%)
33 (c f2cl-lib:complex16 c-%data% c-%offset%))
34 (prog ((temp #C(0.0 0.0)) (rtemp 0.0) (i 0) (info 0) (j 0) (l 0)
35 (nrowa 0) (upper nil))
36 (declare (type (f2cl-lib:complex16) temp)
37 (type (double-float) rtemp)
38 (type (f2cl-lib:integer4) i info j l nrowa)
39 (type f2cl-lib:logical upper))
40 (cond
41 ((lsame trans "N")
42 (setf nrowa n))
44 (setf nrowa k)))
45 (setf upper (lsame uplo "U"))
46 (setf info 0)
47 (cond
48 ((and (not upper) (not (lsame uplo "L")))
49 (setf info 1))
50 ((and (not (lsame trans "N")) (not (lsame trans "C")))
51 (setf info 2))
52 ((< n 0)
53 (setf info 3))
54 ((< k 0)
55 (setf info 4))
56 ((< lda (max (the f2cl-lib:integer4 1) (the f2cl-lib:integer4 nrowa)))
57 (setf info 7))
58 ((< ldc (max (the f2cl-lib:integer4 1) (the f2cl-lib:integer4 n)))
59 (setf info 10)))
60 (cond
61 ((/= info 0)
62 (xerbla "ZHERK " info)
63 (go end_label)))
64 (if (or (= n 0) (and (or (= alpha zero) (= k 0)) (= beta one)))
65 (go end_label))
66 (cond
67 ((= alpha zero)
68 (cond
69 (upper
70 (cond
71 ((= beta zero)
72 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
73 ((> j n) nil)
74 (tagbody
75 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
76 ((> i j) nil)
77 (tagbody
78 (setf (f2cl-lib:fref c-%data%
79 (i j)
80 ((1 ldc) (1 *))
81 c-%offset%)
82 (coerce zero 'f2cl-lib:complex16))
83 label10))
84 label20)))
86 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
87 ((> j n) nil)
88 (tagbody
89 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
90 ((> i
91 (f2cl-lib:int-add j
92 (f2cl-lib:int-sub 1)))
93 nil)
94 (tagbody
95 (setf (f2cl-lib:fref c-%data%
96 (i j)
97 ((1 ldc) (1 *))
98 c-%offset%)
99 (* beta
100 (f2cl-lib:fref c-%data%
101 (i j)
102 ((1 ldc) (1 *))
103 c-%offset%)))
104 label30))
105 (setf (f2cl-lib:fref c-%data%
106 (j j)
107 ((1 ldc) (1 *))
108 c-%offset%)
109 (coerce
110 (* beta
111 (f2cl-lib:dble
112 (f2cl-lib:fref c-%data%
113 (j j)
114 ((1 ldc) (1 *))
115 c-%offset%)))
116 'f2cl-lib:complex16))
117 label40)))))
119 (cond
120 ((= beta zero)
121 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
122 ((> j n) nil)
123 (tagbody
124 (f2cl-lib:fdo (i j (f2cl-lib:int-add i 1))
125 ((> i n) nil)
126 (tagbody
127 (setf (f2cl-lib:fref c-%data%
128 (i j)
129 ((1 ldc) (1 *))
130 c-%offset%)
131 (coerce zero 'f2cl-lib:complex16))
132 label50))
133 label60)))
135 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
136 ((> j n) nil)
137 (tagbody
138 (setf (f2cl-lib:fref c-%data%
139 (j j)
140 ((1 ldc) (1 *))
141 c-%offset%)
142 (coerce
143 (* beta
144 (f2cl-lib:dble
145 (f2cl-lib:fref c-%data%
146 (j j)
147 ((1 ldc) (1 *))
148 c-%offset%)))
149 'f2cl-lib:complex16))
150 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
151 (f2cl-lib:int-add i 1))
152 ((> i n) nil)
153 (tagbody
154 (setf (f2cl-lib:fref c-%data%
155 (i j)
156 ((1 ldc) (1 *))
157 c-%offset%)
158 (* beta
159 (f2cl-lib:fref c-%data%
160 (i j)
161 ((1 ldc) (1 *))
162 c-%offset%)))
163 label70))
164 label80))))))
165 (go end_label)))
166 (cond
167 ((lsame trans "N")
168 (cond
169 (upper
170 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
171 ((> j n) nil)
172 (tagbody
173 (cond
174 ((= beta zero)
175 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
176 ((> i j) nil)
177 (tagbody
178 (setf (f2cl-lib:fref c-%data%
179 (i j)
180 ((1 ldc) (1 *))
181 c-%offset%)
182 (coerce zero 'f2cl-lib:complex16))
183 label90)))
184 ((/= beta one)
185 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
186 ((> i
187 (f2cl-lib:int-add j
188 (f2cl-lib:int-sub 1)))
189 nil)
190 (tagbody
191 (setf (f2cl-lib:fref c-%data%
192 (i j)
193 ((1 ldc) (1 *))
194 c-%offset%)
195 (* beta
196 (f2cl-lib:fref c-%data%
197 (i j)
198 ((1 ldc) (1 *))
199 c-%offset%)))
200 label100))
201 (setf (f2cl-lib:fref c-%data%
202 (j j)
203 ((1 ldc) (1 *))
204 c-%offset%)
205 (coerce
206 (* beta
207 (f2cl-lib:dble
208 (f2cl-lib:fref c-%data%
209 (j j)
210 ((1 ldc) (1 *))
211 c-%offset%)))
212 'f2cl-lib:complex16)))
214 (setf (f2cl-lib:fref c-%data%
215 (j j)
216 ((1 ldc) (1 *))
217 c-%offset%)
218 (coerce
219 (f2cl-lib:dble
220 (f2cl-lib:fref c-%data%
221 (j j)
222 ((1 ldc) (1 *))
223 c-%offset%))
224 'f2cl-lib:complex16))))
225 (f2cl-lib:fdo (l 1 (f2cl-lib:int-add l 1))
226 ((> l k) nil)
227 (tagbody
228 (cond
229 ((/= (f2cl-lib:fref a (j l) ((1 lda) (1 *)))
230 (f2cl-lib:dcmplx zero))
231 (setf temp
232 (coerce
233 (* alpha
234 (f2cl-lib:dconjg
235 (f2cl-lib:fref a-%data%
236 (j l)
237 ((1 lda) (1 *))
238 a-%offset%)))
239 'f2cl-lib:complex16))
240 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
241 ((> i
242 (f2cl-lib:int-add j
243 (f2cl-lib:int-sub
244 1)))
245 nil)
246 (tagbody
247 (setf (f2cl-lib:fref c-%data%
248 (i j)
249 ((1 ldc) (1 *))
250 c-%offset%)
252 (f2cl-lib:fref c-%data%
253 (i j)
254 ((1 ldc) (1 *))
255 c-%offset%)
256 (* temp
257 (f2cl-lib:fref a-%data%
258 (i l)
259 ((1 lda) (1 *))
260 a-%offset%))))
261 label110))
262 (setf (f2cl-lib:fref c-%data%
263 (j j)
264 ((1 ldc) (1 *))
265 c-%offset%)
266 (coerce
268 (f2cl-lib:dble
269 (f2cl-lib:fref c-%data%
270 (j j)
271 ((1 ldc) (1 *))
272 c-%offset%))
273 (f2cl-lib:dble
274 (* temp
275 (f2cl-lib:fref a-%data%
276 (i l)
277 ((1 lda) (1 *))
278 a-%offset%))))
279 'f2cl-lib:complex16))))
280 label120))
281 label130)))
283 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
284 ((> j n) nil)
285 (tagbody
286 (cond
287 ((= beta zero)
288 (f2cl-lib:fdo (i j (f2cl-lib:int-add i 1))
289 ((> i n) nil)
290 (tagbody
291 (setf (f2cl-lib:fref c-%data%
292 (i j)
293 ((1 ldc) (1 *))
294 c-%offset%)
295 (coerce zero 'f2cl-lib:complex16))
296 label140)))
297 ((/= beta one)
298 (setf (f2cl-lib:fref c-%data%
299 (j j)
300 ((1 ldc) (1 *))
301 c-%offset%)
302 (coerce
303 (* beta
304 (f2cl-lib:dble
305 (f2cl-lib:fref c-%data%
306 (j j)
307 ((1 ldc) (1 *))
308 c-%offset%)))
309 'f2cl-lib:complex16))
310 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
311 (f2cl-lib:int-add i 1))
312 ((> i n) nil)
313 (tagbody
314 (setf (f2cl-lib:fref c-%data%
315 (i j)
316 ((1 ldc) (1 *))
317 c-%offset%)
318 (* beta
319 (f2cl-lib:fref c-%data%
320 (i j)
321 ((1 ldc) (1 *))
322 c-%offset%)))
323 label150)))
325 (setf (f2cl-lib:fref c-%data%
326 (j j)
327 ((1 ldc) (1 *))
328 c-%offset%)
329 (coerce
330 (f2cl-lib:dble
331 (f2cl-lib:fref c-%data%
332 (j j)
333 ((1 ldc) (1 *))
334 c-%offset%))
335 'f2cl-lib:complex16))))
336 (f2cl-lib:fdo (l 1 (f2cl-lib:int-add l 1))
337 ((> l k) nil)
338 (tagbody
339 (cond
340 ((/= (f2cl-lib:fref a (j l) ((1 lda) (1 *)))
341 (f2cl-lib:dcmplx zero))
342 (setf temp
343 (coerce
344 (* alpha
345 (f2cl-lib:dconjg
346 (f2cl-lib:fref a-%data%
347 (j l)
348 ((1 lda) (1 *))
349 a-%offset%)))
350 'f2cl-lib:complex16))
351 (setf (f2cl-lib:fref c-%data%
352 (j j)
353 ((1 ldc) (1 *))
354 c-%offset%)
355 (coerce
357 (f2cl-lib:dble
358 (f2cl-lib:fref c-%data%
359 (j j)
360 ((1 ldc) (1 *))
361 c-%offset%))
362 (f2cl-lib:dble
363 (* temp
364 (f2cl-lib:fref a-%data%
365 (j l)
366 ((1 lda) (1 *))
367 a-%offset%))))
368 'f2cl-lib:complex16))
369 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
370 (f2cl-lib:int-add i 1))
371 ((> i n) nil)
372 (tagbody
373 (setf (f2cl-lib:fref c-%data%
374 (i j)
375 ((1 ldc) (1 *))
376 c-%offset%)
378 (f2cl-lib:fref c-%data%
379 (i j)
380 ((1 ldc) (1 *))
381 c-%offset%)
382 (* temp
383 (f2cl-lib:fref a-%data%
384 (i l)
385 ((1 lda) (1 *))
386 a-%offset%))))
387 label160))))
388 label170))
389 label180)))))
391 (cond
392 (upper
393 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
394 ((> j n) nil)
395 (tagbody
396 (f2cl-lib:fdo (i 1 (f2cl-lib:int-add i 1))
397 ((> i
398 (f2cl-lib:int-add j (f2cl-lib:int-sub 1)))
399 nil)
400 (tagbody
401 (setf temp (coerce zero 'f2cl-lib:complex16))
402 (f2cl-lib:fdo (l 1 (f2cl-lib:int-add l 1))
403 ((> l k) nil)
404 (tagbody
405 (setf temp
406 (+ temp
408 (f2cl-lib:dconjg
409 (f2cl-lib:fref a-%data%
410 (l i)
411 ((1 lda) (1 *))
412 a-%offset%))
413 (f2cl-lib:fref a-%data%
414 (l j)
415 ((1 lda) (1 *))
416 a-%offset%))))
417 label190))
418 (cond
419 ((= beta zero)
420 (setf (f2cl-lib:fref c-%data%
421 (i j)
422 ((1 ldc) (1 *))
423 c-%offset%)
424 (* alpha temp)))
426 (setf (f2cl-lib:fref c-%data%
427 (i j)
428 ((1 ldc) (1 *))
429 c-%offset%)
430 (+ (* alpha temp)
431 (* beta
432 (f2cl-lib:fref c-%data%
433 (i j)
434 ((1 ldc) (1 *))
435 c-%offset%))))))
436 label200))
437 (setf rtemp zero)
438 (f2cl-lib:fdo (l 1 (f2cl-lib:int-add l 1))
439 ((> l k) nil)
440 (tagbody
441 (setf rtemp
442 (coerce
443 (realpart
444 (+ rtemp
446 (f2cl-lib:dconjg
447 (f2cl-lib:fref a-%data%
448 (l j)
449 ((1 lda) (1 *))
450 a-%offset%))
451 (f2cl-lib:fref a-%data%
452 (l j)
453 ((1 lda) (1 *))
454 a-%offset%))))
455 'double-float))
456 label210))
457 (cond
458 ((= beta zero)
459 (setf (f2cl-lib:fref c-%data%
460 (j j)
461 ((1 ldc) (1 *))
462 c-%offset%)
463 (coerce (* alpha rtemp) 'f2cl-lib:complex16)))
465 (setf (f2cl-lib:fref c-%data%
466 (j j)
467 ((1 ldc) (1 *))
468 c-%offset%)
469 (coerce
470 (+ (* alpha rtemp)
471 (* beta
472 (f2cl-lib:dble
473 (f2cl-lib:fref c-%data%
474 (j j)
475 ((1 ldc) (1 *))
476 c-%offset%))))
477 'f2cl-lib:complex16))))
478 label220)))
480 (f2cl-lib:fdo (j 1 (f2cl-lib:int-add j 1))
481 ((> j n) nil)
482 (tagbody
483 (setf rtemp zero)
484 (f2cl-lib:fdo (l 1 (f2cl-lib:int-add l 1))
485 ((> l k) nil)
486 (tagbody
487 (setf rtemp
488 (coerce
489 (realpart
490 (+ rtemp
492 (f2cl-lib:dconjg
493 (f2cl-lib:fref a-%data%
494 (l j)
495 ((1 lda) (1 *))
496 a-%offset%))
497 (f2cl-lib:fref a-%data%
498 (l j)
499 ((1 lda) (1 *))
500 a-%offset%))))
501 'double-float))
502 label230))
503 (cond
504 ((= beta zero)
505 (setf (f2cl-lib:fref c-%data%
506 (j j)
507 ((1 ldc) (1 *))
508 c-%offset%)
509 (coerce (* alpha rtemp) 'f2cl-lib:complex16)))
511 (setf (f2cl-lib:fref c-%data%
512 (j j)
513 ((1 ldc) (1 *))
514 c-%offset%)
515 (coerce
516 (+ (* alpha rtemp)
517 (* beta
518 (f2cl-lib:dble
519 (f2cl-lib:fref c-%data%
520 (j j)
521 ((1 ldc) (1 *))
522 c-%offset%))))
523 'f2cl-lib:complex16))))
524 (f2cl-lib:fdo (i (f2cl-lib:int-add j 1)
525 (f2cl-lib:int-add i 1))
526 ((> i n) nil)
527 (tagbody
528 (setf temp (coerce zero 'f2cl-lib:complex16))
529 (f2cl-lib:fdo (l 1 (f2cl-lib:int-add l 1))
530 ((> l k) nil)
531 (tagbody
532 (setf temp
533 (+ temp
535 (f2cl-lib:dconjg
536 (f2cl-lib:fref a-%data%
537 (l i)
538 ((1 lda) (1 *))
539 a-%offset%))
540 (f2cl-lib:fref a-%data%
541 (l j)
542 ((1 lda) (1 *))
543 a-%offset%))))
544 label240))
545 (cond
546 ((= beta zero)
547 (setf (f2cl-lib:fref c-%data%
548 (i j)
549 ((1 ldc) (1 *))
550 c-%offset%)
551 (* alpha temp)))
553 (setf (f2cl-lib:fref c-%data%
554 (i j)
555 ((1 ldc) (1 *))
556 c-%offset%)
557 (+ (* alpha temp)
558 (* beta
559 (f2cl-lib:fref c-%data%
560 (i j)
561 ((1 ldc) (1 *))
562 c-%offset%))))))
563 label250))
564 label260))))))
565 (go end_label)
566 end_label
567 (return (values nil nil nil nil nil nil nil nil nil nil))))))
569 (in-package #-gcl #:cl-user #+gcl "CL-USER")
570 #+#.(cl:if (cl:find-package '#:f2cl) '(and) '(or))
571 (eval-when (:load-toplevel :compile-toplevel :execute)
572 (setf (gethash 'fortran-to-lisp::zherk fortran-to-lisp::*f2cl-function-info*)
573 (fortran-to-lisp::make-f2cl-finfo
574 :arg-types '((simple-string) (simple-string)
575 (fortran-to-lisp::integer4) (fortran-to-lisp::integer4)
576 (double-float) (array fortran-to-lisp::complex16 (*))
577 (fortran-to-lisp::integer4) (double-float)
578 (array fortran-to-lisp::complex16 (*))
579 (fortran-to-lisp::integer4))
580 :return-values '(nil nil nil nil nil nil nil nil nil nil)
581 :calls '(fortran-to-lisp::xerbla fortran-to-lisp::lsame))))