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 dgemm_(char *transa, char *transb, integer *m, integer *
00017 n, integer *k, doublereal *alpha, doublereal *a, integer *lda,
00018 doublereal *b, integer *ldb, doublereal *beta, doublereal *c__,
00019 integer *ldc)
00020 {
00021
00022 integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2,
00023 i__3;
00024
00025
00026 integer i__, j, l, info;
00027 logical nota, notb;
00028 doublereal temp;
00029 integer ncola;
00030 extern logical lsame_(char *, char *);
00031 integer nrowa, nrowb;
00032 extern int xerbla_(char *, integer *);
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
00169
00170
00171
00172
00173
00174
00175 a_dim1 = *lda;
00176 a_offset = 1 + a_dim1;
00177 a -= a_offset;
00178 b_dim1 = *ldb;
00179 b_offset = 1 + b_dim1;
00180 b -= b_offset;
00181 c_dim1 = *ldc;
00182 c_offset = 1 + c_dim1;
00183 c__ -= c_offset;
00184
00185
00186 nota = lsame_(transa, "N");
00187 notb = lsame_(transb, "N");
00188 if (nota) {
00189 nrowa = *m;
00190 ncola = *k;
00191 } else {
00192 nrowa = *k;
00193 ncola = *m;
00194 }
00195 if (notb) {
00196 nrowb = *k;
00197 } else {
00198 nrowb = *n;
00199 }
00200
00201
00202
00203 info = 0;
00204 if (! nota && ! lsame_(transa, "C") && ! lsame_(
00205 transa, "T")) {
00206 info = 1;
00207 } else if (! notb && ! lsame_(transb, "C") && !
00208 lsame_(transb, "T")) {
00209 info = 2;
00210 } else if (*m < 0) {
00211 info = 3;
00212 } else if (*n < 0) {
00213 info = 4;
00214 } else if (*k < 0) {
00215 info = 5;
00216 } else if (*lda < max(1,nrowa)) {
00217 info = 8;
00218 } else if (*ldb < max(1,nrowb)) {
00219 info = 10;
00220 } else if (*ldc < max(1,*m)) {
00221 info = 13;
00222 }
00223 if (info != 0) {
00224 xerbla_("DGEMM ", &info);
00225 return 0;
00226 }
00227
00228
00229
00230 if (*m == 0 || *n == 0 || (*alpha == 0. || *k == 0) && *beta == 1.) {
00231 return 0;
00232 }
00233
00234
00235
00236 if (*alpha == 0.) {
00237 if (*beta == 0.) {
00238 i__1 = *n;
00239 for (j = 1; j <= i__1; ++j) {
00240 i__2 = *m;
00241 for (i__ = 1; i__ <= i__2; ++i__) {
00242 c__[i__ + j * c_dim1] = 0.;
00243
00244 }
00245
00246 }
00247 } else {
00248 i__1 = *n;
00249 for (j = 1; j <= i__1; ++j) {
00250 i__2 = *m;
00251 for (i__ = 1; i__ <= i__2; ++i__) {
00252 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00253
00254 }
00255
00256 }
00257 }
00258 return 0;
00259 }
00260
00261
00262
00263 if (notb) {
00264 if (nota) {
00265
00266
00267
00268 i__1 = *n;
00269 for (j = 1; j <= i__1; ++j) {
00270 if (*beta == 0.) {
00271 i__2 = *m;
00272 for (i__ = 1; i__ <= i__2; ++i__) {
00273 c__[i__ + j * c_dim1] = 0.;
00274
00275 }
00276 } else if (*beta != 1.) {
00277 i__2 = *m;
00278 for (i__ = 1; i__ <= i__2; ++i__) {
00279 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00280
00281 }
00282 }
00283 i__2 = *k;
00284 for (l = 1; l <= i__2; ++l) {
00285 if (b[l + j * b_dim1] != 0.) {
00286 temp = *alpha * b[l + j * b_dim1];
00287 i__3 = *m;
00288 for (i__ = 1; i__ <= i__3; ++i__) {
00289 c__[i__ + j * c_dim1] += temp * a[i__ + l *
00290 a_dim1];
00291
00292 }
00293 }
00294
00295 }
00296
00297 }
00298 } else {
00299
00300
00301
00302 i__1 = *n;
00303 for (j = 1; j <= i__1; ++j) {
00304 i__2 = *m;
00305 for (i__ = 1; i__ <= i__2; ++i__) {
00306 temp = 0.;
00307 i__3 = *k;
00308 for (l = 1; l <= i__3; ++l) {
00309 temp += a[l + i__ * a_dim1] * b[l + j * b_dim1];
00310
00311 }
00312 if (*beta == 0.) {
00313 c__[i__ + j * c_dim1] = *alpha * temp;
00314 } else {
00315 c__[i__ + j * c_dim1] = *alpha * temp + *beta * c__[
00316 i__ + j * c_dim1];
00317 }
00318
00319 }
00320
00321 }
00322 }
00323 } else {
00324 if (nota) {
00325
00326
00327
00328 i__1 = *n;
00329 for (j = 1; j <= i__1; ++j) {
00330 if (*beta == 0.) {
00331 i__2 = *m;
00332 for (i__ = 1; i__ <= i__2; ++i__) {
00333 c__[i__ + j * c_dim1] = 0.;
00334
00335 }
00336 } else if (*beta != 1.) {
00337 i__2 = *m;
00338 for (i__ = 1; i__ <= i__2; ++i__) {
00339 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00340
00341 }
00342 }
00343 i__2 = *k;
00344 for (l = 1; l <= i__2; ++l) {
00345 if (b[j + l * b_dim1] != 0.) {
00346 temp = *alpha * b[j + l * b_dim1];
00347 i__3 = *m;
00348 for (i__ = 1; i__ <= i__3; ++i__) {
00349 c__[i__ + j * c_dim1] += temp * a[i__ + l *
00350 a_dim1];
00351
00352 }
00353 }
00354
00355 }
00356
00357 }
00358 } else {
00359
00360
00361
00362 i__1 = *n;
00363 for (j = 1; j <= i__1; ++j) {
00364 i__2 = *m;
00365 for (i__ = 1; i__ <= i__2; ++i__) {
00366 temp = 0.;
00367 i__3 = *k;
00368 for (l = 1; l <= i__3; ++l) {
00369 temp += a[l + i__ * a_dim1] * b[j + l * b_dim1];
00370
00371 }
00372 if (*beta == 0.) {
00373 c__[i__ + j * c_dim1] = *alpha * temp;
00374 } else {
00375 c__[i__ + j * c_dim1] = *alpha * temp + *beta * c__[
00376 i__ + j * c_dim1];
00377 }
00378
00379 }
00380
00381 }
00382 }
00383 }
00384
00385 return 0;
00386
00387
00388
00389 }