Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int dtrmm_(char *side, char *uplo, char *transa, char *diag,
00017 integer *m, integer *n, doublereal *alpha, doublereal *a, integer *
00018 lda, doublereal *b, integer *ldb)
00019 {
00020
00021 integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2, i__3;
00022
00023
00024 integer i__, j, k, info;
00025 doublereal temp;
00026 logical lside;
00027 extern logical lsame_(char *, char *);
00028 integer nrowa;
00029 logical upper;
00030 extern int xerbla_(char *, integer *);
00031 logical nounit;
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 a_dim1 = *lda;
00169 a_offset = 1 + a_dim1;
00170 a -= a_offset;
00171 b_dim1 = *ldb;
00172 b_offset = 1 + b_dim1;
00173 b -= b_offset;
00174
00175
00176 lside = lsame_(side, "L");
00177 if (lside) {
00178 nrowa = *m;
00179 } else {
00180 nrowa = *n;
00181 }
00182 nounit = lsame_(diag, "N");
00183 upper = lsame_(uplo, "U");
00184
00185 info = 0;
00186 if (! lside && ! lsame_(side, "R")) {
00187 info = 1;
00188 } else if (! upper && ! lsame_(uplo, "L")) {
00189 info = 2;
00190 } else if (! lsame_(transa, "N") && ! lsame_(transa,
00191 "T") && ! lsame_(transa, "C")) {
00192 info = 3;
00193 } else if (! lsame_(diag, "U") && ! lsame_(diag,
00194 "N")) {
00195 info = 4;
00196 } else if (*m < 0) {
00197 info = 5;
00198 } else if (*n < 0) {
00199 info = 6;
00200 } else if (*lda < max(1,nrowa)) {
00201 info = 9;
00202 } else if (*ldb < max(1,*m)) {
00203 info = 11;
00204 }
00205 if (info != 0) {
00206 xerbla_("DTRMM ", &info);
00207 return 0;
00208 }
00209
00210
00211
00212 if (*m == 0 || *n == 0) {
00213 return 0;
00214 }
00215
00216
00217
00218 if (*alpha == 0.) {
00219 i__1 = *n;
00220 for (j = 1; j <= i__1; ++j) {
00221 i__2 = *m;
00222 for (i__ = 1; i__ <= i__2; ++i__) {
00223 b[i__ + j * b_dim1] = 0.;
00224
00225 }
00226
00227 }
00228 return 0;
00229 }
00230
00231
00232
00233 if (lside) {
00234 if (lsame_(transa, "N")) {
00235
00236
00237
00238 if (upper) {
00239 i__1 = *n;
00240 for (j = 1; j <= i__1; ++j) {
00241 i__2 = *m;
00242 for (k = 1; k <= i__2; ++k) {
00243 if (b[k + j * b_dim1] != 0.) {
00244 temp = *alpha * b[k + j * b_dim1];
00245 i__3 = k - 1;
00246 for (i__ = 1; i__ <= i__3; ++i__) {
00247 b[i__ + j * b_dim1] += temp * a[i__ + k *
00248 a_dim1];
00249
00250 }
00251 if (nounit) {
00252 temp *= a[k + k * a_dim1];
00253 }
00254 b[k + j * b_dim1] = temp;
00255 }
00256
00257 }
00258
00259 }
00260 } else {
00261 i__1 = *n;
00262 for (j = 1; j <= i__1; ++j) {
00263 for (k = *m; k >= 1; --k) {
00264 if (b[k + j * b_dim1] != 0.) {
00265 temp = *alpha * b[k + j * b_dim1];
00266 b[k + j * b_dim1] = temp;
00267 if (nounit) {
00268 b[k + j * b_dim1] *= a[k + k * a_dim1];
00269 }
00270 i__2 = *m;
00271 for (i__ = k + 1; i__ <= i__2; ++i__) {
00272 b[i__ + j * b_dim1] += temp * a[i__ + k *
00273 a_dim1];
00274
00275 }
00276 }
00277
00278 }
00279
00280 }
00281 }
00282 } else {
00283
00284
00285
00286 if (upper) {
00287 i__1 = *n;
00288 for (j = 1; j <= i__1; ++j) {
00289 for (i__ = *m; i__ >= 1; --i__) {
00290 temp = b[i__ + j * b_dim1];
00291 if (nounit) {
00292 temp *= a[i__ + i__ * a_dim1];
00293 }
00294 i__2 = i__ - 1;
00295 for (k = 1; k <= i__2; ++k) {
00296 temp += a[k + i__ * a_dim1] * b[k + j * b_dim1];
00297
00298 }
00299 b[i__ + j * b_dim1] = *alpha * temp;
00300
00301 }
00302
00303 }
00304 } else {
00305 i__1 = *n;
00306 for (j = 1; j <= i__1; ++j) {
00307 i__2 = *m;
00308 for (i__ = 1; i__ <= i__2; ++i__) {
00309 temp = b[i__ + j * b_dim1];
00310 if (nounit) {
00311 temp *= a[i__ + i__ * a_dim1];
00312 }
00313 i__3 = *m;
00314 for (k = i__ + 1; k <= i__3; ++k) {
00315 temp += a[k + i__ * a_dim1] * b[k + j * b_dim1];
00316
00317 }
00318 b[i__ + j * b_dim1] = *alpha * temp;
00319
00320 }
00321
00322 }
00323 }
00324 }
00325 } else {
00326 if (lsame_(transa, "N")) {
00327
00328
00329
00330 if (upper) {
00331 for (j = *n; j >= 1; --j) {
00332 temp = *alpha;
00333 if (nounit) {
00334 temp *= a[j + j * a_dim1];
00335 }
00336 i__1 = *m;
00337 for (i__ = 1; i__ <= i__1; ++i__) {
00338 b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1];
00339
00340 }
00341 i__1 = j - 1;
00342 for (k = 1; k <= i__1; ++k) {
00343 if (a[k + j * a_dim1] != 0.) {
00344 temp = *alpha * a[k + j * a_dim1];
00345 i__2 = *m;
00346 for (i__ = 1; i__ <= i__2; ++i__) {
00347 b[i__ + j * b_dim1] += temp * b[i__ + k *
00348 b_dim1];
00349
00350 }
00351 }
00352
00353 }
00354
00355 }
00356 } else {
00357 i__1 = *n;
00358 for (j = 1; j <= i__1; ++j) {
00359 temp = *alpha;
00360 if (nounit) {
00361 temp *= a[j + j * a_dim1];
00362 }
00363 i__2 = *m;
00364 for (i__ = 1; i__ <= i__2; ++i__) {
00365 b[i__ + j * b_dim1] = temp * b[i__ + j * b_dim1];
00366
00367 }
00368 i__2 = *n;
00369 for (k = j + 1; k <= i__2; ++k) {
00370 if (a[k + j * a_dim1] != 0.) {
00371 temp = *alpha * a[k + j * a_dim1];
00372 i__3 = *m;
00373 for (i__ = 1; i__ <= i__3; ++i__) {
00374 b[i__ + j * b_dim1] += temp * b[i__ + k *
00375 b_dim1];
00376
00377 }
00378 }
00379
00380 }
00381
00382 }
00383 }
00384 } else {
00385
00386
00387
00388 if (upper) {
00389 i__1 = *n;
00390 for (k = 1; k <= i__1; ++k) {
00391 i__2 = k - 1;
00392 for (j = 1; j <= i__2; ++j) {
00393 if (a[j + k * a_dim1] != 0.) {
00394 temp = *alpha * a[j + k * a_dim1];
00395 i__3 = *m;
00396 for (i__ = 1; i__ <= i__3; ++i__) {
00397 b[i__ + j * b_dim1] += temp * b[i__ + k *
00398 b_dim1];
00399
00400 }
00401 }
00402
00403 }
00404 temp = *alpha;
00405 if (nounit) {
00406 temp *= a[k + k * a_dim1];
00407 }
00408 if (temp != 1.) {
00409 i__2 = *m;
00410 for (i__ = 1; i__ <= i__2; ++i__) {
00411 b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1];
00412
00413 }
00414 }
00415
00416 }
00417 } else {
00418 for (k = *n; k >= 1; --k) {
00419 i__1 = *n;
00420 for (j = k + 1; j <= i__1; ++j) {
00421 if (a[j + k * a_dim1] != 0.) {
00422 temp = *alpha * a[j + k * a_dim1];
00423 i__2 = *m;
00424 for (i__ = 1; i__ <= i__2; ++i__) {
00425 b[i__ + j * b_dim1] += temp * b[i__ + k *
00426 b_dim1];
00427
00428 }
00429 }
00430
00431 }
00432 temp = *alpha;
00433 if (nounit) {
00434 temp *= a[k + k * a_dim1];
00435 }
00436 if (temp != 1.) {
00437 i__1 = *m;
00438 for (i__ = 1; i__ <= i__1; ++i__) {
00439 b[i__ + k * b_dim1] = temp * b[i__ + k * b_dim1];
00440
00441 }
00442 }
00443
00444 }
00445 }
00446 }
00447 }
00448
00449 return 0;
00450
00451
00452
00453 }