Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/zsymm.c

raw
1 /* ./src_f77/zsymm.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 /* Subroutine */ int zsymm_(char *side, char *uplo, integer *m, integer *n,
9 doublecomplex *alpha, doublecomplex *a, integer *lda, doublecomplex *
10 b, integer *ldb, doublecomplex *beta, doublecomplex *c__, integer *
11 ldc, ftnlen side_len, ftnlen uplo_len)
12 {
13 /* System generated locals */
14 integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
15 i__3, i__4, i__5, i__6;
16 doublecomplex z__1, z__2, z__3, z__4, z__5;
17
18 /* Local variables */
19 static integer i__, j, k, info;
20 static doublecomplex temp1, temp2;
21 extern logical lsame_(char *, char *, ftnlen, ftnlen);
22 static integer nrowa;
23 static logical upper;
24 extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
25
26 /* .. Scalar Arguments .. */
27 /* .. Array Arguments .. */
28 /* .. */
29
30 /* Purpose */
31 /* ======= */
32
33 /* ZSYMM performs one of the matrix-matrix operations */
34
35 /* C := alpha*A*B + beta*C, */
36
37 /* or */
38
39 /* C := alpha*B*A + beta*C, */
40
41 /* where alpha and beta are scalars, A is a symmetric matrix and B and */
42 /* C are m by n matrices. */
43
44 /* Parameters */
45 /* ========== */
46
47 /* SIDE - CHARACTER*1. */
48 /* On entry, SIDE specifies whether the symmetric matrix A */
49 /* appears on the left or right in the operation as follows: */
50
51 /* SIDE = 'L' or 'l' C := alpha*A*B + beta*C, */
52
53 /* SIDE = 'R' or 'r' C := alpha*B*A + beta*C, */
54
55 /* Unchanged on exit. */
56
57 /* UPLO - CHARACTER*1. */
58 /* On entry, UPLO specifies whether the upper or lower */
59 /* triangular part of the symmetric matrix A is to be */
60 /* referenced as follows: */
61
62 /* UPLO = 'U' or 'u' Only the upper triangular part of the */
63 /* symmetric matrix is to be referenced. */
64
65 /* UPLO = 'L' or 'l' Only the lower triangular part of the */
66 /* symmetric matrix is to be referenced. */
67
68 /* Unchanged on exit. */
69
70 /* M - INTEGER. */
71 /* On entry, M specifies the number of rows of the matrix C. */
72 /* M must be at least zero. */
73 /* Unchanged on exit. */
74
75 /* N - INTEGER. */
76 /* On entry, N specifies the number of columns of the matrix C. */
77 /* N must be at least zero. */
78 /* Unchanged on exit. */
79
80 /* ALPHA - COMPLEX*16 . */
81 /* On entry, ALPHA specifies the scalar alpha. */
82 /* Unchanged on exit. */
83
84 /* A - COMPLEX*16 array of DIMENSION ( LDA, ka ), where ka is */
85 /* m when SIDE = 'L' or 'l' and is n otherwise. */
86 /* Before entry with SIDE = 'L' or 'l', the m by m part of */
87 /* the array A must contain the symmetric matrix, such that */
88 /* when UPLO = 'U' or 'u', the leading m by m upper triangular */
89 /* part of the array A must contain the upper triangular part */
90 /* of the symmetric matrix and the strictly lower triangular */
91 /* part of A is not referenced, and when UPLO = 'L' or 'l', */
92 /* the leading m by m lower triangular part of the array A */
93 /* must contain the lower triangular part of the symmetric */
94 /* matrix and the strictly upper triangular part of A is not */
95 /* referenced. */
96 /* Before entry with SIDE = 'R' or 'r', the n by n part of */
97 /* the array A must contain the symmetric matrix, such that */
98 /* when UPLO = 'U' or 'u', the leading n by n upper triangular */
99 /* part of the array A must contain the upper triangular part */
100 /* of the symmetric matrix and the strictly lower triangular */
101 /* part of A is not referenced, and when UPLO = 'L' or 'l', */
102 /* the leading n by n lower triangular part of the array A */
103 /* must contain the lower triangular part of the symmetric */
104 /* matrix and the strictly upper triangular part of A is not */
105 /* referenced. */
106 /* Unchanged on exit. */
107
108 /* LDA - INTEGER. */
109 /* On entry, LDA specifies the first dimension of A as declared */
110 /* in the calling (sub) program. When SIDE = 'L' or 'l' then */
111 /* LDA must be at least max( 1, m ), otherwise LDA must be at */
112 /* least max( 1, n ). */
113 /* Unchanged on exit. */
114
115 /* B - COMPLEX*16 array of DIMENSION ( LDB, n ). */
116 /* Before entry, the leading m by n part of the array B must */
117 /* contain the matrix B. */
118 /* Unchanged on exit. */
119
120 /* LDB - INTEGER. */
121 /* On entry, LDB specifies the first dimension of B as declared */
122 /* in the calling (sub) program. LDB must be at least */
123 /* max( 1, m ). */
124 /* Unchanged on exit. */
125
126 /* BETA - COMPLEX*16 . */
127 /* On entry, BETA specifies the scalar beta. When BETA is */
128 /* supplied as zero then C need not be set on input. */
129 /* Unchanged on exit. */
130
131 /* C - COMPLEX*16 array of DIMENSION ( LDC, n ). */
132 /* Before entry, the leading m by n part of the array C must */
133 /* contain the matrix C, except when beta is zero, in which */
134 /* case C need not be set on entry. */
135 /* On exit, the array C is overwritten by the m by n updated */
136 /* matrix. */
137
138 /* LDC - INTEGER. */
139 /* On entry, LDC specifies the first dimension of C as declared */
140 /* in the calling (sub) program. LDC must be at least */
141 /* max( 1, m ). */
142 /* Unchanged on exit. */
143
144
145 /* Level 3 Blas routine. */
146
147 /* -- Written on 8-February-1989. */
148 /* Jack Dongarra, Argonne National Laboratory. */
149 /* Iain Duff, AERE Harwell. */
150 /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
151 /* Sven Hammarling, Numerical Algorithms Group Ltd. */
152
153
154 /* .. External Functions .. */
155 /* .. External Subroutines .. */
156 /* .. Intrinsic Functions .. */
157 /* .. Local Scalars .. */
158 /* .. Parameters .. */
159 /* .. */
160 /* .. Executable Statements .. */
161
162 /* Set NROWA as the number of rows of A. */
163
164 /* Parameter adjustments */
165 a_dim1 = *lda;
166 a_offset = 1 + a_dim1;
167 a -= a_offset;
168 b_dim1 = *ldb;
169 b_offset = 1 + b_dim1;
170 b -= b_offset;
171 c_dim1 = *ldc;
172 c_offset = 1 + c_dim1;
173 c__ -= c_offset;
174
175 /* Function Body */
176 if (lsame_(side, "L", (ftnlen)1, (ftnlen)1)) {
177 nrowa = *m;
178 } else {
179 nrowa = *n;
180 }
181 upper = lsame_(uplo, "U", (ftnlen)1, (ftnlen)1);
182
183 /* Test the input parameters. */
184
185 info = 0;
186 if (! lsame_(side, "L", (ftnlen)1, (ftnlen)1) && ! lsame_(side, "R", (
187 ftnlen)1, (ftnlen)1)) {
188 info = 1;
189 } else if (! upper && ! lsame_(uplo, "L", (ftnlen)1, (ftnlen)1)) {
190 info = 2;
191 } else if (*m < 0) {
192 info = 3;
193 } else if (*n < 0) {
194 info = 4;
195 } else if (*lda < max(1,nrowa)) {
196 info = 7;
197 } else if (*ldb < max(1,*m)) {
198 info = 9;
199 } else if (*ldc < max(1,*m)) {
200 info = 12;
201 }
202 if (info != 0) {
203 xerbla_("ZSYMM ", &info, (ftnlen)6);
204 return 0;
205 }
206
207 /* Quick return if possible. */
208
209 if (*m == 0 || *n == 0 || alpha->r == 0. && alpha->i == 0. && (beta->r ==
210 1. && beta->i == 0.)) {
211 return 0;
212 }
213
214 /* And when alpha.eq.zero. */
215
216 if (alpha->r == 0. && alpha->i == 0.) {
217 if (beta->r == 0. && beta->i == 0.) {
218 i__1 = *n;
219 for (j = 1; j <= i__1; ++j) {
220 i__2 = *m;
221 for (i__ = 1; i__ <= i__2; ++i__) {
222 i__3 = i__ + j * c_dim1;
223 c__[i__3].r = 0., c__[i__3].i = 0.;
224 /* L10: */
225 }
226 /* L20: */
227 }
228 } else {
229 i__1 = *n;
230 for (j = 1; j <= i__1; ++j) {
231 i__2 = *m;
232 for (i__ = 1; i__ <= i__2; ++i__) {
233 i__3 = i__ + j * c_dim1;
234 i__4 = i__ + j * c_dim1;
235 z__1.r = beta->r * c__[i__4].r - beta->i * c__[i__4].i,
236 z__1.i = beta->r * c__[i__4].i + beta->i * c__[
237 i__4].r;
238 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
239 /* L30: */
240 }
241 /* L40: */
242 }
243 }
244 return 0;
245 }
246
247 /* Start the operations. */
248
249 if (lsame_(side, "L", (ftnlen)1, (ftnlen)1)) {
250
251 /* Form C := alpha*A*B + beta*C. */
252
253 if (upper) {
254 i__1 = *n;
255 for (j = 1; j <= i__1; ++j) {
256 i__2 = *m;
257 for (i__ = 1; i__ <= i__2; ++i__) {
258 i__3 = i__ + j * b_dim1;
259 z__1.r = alpha->r * b[i__3].r - alpha->i * b[i__3].i,
260 z__1.i = alpha->r * b[i__3].i + alpha->i * b[i__3]
261 .r;
262 temp1.r = z__1.r, temp1.i = z__1.i;
263 temp2.r = 0., temp2.i = 0.;
264 i__3 = i__ - 1;
265 for (k = 1; k <= i__3; ++k) {
266 i__4 = k + j * c_dim1;
267 i__5 = k + j * c_dim1;
268 i__6 = k + i__ * a_dim1;
269 z__2.r = temp1.r * a[i__6].r - temp1.i * a[i__6].i,
270 z__2.i = temp1.r * a[i__6].i + temp1.i * a[
271 i__6].r;
272 z__1.r = c__[i__5].r + z__2.r, z__1.i = c__[i__5].i +
273 z__2.i;
274 c__[i__4].r = z__1.r, c__[i__4].i = z__1.i;
275 i__4 = k + j * b_dim1;
276 i__5 = k + i__ * a_dim1;
277 z__2.r = b[i__4].r * a[i__5].r - b[i__4].i * a[i__5]
278 .i, z__2.i = b[i__4].r * a[i__5].i + b[i__4]
279 .i * a[i__5].r;
280 z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
281 temp2.r = z__1.r, temp2.i = z__1.i;
282 /* L50: */
283 }
284 if (beta->r == 0. && beta->i == 0.) {
285 i__3 = i__ + j * c_dim1;
286 i__4 = i__ + i__ * a_dim1;
287 z__2.r = temp1.r * a[i__4].r - temp1.i * a[i__4].i,
288 z__2.i = temp1.r * a[i__4].i + temp1.i * a[
289 i__4].r;
290 z__3.r = alpha->r * temp2.r - alpha->i * temp2.i,
291 z__3.i = alpha->r * temp2.i + alpha->i *
292 temp2.r;
293 z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
294 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
295 } else {
296 i__3 = i__ + j * c_dim1;
297 i__4 = i__ + j * c_dim1;
298 z__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
299 .i, z__3.i = beta->r * c__[i__4].i + beta->i *
300 c__[i__4].r;
301 i__5 = i__ + i__ * a_dim1;
302 z__4.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
303 z__4.i = temp1.r * a[i__5].i + temp1.i * a[
304 i__5].r;
305 z__2.r = z__3.r + z__4.r, z__2.i = z__3.i + z__4.i;
306 z__5.r = alpha->r * temp2.r - alpha->i * temp2.i,
307 z__5.i = alpha->r * temp2.i + alpha->i *
308 temp2.r;
309 z__1.r = z__2.r + z__5.r, z__1.i = z__2.i + z__5.i;
310 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
311 }
312 /* L60: */
313 }
314 /* L70: */
315 }
316 } else {
317 i__1 = *n;
318 for (j = 1; j <= i__1; ++j) {
319 for (i__ = *m; i__ >= 1; --i__) {
320 i__2 = i__ + j * b_dim1;
321 z__1.r = alpha->r * b[i__2].r - alpha->i * b[i__2].i,
322 z__1.i = alpha->r * b[i__2].i + alpha->i * b[i__2]
323 .r;
324 temp1.r = z__1.r, temp1.i = z__1.i;
325 temp2.r = 0., temp2.i = 0.;
326 i__2 = *m;
327 for (k = i__ + 1; k <= i__2; ++k) {
328 i__3 = k + j * c_dim1;
329 i__4 = k + j * c_dim1;
330 i__5 = k + i__ * a_dim1;
331 z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
332 z__2.i = temp1.r * a[i__5].i + temp1.i * a[
333 i__5].r;
334 z__1.r = c__[i__4].r + z__2.r, z__1.i = c__[i__4].i +
335 z__2.i;
336 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
337 i__3 = k + j * b_dim1;
338 i__4 = k + i__ * a_dim1;
339 z__2.r = b[i__3].r * a[i__4].r - b[i__3].i * a[i__4]
340 .i, z__2.i = b[i__3].r * a[i__4].i + b[i__3]
341 .i * a[i__4].r;
342 z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
343 temp2.r = z__1.r, temp2.i = z__1.i;
344 /* L80: */
345 }
346 if (beta->r == 0. && beta->i == 0.) {
347 i__2 = i__ + j * c_dim1;
348 i__3 = i__ + i__ * a_dim1;
349 z__2.r = temp1.r * a[i__3].r - temp1.i * a[i__3].i,
350 z__2.i = temp1.r * a[i__3].i + temp1.i * a[
351 i__3].r;
352 z__3.r = alpha->r * temp2.r - alpha->i * temp2.i,
353 z__3.i = alpha->r * temp2.i + alpha->i *
354 temp2.r;
355 z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
356 c__[i__2].r = z__1.r, c__[i__2].i = z__1.i;
357 } else {
358 i__2 = i__ + j * c_dim1;
359 i__3 = i__ + j * c_dim1;
360 z__3.r = beta->r * c__[i__3].r - beta->i * c__[i__3]
361 .i, z__3.i = beta->r * c__[i__3].i + beta->i *
362 c__[i__3].r;
363 i__4 = i__ + i__ * a_dim1;
364 z__4.r = temp1.r * a[i__4].r - temp1.i * a[i__4].i,
365 z__4.i = temp1.r * a[i__4].i + temp1.i * a[
366 i__4].r;
367 z__2.r = z__3.r + z__4.r, z__2.i = z__3.i + z__4.i;
368 z__5.r = alpha->r * temp2.r - alpha->i * temp2.i,
369 z__5.i = alpha->r * temp2.i + alpha->i *
370 temp2.r;
371 z__1.r = z__2.r + z__5.r, z__1.i = z__2.i + z__5.i;
372 c__[i__2].r = z__1.r, c__[i__2].i = z__1.i;
373 }
374 /* L90: */
375 }
376 /* L100: */
377 }
378 }
379 } else {
380
381 /* Form C := alpha*B*A + beta*C. */
382
383 i__1 = *n;
384 for (j = 1; j <= i__1; ++j) {
385 i__2 = j + j * a_dim1;
386 z__1.r = alpha->r * a[i__2].r - alpha->i * a[i__2].i, z__1.i =
387 alpha->r * a[i__2].i + alpha->i * a[i__2].r;
388 temp1.r = z__1.r, temp1.i = z__1.i;
389 if (beta->r == 0. && beta->i == 0.) {
390 i__2 = *m;
391 for (i__ = 1; i__ <= i__2; ++i__) {
392 i__3 = i__ + j * c_dim1;
393 i__4 = i__ + j * b_dim1;
394 z__1.r = temp1.r * b[i__4].r - temp1.i * b[i__4].i,
395 z__1.i = temp1.r * b[i__4].i + temp1.i * b[i__4]
396 .r;
397 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
398 /* L110: */
399 }
400 } else {
401 i__2 = *m;
402 for (i__ = 1; i__ <= i__2; ++i__) {
403 i__3 = i__ + j * c_dim1;
404 i__4 = i__ + j * c_dim1;
405 z__2.r = beta->r * c__[i__4].r - beta->i * c__[i__4].i,
406 z__2.i = beta->r * c__[i__4].i + beta->i * c__[
407 i__4].r;
408 i__5 = i__ + j * b_dim1;
409 z__3.r = temp1.r * b[i__5].r - temp1.i * b[i__5].i,
410 z__3.i = temp1.r * b[i__5].i + temp1.i * b[i__5]
411 .r;
412 z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
413 c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
414 /* L120: */
415 }
416 }
417 i__2 = j - 1;
418 for (k = 1; k <= i__2; ++k) {
419 if (upper) {
420 i__3 = k + j * a_dim1;
421 z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i,
422 z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
423 .r;
424 temp1.r = z__1.r, temp1.i = z__1.i;
425 } else {
426 i__3 = j + k * a_dim1;
427 z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i,
428 z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
429 .r;
430 temp1.r = z__1.r, temp1.i = z__1.i;
431 }
432 i__3 = *m;
433 for (i__ = 1; i__ <= i__3; ++i__) {
434 i__4 = i__ + j * c_dim1;
435 i__5 = i__ + j * c_dim1;
436 i__6 = i__ + k * b_dim1;
437 z__2.r = temp1.r * b[i__6].r - temp1.i * b[i__6].i,
438 z__2.i = temp1.r * b[i__6].i + temp1.i * b[i__6]
439 .r;
440 z__1.r = c__[i__5].r + z__2.r, z__1.i = c__[i__5].i +
441 z__2.i;
442 c__[i__4].r = z__1.r, c__[i__4].i = z__1.i;
443 /* L130: */
444 }
445 /* L140: */
446 }
447 i__2 = *n;
448 for (k = j + 1; k <= i__2; ++k) {
449 if (upper) {
450 i__3 = j + k * a_dim1;
451 z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i,
452 z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
453 .r;
454 temp1.r = z__1.r, temp1.i = z__1.i;
455 } else {
456 i__3 = k + j * a_dim1;
457 z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i,
458 z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
459 .r;
460 temp1.r = z__1.r, temp1.i = z__1.i;
461 }
462 i__3 = *m;
463 for (i__ = 1; i__ <= i__3; ++i__) {
464 i__4 = i__ + j * c_dim1;
465 i__5 = i__ + j * c_dim1;
466 i__6 = i__ + k * b_dim1;
467 z__2.r = temp1.r * b[i__6].r - temp1.i * b[i__6].i,
468 z__2.i = temp1.r * b[i__6].i + temp1.i * b[i__6]
469 .r;
470 z__1.r = c__[i__5].r + z__2.r, z__1.i = c__[i__5].i +
471 z__2.i;
472 c__[i__4].r = z__1.r, c__[i__4].i = z__1.i;
473 /* L150: */
474 }
475 /* L160: */
476 }
477 /* L170: */
478 }
479 }
480
481 return 0;
482
483 /* End of ZSYMM . */
484
485 } /* zsymm_ */
486