Debian Codegraph @

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

raw
1 /* ./src_f77/ssymm.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 ssymm_(char *side, char *uplo, integer *m, integer *n,
9 real *alpha, real *a, integer *lda, real *b, integer *ldb, real *beta,
10 real *c__, integer *ldc, ftnlen side_len, ftnlen uplo_len)
11 {
12 /* System generated locals */
13 integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
14 i__3;
15
16 /* Local variables */
17 static integer i__, j, k, info;
18 static real temp1, temp2;
19 extern logical lsame_(char *, char *, ftnlen, ftnlen);
20 static integer nrowa;
21 static logical upper;
22 extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen);
23
24 /* .. Scalar Arguments .. */
25 /* .. Array Arguments .. */
26 /* .. */
27
28 /* Purpose */
29 /* ======= */
30
31 /* SSYMM performs one of the matrix-matrix operations */
32
33 /* C := alpha*A*B + beta*C, */
34
35 /* or */
36
37 /* C := alpha*B*A + beta*C, */
38
39 /* where alpha and beta are scalars, A is a symmetric matrix and B and */
40 /* C are m by n matrices. */
41
42 /* Parameters */
43 /* ========== */
44
45 /* SIDE - CHARACTER*1. */
46 /* On entry, SIDE specifies whether the symmetric matrix A */
47 /* appears on the left or right in the operation as follows: */
48
49 /* SIDE = 'L' or 'l' C := alpha*A*B + beta*C, */
50
51 /* SIDE = 'R' or 'r' C := alpha*B*A + beta*C, */
52
53 /* Unchanged on exit. */
54
55 /* UPLO - CHARACTER*1. */
56 /* On entry, UPLO specifies whether the upper or lower */
57 /* triangular part of the symmetric matrix A is to be */
58 /* referenced as follows: */
59
60 /* UPLO = 'U' or 'u' Only the upper triangular part of the */
61 /* symmetric matrix is to be referenced. */
62
63 /* UPLO = 'L' or 'l' Only the lower triangular part of the */
64 /* symmetric matrix is to be referenced. */
65
66 /* Unchanged on exit. */
67
68 /* M - INTEGER. */
69 /* On entry, M specifies the number of rows of the matrix C. */
70 /* M must be at least zero. */
71 /* Unchanged on exit. */
72
73 /* N - INTEGER. */
74 /* On entry, N specifies the number of columns of the matrix C. */
75 /* N must be at least zero. */
76 /* Unchanged on exit. */
77
78 /* ALPHA - REAL . */
79 /* On entry, ALPHA specifies the scalar alpha. */
80 /* Unchanged on exit. */
81
82 /* A - REAL array of DIMENSION ( LDA, ka ), where ka is */
83 /* m when SIDE = 'L' or 'l' and is n otherwise. */
84 /* Before entry with SIDE = 'L' or 'l', the m by m part of */
85 /* the array A must contain the symmetric matrix, such that */
86 /* when UPLO = 'U' or 'u', the leading m by m upper triangular */
87 /* part of the array A must contain the upper triangular part */
88 /* of the symmetric matrix and the strictly lower triangular */
89 /* part of A is not referenced, and when UPLO = 'L' or 'l', */
90 /* the leading m by m lower triangular part of the array A */
91 /* must contain the lower triangular part of the symmetric */
92 /* matrix and the strictly upper triangular part of A is not */
93 /* referenced. */
94 /* Before entry with SIDE = 'R' or 'r', the n by n part of */
95 /* the array A must contain the symmetric matrix, such that */
96 /* when UPLO = 'U' or 'u', the leading n by n upper triangular */
97 /* part of the array A must contain the upper triangular part */
98 /* of the symmetric matrix and the strictly lower triangular */
99 /* part of A is not referenced, and when UPLO = 'L' or 'l', */
100 /* the leading n by n lower triangular part of the array A */
101 /* must contain the lower triangular part of the symmetric */
102 /* matrix and the strictly upper triangular part of A is not */
103 /* referenced. */
104 /* Unchanged on exit. */
105
106 /* LDA - INTEGER. */
107 /* On entry, LDA specifies the first dimension of A as declared */
108 /* in the calling (sub) program. When SIDE = 'L' or 'l' then */
109 /* LDA must be at least max( 1, m ), otherwise LDA must be at */
110 /* least max( 1, n ). */
111 /* Unchanged on exit. */
112
113 /* B - REAL array of DIMENSION ( LDB, n ). */
114 /* Before entry, the leading m by n part of the array B must */
115 /* contain the matrix B. */
116 /* Unchanged on exit. */
117
118 /* LDB - INTEGER. */
119 /* On entry, LDB specifies the first dimension of B as declared */
120 /* in the calling (sub) program. LDB must be at least */
121 /* max( 1, m ). */
122 /* Unchanged on exit. */
123
124 /* BETA - REAL . */
125 /* On entry, BETA specifies the scalar beta. When BETA is */
126 /* supplied as zero then C need not be set on input. */
127 /* Unchanged on exit. */
128
129 /* C - REAL array of DIMENSION ( LDC, n ). */
130 /* Before entry, the leading m by n part of the array C must */
131 /* contain the matrix C, except when beta is zero, in which */
132 /* case C need not be set on entry. */
133 /* On exit, the array C is overwritten by the m by n updated */
134 /* matrix. */
135
136 /* LDC - INTEGER. */
137 /* On entry, LDC specifies the first dimension of C as declared */
138 /* in the calling (sub) program. LDC must be at least */
139 /* max( 1, m ). */
140 /* Unchanged on exit. */
141
142
143 /* Level 3 Blas routine. */
144
145 /* -- Written on 8-February-1989. */
146 /* Jack Dongarra, Argonne National Laboratory. */
147 /* Iain Duff, AERE Harwell. */
148 /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
149 /* Sven Hammarling, Numerical Algorithms Group Ltd. */
150
151
152 /* .. External Functions .. */
153 /* .. External Subroutines .. */
154 /* .. Intrinsic Functions .. */
155 /* .. Local Scalars .. */
156 /* .. Parameters .. */
157 /* .. */
158 /* .. Executable Statements .. */
159
160 /* Set NROWA as the number of rows of A. */
161
162 /* Parameter adjustments */
163 a_dim1 = *lda;
164 a_offset = 1 + a_dim1;
165 a -= a_offset;
166 b_dim1 = *ldb;
167 b_offset = 1 + b_dim1;
168 b -= b_offset;
169 c_dim1 = *ldc;
170 c_offset = 1 + c_dim1;
171 c__ -= c_offset;
172
173 /* Function Body */
174 if (lsame_(side, "L", (ftnlen)1, (ftnlen)1)) {
175 nrowa = *m;
176 } else {
177 nrowa = *n;
178 }
179 upper = lsame_(uplo, "U", (ftnlen)1, (ftnlen)1);
180
181 /* Test the input parameters. */
182
183 info = 0;
184 if (! lsame_(side, "L", (ftnlen)1, (ftnlen)1) && ! lsame_(side, "R", (
185 ftnlen)1, (ftnlen)1)) {
186 info = 1;
187 } else if (! upper && ! lsame_(uplo, "L", (ftnlen)1, (ftnlen)1)) {
188 info = 2;
189 } else if (*m < 0) {
190 info = 3;
191 } else if (*n < 0) {
192 info = 4;
193 } else if (*lda < max(1,nrowa)) {
194 info = 7;
195 } else if (*ldb < max(1,*m)) {
196 info = 9;
197 } else if (*ldc < max(1,*m)) {
198 info = 12;
199 }
200 if (info != 0) {
201 xerbla_("SSYMM ", &info, (ftnlen)6);
202 return 0;
203 }
204
205 /* Quick return if possible. */
206
207 if (*m == 0 || *n == 0 || *alpha == 0.f && *beta == 1.f) {
208 return 0;
209 }
210
211 /* And when alpha.eq.zero. */
212
213 if (*alpha == 0.f) {
214 if (*beta == 0.f) {
215 i__1 = *n;
216 for (j = 1; j <= i__1; ++j) {
217 i__2 = *m;
218 for (i__ = 1; i__ <= i__2; ++i__) {
219 c__[i__ + j * c_dim1] = 0.f;
220 /* L10: */
221 }
222 /* L20: */
223 }
224 } else {
225 i__1 = *n;
226 for (j = 1; j <= i__1; ++j) {
227 i__2 = *m;
228 for (i__ = 1; i__ <= i__2; ++i__) {
229 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
230 /* L30: */
231 }
232 /* L40: */
233 }
234 }
235 return 0;
236 }
237
238 /* Start the operations. */
239
240 if (lsame_(side, "L", (ftnlen)1, (ftnlen)1)) {
241
242 /* Form C := alpha*A*B + beta*C. */
243
244 if (upper) {
245 i__1 = *n;
246 for (j = 1; j <= i__1; ++j) {
247 i__2 = *m;
248 for (i__ = 1; i__ <= i__2; ++i__) {
249 temp1 = *alpha * b[i__ + j * b_dim1];
250 temp2 = 0.f;
251 i__3 = i__ - 1;
252 for (k = 1; k <= i__3; ++k) {
253 c__[k + j * c_dim1] += temp1 * a[k + i__ * a_dim1];
254 temp2 += b[k + j * b_dim1] * a[k + i__ * a_dim1];
255 /* L50: */
256 }
257 if (*beta == 0.f) {
258 c__[i__ + j * c_dim1] = temp1 * a[i__ + i__ * a_dim1]
259 + *alpha * temp2;
260 } else {
261 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1]
262 + temp1 * a[i__ + i__ * a_dim1] + *alpha *
263 temp2;
264 }
265 /* L60: */
266 }
267 /* L70: */
268 }
269 } else {
270 i__1 = *n;
271 for (j = 1; j <= i__1; ++j) {
272 for (i__ = *m; i__ >= 1; --i__) {
273 temp1 = *alpha * b[i__ + j * b_dim1];
274 temp2 = 0.f;
275 i__2 = *m;
276 for (k = i__ + 1; k <= i__2; ++k) {
277 c__[k + j * c_dim1] += temp1 * a[k + i__ * a_dim1];
278 temp2 += b[k + j * b_dim1] * a[k + i__ * a_dim1];
279 /* L80: */
280 }
281 if (*beta == 0.f) {
282 c__[i__ + j * c_dim1] = temp1 * a[i__ + i__ * a_dim1]
283 + *alpha * temp2;
284 } else {
285 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1]
286 + temp1 * a[i__ + i__ * a_dim1] + *alpha *
287 temp2;
288 }
289 /* L90: */
290 }
291 /* L100: */
292 }
293 }
294 } else {
295
296 /* Form C := alpha*B*A + beta*C. */
297
298 i__1 = *n;
299 for (j = 1; j <= i__1; ++j) {
300 temp1 = *alpha * a[j + j * a_dim1];
301 if (*beta == 0.f) {
302 i__2 = *m;
303 for (i__ = 1; i__ <= i__2; ++i__) {
304 c__[i__ + j * c_dim1] = temp1 * b[i__ + j * b_dim1];
305 /* L110: */
306 }
307 } else {
308 i__2 = *m;
309 for (i__ = 1; i__ <= i__2; ++i__) {
310 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1] +
311 temp1 * b[i__ + j * b_dim1];
312 /* L120: */
313 }
314 }
315 i__2 = j - 1;
316 for (k = 1; k <= i__2; ++k) {
317 if (upper) {
318 temp1 = *alpha * a[k + j * a_dim1];
319 } else {
320 temp1 = *alpha * a[j + k * a_dim1];
321 }
322 i__3 = *m;
323 for (i__ = 1; i__ <= i__3; ++i__) {
324 c__[i__ + j * c_dim1] += temp1 * b[i__ + k * b_dim1];
325 /* L130: */
326 }
327 /* L140: */
328 }
329 i__2 = *n;
330 for (k = j + 1; k <= i__2; ++k) {
331 if (upper) {
332 temp1 = *alpha * a[j + k * a_dim1];
333 } else {
334 temp1 = *alpha * a[k + j * a_dim1];
335 }
336 i__3 = *m;
337 for (i__ = 1; i__ <= i__3; ++i__) {
338 c__[i__ + j * c_dim1] += temp1 * b[i__ + k * b_dim1];
339 /* L150: */
340 }
341 /* L160: */
342 }
343 /* L170: */
344 }
345 }
346
347 return 0;
348
349 /* End of SSYMM . */
350
351 } /* ssymm_ */
352