Debian Codegraph @

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

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