3 /* Subroutine */ int dtrmm_(char *side, char *uplo, char *transa, char *diag,
4 integer *m, integer *n, doublereal *alpha, doublereal *a, integer *
5 lda, doublereal *b, integer *ldb)
7 /* System generated locals */
8 integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
11 integer i__, j, k, info;
14 extern logical lsame_(char *, char *);
17 extern /* Subroutine */ int xerbla_(char *, integer *);
20 /* .. Scalar Arguments .. */
22 /* .. Array Arguments .. */
28 /* DTRMM performs one of the matrix-matrix operations */
30 /* B := alpha*op( A )*B, or B := alpha*B*op( A ), */
32 /* where alpha is a scalar, B is an m by n matrix, A is a unit, or */
33 /* non-unit, upper or lower triangular matrix and op( A ) is one of */
35 /* op( A ) = A or op( A ) = A'. */
40 /* SIDE - CHARACTER*1. */
41 /* On entry, SIDE specifies whether op( A ) multiplies B from */
42 /* the left or right as follows: */
44 /* SIDE = 'L' or 'l' B := alpha*op( A )*B. */
46 /* SIDE = 'R' or 'r' B := alpha*B*op( A ). */
48 /* Unchanged on exit. */
50 /* UPLO - CHARACTER*1. */
51 /* On entry, UPLO specifies whether the matrix A is an upper or */
52 /* lower triangular matrix as follows: */
54 /* UPLO = 'U' or 'u' A is an upper triangular matrix. */
56 /* UPLO = 'L' or 'l' A is a lower triangular matrix. */
58 /* Unchanged on exit. */
60 /* TRANSA - CHARACTER*1. */
61 /* On entry, TRANSA specifies the form of op( A ) to be used in */
62 /* the matrix multiplication as follows: */
64 /* TRANSA = 'N' or 'n' op( A ) = A. */
66 /* TRANSA = 'T' or 't' op( A ) = A'. */
68 /* TRANSA = 'C' or 'c' op( A ) = A'. */
70 /* Unchanged on exit. */
72 /* DIAG - CHARACTER*1. */
73 /* On entry, DIAG specifies whether or not A is unit triangular */
76 /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */
78 /* DIAG = 'N' or 'n' A is not assumed to be unit */
81 /* Unchanged on exit. */
84 /* On entry, M specifies the number of rows of B. M must be at */
86 /* Unchanged on exit. */
89 /* On entry, N specifies the number of columns of B. N must be */
91 /* Unchanged on exit. */
93 /* ALPHA - DOUBLE PRECISION. */
94 /* On entry, ALPHA specifies the scalar alpha. When alpha is */
95 /* zero then A is not referenced and B need not be set before */
97 /* Unchanged on exit. */
99 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, k ), where k is m */
100 /* when SIDE = 'L' or 'l' and is n when SIDE = 'R' or 'r'. */
101 /* Before entry with UPLO = 'U' or 'u', the leading k by k */
102 /* upper triangular part of the array A must contain the upper */
103 /* triangular matrix and the strictly lower triangular part of */
104 /* A is not referenced. */
105 /* Before entry with UPLO = 'L' or 'l', the leading k by k */
106 /* lower triangular part of the array A must contain the lower */
107 /* triangular matrix and the strictly upper triangular part of */
108 /* A is not referenced. */
109 /* Note that when DIAG = 'U' or 'u', the diagonal elements of */
110 /* A are not referenced either, but are assumed to be unity. */
111 /* Unchanged on exit. */
114 /* On entry, LDA specifies the first dimension of A as declared */
115 /* in the calling (sub) program. When SIDE = 'L' or 'l' then */
116 /* LDA must be at least max( 1, m ), when SIDE = 'R' or 'r' */
117 /* then LDA must be at least max( 1, n ). */
118 /* Unchanged on exit. */
120 /* B - DOUBLE PRECISION array of DIMENSION ( LDB, n ). */
121 /* Before entry, the leading m by n part of the array B must */
122 /* contain the matrix B, and on exit is overwritten by the */
123 /* transformed matrix. */
126 /* On entry, LDB specifies the first dimension of B as declared */
127 /* in the calling (sub) program. LDB must be at least */
129 /* Unchanged on exit. */
132 /* Level 3 Blas routine. */
134 /* -- Written on 8-February-1989. */
135 /* Jack Dongarra, Argonne National Laboratory. */
136 /* Iain Duff, AERE Harwell. */
137 /* Jeremy Du Croz, Numerical Algorithms Group Ltd. */
138 /* Sven Hammarling, Numerical Algorithms Group Ltd. */
141 /* .. External Functions .. */
143 /* .. External Subroutines .. */
145 /* .. Intrinsic Functions .. */
147 /* .. Local Scalars .. */
149 /* .. Parameters .. */
152 /* Test the input parameters. */
154 /* Parameter adjustments */
156 a_offset = 1 + a_dim1;
159 b_offset = 1 + b_dim1;
163 lside = lsame_(side, "L");
169 nounit = lsame_(diag, "N");
170 upper = lsame_(uplo, "U");
173 if (! lside && ! lsame_(side, "R")) {
175 } else if (! upper && ! lsame_(uplo, "L")) {
177 } else if (! lsame_(transa, "N") && ! lsame_(transa,
178 "T") && ! lsame_(transa, "C")) {
180 } else if (! lsame_(diag, "U") && ! lsame_(diag,
187 } else if (*lda < max(1,nrowa)) {
189 } else if (*ldb < max(1,*m)) {
193 xerbla_("DTRMM ", &info);
197 /* Quick return if possible. */
203 /* And when alpha.eq.zero. */
207 for (j = 1; j <= i__1; ++j) {
209 for (i__ = 1; i__ <= i__2; ++i__) {
210 b[i__ + j * b_dim1] = 0.;
218 /* Start the operations. */
221 if (lsame_(transa, "N")) {
223 /* Form B := alpha*A*B. */
227 for (j = 1; j <= i__1; ++j) {
229 for (k = 1; k <= i__2; ++k) {
230 if (b[k + j * b_dim1] != 0.) {
231 temp = *alpha * b[k + j * b_dim1];
233 for (i__ = 1; i__ <= i__3; ++i__) {
234 b[i__ + j * b_dim1] += temp * a[i__ + k *
239 temp *= a[k + k * a_dim1];
241 b[k + j * b_dim1] = temp;
249 for (j = 1; j <= i__1; ++j) {
250 for (k = *m; k >= 1; --k) {
251 if (b[k + j * b_dim1] != 0.) {
252 temp = *alpha * b[k + j * b_dim1];
253 b[k + j * b_dim1] = temp;
255 b[k + j * b_dim1] *= a[k + k * a_dim1];
258 for (i__ = k + 1; i__ <= i__2; ++i__) {
259 b[i__ + j * b_dim1] += temp * a[i__ + k *
271 /* Form B := alpha*A'*B. */
275 for (j = 1; j <= i__1; ++j) {
276 for (i__ = *m; i__ >= 1; --i__) {
277 temp = b[i__ + j * b_dim1];
279 temp *= a[i__ + i__ * a_dim1];
282 for (k = 1; k <= i__2; ++k) {
283 temp += a[k + i__ * a_dim1] * b[k + j * b_dim1];
286 b[i__ + j * b_dim1] = *alpha * temp;
293 for (j = 1; j <= i__1; ++j) {
295 for (i__ = 1; i__ <= i__2; ++i__) {
296 temp = b[i__ + j * b_dim1];
298 temp *= a[i__ + i__ * a_dim1];
301 for (k = i__ + 1; k <= i__3; ++k) {
302 temp += a[k + i__ * a_dim1] * b[k + j * b_dim1];
305 b[i__ + j * b_dim1] = *alpha * temp;
313 if (lsame_(transa, "N")) {
315 /* Form B := alpha*B*A. */
318 for (j = *n; j >= 1; --j) {
321 temp *= a[j + j * a_dim1];
324 for (i__ = 1; i__ <= i__1; ++i__) {
325 b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1];
329 for (k = 1; k <= i__1; ++k) {
330 if (a[k + j * a_dim1] != 0.) {
331 temp = *alpha * a[k + j * a_dim1];
333 for (i__ = 1; i__ <= i__2; ++i__) {
334 b[i__ + j * b_dim1] += temp * b[i__ + k *
345 for (j = 1; j <= i__1; ++j) {
348 temp *= a[j + j * a_dim1];
351 for (i__ = 1; i__ <= i__2; ++i__) {
352 b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1];
356 for (k = j + 1; k <= i__2; ++k) {
357 if (a[k + j * a_dim1] != 0.) {
358 temp = *alpha * a[k + j * a_dim1];
360 for (i__ = 1; i__ <= i__3; ++i__) {
361 b[i__ + j * b_dim1] += temp * b[i__ + k *
373 /* Form B := alpha*B*A'. */
377 for (k = 1; k <= i__1; ++k) {
379 for (j = 1; j <= i__2; ++j) {
380 if (a[j + k * a_dim1] != 0.) {
381 temp = *alpha * a[j + k * a_dim1];
383 for (i__ = 1; i__ <= i__3; ++i__) {
384 b[i__ + j * b_dim1] += temp * b[i__ + k *
393 temp *= a[k + k * a_dim1];
397 for (i__ = 1; i__ <= i__2; ++i__) {
398 b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1];
405 for (k = *n; k >= 1; --k) {
407 for (j = k + 1; j <= i__1; ++j) {
408 if (a[j + k * a_dim1] != 0.) {
409 temp = *alpha * a[j + k * a_dim1];
411 for (i__ = 1; i__ <= i__2; ++i__) {
412 b[i__ + j * b_dim1] += temp * b[i__ + k *
421 temp *= a[k + k * a_dim1];
425 for (i__ = 1; i__ <= i__1; ++i__) {
426 b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1];