Mercurial > hg > qm-dsp
comparison ext/cblas/src/dtrmm.c @ 430:335af74a25b6
Merge from branch clapack-included
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 30 Sep 2016 16:24:24 +0100 |
parents | 905e45637745 |
children |
comparison
equal
deleted
inserted
replaced
426:a23b9f8b4a59 | 430:335af74a25b6 |
---|---|
1 /* dtrmm.f -- translated by f2c (version 20061008). | |
2 You must link the resulting object file with libf2c: | |
3 on Microsoft Windows system, link with libf2c.lib; | |
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm | |
5 or, if you install libf2c.a in a standard place, with -lf2c -lm | |
6 -- in that order, at the end of the command line, as in | |
7 cc *.o -lf2c -lm | |
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., | |
9 | |
10 http://www.netlib.org/f2c/libf2c.zip | |
11 */ | |
12 | |
13 #include "f2c.h" | |
14 #include "blaswrap.h" | |
15 | |
16 /* Subroutine */ int dtrmm_(char *side, char *uplo, char *transa, char *diag, | |
17 integer *m, integer *n, doublereal *alpha, doublereal *a, integer * | |
18 lda, doublereal *b, integer *ldb) | |
19 { | |
20 /* System generated locals */ | |
21 integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3; | |
22 | |
23 /* Local variables */ | |
24 integer i__, j, k, info; | |
25 doublereal temp; | |
26 logical lside; | |
27 extern logical lsame_(char *, char *); | |
28 integer nrowa; | |
29 logical upper; | |
30 extern /* Subroutine */ int xerbla_(char *, integer *); | |
31 logical nounit; | |
32 | |
33 /* .. Scalar Arguments .. */ | |
34 /* .. */ | |
35 /* .. Array Arguments .. */ | |
36 /* .. */ | |
37 | |
38 /* Purpose */ | |
39 /* ======= */ | |
40 | |
41 /* DTRMM performs one of the matrix-matrix operations */ | |
42 | |
43 /* B := alpha*op( A )*B, or B := alpha*B*op( A ), */ | |
44 | |
45 /* where alpha is a scalar, B is an m by n matrix, A is a unit, or */ | |
46 /* non-unit, upper or lower triangular matrix and op( A ) is one of */ | |
47 | |
48 /* op( A ) = A or op( A ) = A'. */ | |
49 | |
50 /* Arguments */ | |
51 /* ========== */ | |
52 | |
53 /* SIDE - CHARACTER*1. */ | |
54 /* On entry, SIDE specifies whether op( A ) multiplies B from */ | |
55 /* the left or right as follows: */ | |
56 | |
57 /* SIDE = 'L' or 'l' B := alpha*op( A )*B. */ | |
58 | |
59 /* SIDE = 'R' or 'r' B := alpha*B*op( A ). */ | |
60 | |
61 /* Unchanged on exit. */ | |
62 | |
63 /* UPLO - CHARACTER*1. */ | |
64 /* On entry, UPLO specifies whether the matrix A is an upper or */ | |
65 /* lower triangular matrix as follows: */ | |
66 | |
67 /* UPLO = 'U' or 'u' A is an upper triangular matrix. */ | |
68 | |
69 /* UPLO = 'L' or 'l' A is a lower triangular matrix. */ | |
70 | |
71 /* Unchanged on exit. */ | |
72 | |
73 /* TRANSA - CHARACTER*1. */ | |
74 /* On entry, TRANSA specifies the form of op( A ) to be used in */ | |
75 /* the matrix multiplication as follows: */ | |
76 | |
77 /* TRANSA = 'N' or 'n' op( A ) = A. */ | |
78 | |
79 /* TRANSA = 'T' or 't' op( A ) = A'. */ | |
80 | |
81 /* TRANSA = 'C' or 'c' op( A ) = A'. */ | |
82 | |
83 /* Unchanged on exit. */ | |
84 | |
85 /* DIAG - CHARACTER*1. */ | |
86 /* On entry, DIAG specifies whether or not A is unit triangular */ | |
87 /* as follows: */ | |
88 | |
89 /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */ | |
90 | |
91 /* DIAG = 'N' or 'n' A is not assumed to be unit */ | |
92 /* triangular. */ | |
93 | |
94 /* Unchanged on exit. */ | |
95 | |
96 /* M - INTEGER. */ | |
97 /* On entry, M specifies the number of rows of B. M must be at */ | |
98 /* least zero. */ | |
99 /* Unchanged on exit. */ | |
100 | |
101 /* N - INTEGER. */ | |
102 /* On entry, N specifies the number of columns of B. N must be */ | |
103 /* at least zero. */ | |
104 /* Unchanged on exit. */ | |
105 | |
106 /* ALPHA - DOUBLE PRECISION. */ | |
107 /* On entry, ALPHA specifies the scalar alpha. When alpha is */ | |
108 /* zero then A is not referenced and B need not be set before */ | |
109 /* entry. */ | |
110 /* Unchanged on exit. */ | |
111 | |
112 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, k ), where k is m */ | |
113 /* when SIDE = 'L' or 'l' and is n when SIDE = 'R' or 'r'. */ | |
114 /* Before entry with UPLO = 'U' or 'u', the leading k by k */ | |
115 /* upper triangular part of the array A must contain the upper */ | |
116 /* triangular matrix and the strictly lower triangular part of */ | |
117 /* A is not referenced. */ | |
118 /* Before entry with UPLO = 'L' or 'l', the leading k by k */ | |
119 /* lower triangular part of the array A must contain the lower */ | |
120 /* triangular matrix and the strictly upper triangular part of */ | |
121 /* A is not referenced. */ | |
122 /* Note that when DIAG = 'U' or 'u', the diagonal elements of */ | |
123 /* A are not referenced either, but are assumed to be unity. */ | |
124 /* Unchanged on exit. */ | |
125 | |
126 /* LDA - INTEGER. */ | |
127 /* On entry, LDA specifies the first dimension of A as declared */ | |
128 /* in the calling (sub) program. When SIDE = 'L' or 'l' then */ | |
129 /* LDA must be at least max( 1, m ), when SIDE = 'R' or 'r' */ | |
130 /* then LDA must be at least max( 1, n ). */ | |
131 /* Unchanged on exit. */ | |
132 | |
133 /* B - DOUBLE PRECISION array of DIMENSION ( LDB, n ). */ | |
134 /* Before entry, the leading m by n part of the array B must */ | |
135 /* contain the matrix B, and on exit is overwritten by the */ | |
136 /* transformed matrix. */ | |
137 | |
138 /* LDB - INTEGER. */ | |
139 /* On entry, LDB specifies the first dimension of B as declared */ | |
140 /* in the calling (sub) program. LDB 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 /* .. */ | |
156 /* .. External Subroutines .. */ | |
157 /* .. */ | |
158 /* .. Intrinsic Functions .. */ | |
159 /* .. */ | |
160 /* .. Local Scalars .. */ | |
161 /* .. */ | |
162 /* .. Parameters .. */ | |
163 /* .. */ | |
164 | |
165 /* Test the input parameters. */ | |
166 | |
167 /* Parameter adjustments */ | |
168 a_dim1 = *lda; | |
169 a_offset = 1 + a_dim1; | |
170 a -= a_offset; | |
171 b_dim1 = *ldb; | |
172 b_offset = 1 + b_dim1; | |
173 b -= b_offset; | |
174 | |
175 /* Function Body */ | |
176 lside = lsame_(side, "L"); | |
177 if (lside) { | |
178 nrowa = *m; | |
179 } else { | |
180 nrowa = *n; | |
181 } | |
182 nounit = lsame_(diag, "N"); | |
183 upper = lsame_(uplo, "U"); | |
184 | |
185 info = 0; | |
186 if (! lside && ! lsame_(side, "R")) { | |
187 info = 1; | |
188 } else if (! upper && ! lsame_(uplo, "L")) { | |
189 info = 2; | |
190 } else if (! lsame_(transa, "N") && ! lsame_(transa, | |
191 "T") && ! lsame_(transa, "C")) { | |
192 info = 3; | |
193 } else if (! lsame_(diag, "U") && ! lsame_(diag, | |
194 "N")) { | |
195 info = 4; | |
196 } else if (*m < 0) { | |
197 info = 5; | |
198 } else if (*n < 0) { | |
199 info = 6; | |
200 } else if (*lda < max(1,nrowa)) { | |
201 info = 9; | |
202 } else if (*ldb < max(1,*m)) { | |
203 info = 11; | |
204 } | |
205 if (info != 0) { | |
206 xerbla_("DTRMM ", &info); | |
207 return 0; | |
208 } | |
209 | |
210 /* Quick return if possible. */ | |
211 | |
212 if (*m == 0 || *n == 0) { | |
213 return 0; | |
214 } | |
215 | |
216 /* And when alpha.eq.zero. */ | |
217 | |
218 if (*alpha == 0.) { | |
219 i__1 = *n; | |
220 for (j = 1; j <= i__1; ++j) { | |
221 i__2 = *m; | |
222 for (i__ = 1; i__ <= i__2; ++i__) { | |
223 b[i__ + j * b_dim1] = 0.; | |
224 /* L10: */ | |
225 } | |
226 /* L20: */ | |
227 } | |
228 return 0; | |
229 } | |
230 | |
231 /* Start the operations. */ | |
232 | |
233 if (lside) { | |
234 if (lsame_(transa, "N")) { | |
235 | |
236 /* Form B := alpha*A*B. */ | |
237 | |
238 if (upper) { | |
239 i__1 = *n; | |
240 for (j = 1; j <= i__1; ++j) { | |
241 i__2 = *m; | |
242 for (k = 1; k <= i__2; ++k) { | |
243 if (b[k + j * b_dim1] != 0.) { | |
244 temp = *alpha * b[k + j * b_dim1]; | |
245 i__3 = k - 1; | |
246 for (i__ = 1; i__ <= i__3; ++i__) { | |
247 b[i__ + j * b_dim1] += temp * a[i__ + k * | |
248 a_dim1]; | |
249 /* L30: */ | |
250 } | |
251 if (nounit) { | |
252 temp *= a[k + k * a_dim1]; | |
253 } | |
254 b[k + j * b_dim1] = temp; | |
255 } | |
256 /* L40: */ | |
257 } | |
258 /* L50: */ | |
259 } | |
260 } else { | |
261 i__1 = *n; | |
262 for (j = 1; j <= i__1; ++j) { | |
263 for (k = *m; k >= 1; --k) { | |
264 if (b[k + j * b_dim1] != 0.) { | |
265 temp = *alpha * b[k + j * b_dim1]; | |
266 b[k + j * b_dim1] = temp; | |
267 if (nounit) { | |
268 b[k + j * b_dim1] *= a[k + k * a_dim1]; | |
269 } | |
270 i__2 = *m; | |
271 for (i__ = k + 1; i__ <= i__2; ++i__) { | |
272 b[i__ + j * b_dim1] += temp * a[i__ + k * | |
273 a_dim1]; | |
274 /* L60: */ | |
275 } | |
276 } | |
277 /* L70: */ | |
278 } | |
279 /* L80: */ | |
280 } | |
281 } | |
282 } else { | |
283 | |
284 /* Form B := alpha*A'*B. */ | |
285 | |
286 if (upper) { | |
287 i__1 = *n; | |
288 for (j = 1; j <= i__1; ++j) { | |
289 for (i__ = *m; i__ >= 1; --i__) { | |
290 temp = b[i__ + j * b_dim1]; | |
291 if (nounit) { | |
292 temp *= a[i__ + i__ * a_dim1]; | |
293 } | |
294 i__2 = i__ - 1; | |
295 for (k = 1; k <= i__2; ++k) { | |
296 temp += a[k + i__ * a_dim1] * b[k + j * b_dim1]; | |
297 /* L90: */ | |
298 } | |
299 b[i__ + j * b_dim1] = *alpha * temp; | |
300 /* L100: */ | |
301 } | |
302 /* L110: */ | |
303 } | |
304 } else { | |
305 i__1 = *n; | |
306 for (j = 1; j <= i__1; ++j) { | |
307 i__2 = *m; | |
308 for (i__ = 1; i__ <= i__2; ++i__) { | |
309 temp = b[i__ + j * b_dim1]; | |
310 if (nounit) { | |
311 temp *= a[i__ + i__ * a_dim1]; | |
312 } | |
313 i__3 = *m; | |
314 for (k = i__ + 1; k <= i__3; ++k) { | |
315 temp += a[k + i__ * a_dim1] * b[k + j * b_dim1]; | |
316 /* L120: */ | |
317 } | |
318 b[i__ + j * b_dim1] = *alpha * temp; | |
319 /* L130: */ | |
320 } | |
321 /* L140: */ | |
322 } | |
323 } | |
324 } | |
325 } else { | |
326 if (lsame_(transa, "N")) { | |
327 | |
328 /* Form B := alpha*B*A. */ | |
329 | |
330 if (upper) { | |
331 for (j = *n; j >= 1; --j) { | |
332 temp = *alpha; | |
333 if (nounit) { | |
334 temp *= a[j + j * a_dim1]; | |
335 } | |
336 i__1 = *m; | |
337 for (i__ = 1; i__ <= i__1; ++i__) { | |
338 b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1]; | |
339 /* L150: */ | |
340 } | |
341 i__1 = j - 1; | |
342 for (k = 1; k <= i__1; ++k) { | |
343 if (a[k + j * a_dim1] != 0.) { | |
344 temp = *alpha * a[k + j * a_dim1]; | |
345 i__2 = *m; | |
346 for (i__ = 1; i__ <= i__2; ++i__) { | |
347 b[i__ + j * b_dim1] += temp * b[i__ + k * | |
348 b_dim1]; | |
349 /* L160: */ | |
350 } | |
351 } | |
352 /* L170: */ | |
353 } | |
354 /* L180: */ | |
355 } | |
356 } else { | |
357 i__1 = *n; | |
358 for (j = 1; j <= i__1; ++j) { | |
359 temp = *alpha; | |
360 if (nounit) { | |
361 temp *= a[j + j * a_dim1]; | |
362 } | |
363 i__2 = *m; | |
364 for (i__ = 1; i__ <= i__2; ++i__) { | |
365 b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1]; | |
366 /* L190: */ | |
367 } | |
368 i__2 = *n; | |
369 for (k = j + 1; k <= i__2; ++k) { | |
370 if (a[k + j * a_dim1] != 0.) { | |
371 temp = *alpha * a[k + j * a_dim1]; | |
372 i__3 = *m; | |
373 for (i__ = 1; i__ <= i__3; ++i__) { | |
374 b[i__ + j * b_dim1] += temp * b[i__ + k * | |
375 b_dim1]; | |
376 /* L200: */ | |
377 } | |
378 } | |
379 /* L210: */ | |
380 } | |
381 /* L220: */ | |
382 } | |
383 } | |
384 } else { | |
385 | |
386 /* Form B := alpha*B*A'. */ | |
387 | |
388 if (upper) { | |
389 i__1 = *n; | |
390 for (k = 1; k <= i__1; ++k) { | |
391 i__2 = k - 1; | |
392 for (j = 1; j <= i__2; ++j) { | |
393 if (a[j + k * a_dim1] != 0.) { | |
394 temp = *alpha * a[j + k * a_dim1]; | |
395 i__3 = *m; | |
396 for (i__ = 1; i__ <= i__3; ++i__) { | |
397 b[i__ + j * b_dim1] += temp * b[i__ + k * | |
398 b_dim1]; | |
399 /* L230: */ | |
400 } | |
401 } | |
402 /* L240: */ | |
403 } | |
404 temp = *alpha; | |
405 if (nounit) { | |
406 temp *= a[k + k * a_dim1]; | |
407 } | |
408 if (temp != 1.) { | |
409 i__2 = *m; | |
410 for (i__ = 1; i__ <= i__2; ++i__) { | |
411 b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1]; | |
412 /* L250: */ | |
413 } | |
414 } | |
415 /* L260: */ | |
416 } | |
417 } else { | |
418 for (k = *n; k >= 1; --k) { | |
419 i__1 = *n; | |
420 for (j = k + 1; j <= i__1; ++j) { | |
421 if (a[j + k * a_dim1] != 0.) { | |
422 temp = *alpha * a[j + k * a_dim1]; | |
423 i__2 = *m; | |
424 for (i__ = 1; i__ <= i__2; ++i__) { | |
425 b[i__ + j * b_dim1] += temp * b[i__ + k * | |
426 b_dim1]; | |
427 /* L270: */ | |
428 } | |
429 } | |
430 /* L280: */ | |
431 } | |
432 temp = *alpha; | |
433 if (nounit) { | |
434 temp *= a[k + k * a_dim1]; | |
435 } | |
436 if (temp != 1.) { | |
437 i__1 = *m; | |
438 for (i__ = 1; i__ <= i__1; ++i__) { | |
439 b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1]; | |
440 /* L290: */ | |
441 } | |
442 } | |
443 /* L300: */ | |
444 } | |
445 } | |
446 } | |
447 } | |
448 | |
449 return 0; | |
450 | |
451 /* End of DTRMM . */ | |
452 | |
453 } /* dtrmm_ */ |