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