cgemm.c
Go to the documentation of this file.
00001 /* cgemm.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int cgemm_(char *transa, char *transb, integer *m, integer *
00017         n, integer *k, complex *alpha, complex *a, integer *lda, complex *b, 
00018         integer *ldb, complex *beta, complex *c__, integer *ldc)
00019 {
00020     /* System generated locals */
00021     integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, i__1, i__2, 
00022             i__3, i__4, i__5, i__6;
00023     complex q__1, q__2, q__3, q__4;
00024 
00025     /* Builtin functions */
00026     void r_cnjg(complex *, complex *);
00027 
00028     /* Local variables */
00029     integer i__, j, l, info;
00030     logical nota, notb;
00031     complex temp;
00032     logical conja, conjb;
00033     integer ncola;
00034     extern logical lsame_(char *, char *);
00035     integer nrowa, nrowb;
00036     extern /* Subroutine */ int xerbla_(char *, integer *);
00037 
00038 /*     .. Scalar Arguments .. */
00039 /*     .. */
00040 /*     .. Array Arguments .. */
00041 /*     .. */
00042 
00043 /*  Purpose */
00044 /*  ======= */
00045 
00046 /*  CGEMM  performs one of the matrix-matrix operations */
00047 
00048 /*     C := alpha*op( A )*op( B ) + beta*C, */
00049 
00050 /*  where  op( X ) is one of */
00051 
00052 /*     op( X ) = X   or   op( X ) = X'   or   op( X ) = conjg( X' ), */
00053 
00054 /*  alpha and beta are scalars, and A, B and C are matrices, with op( A ) */
00055 /*  an m by k matrix,  op( B )  a  k by n matrix and  C an m by n matrix. */
00056 
00057 /*  Arguments */
00058 /*  ========== */
00059 
00060 /*  TRANSA - CHARACTER*1. */
00061 /*           On entry, TRANSA specifies the form of op( A ) to be used in */
00062 /*           the matrix multiplication as follows: */
00063 
00064 /*              TRANSA = 'N' or 'n',  op( A ) = A. */
00065 
00066 /*              TRANSA = 'T' or 't',  op( A ) = A'. */
00067 
00068 /*              TRANSA = 'C' or 'c',  op( A ) = conjg( A' ). */
00069 
00070 /*           Unchanged on exit. */
00071 
00072 /*  TRANSB - CHARACTER*1. */
00073 /*           On entry, TRANSB specifies the form of op( B ) to be used in */
00074 /*           the matrix multiplication as follows: */
00075 
00076 /*              TRANSB = 'N' or 'n',  op( B ) = B. */
00077 
00078 /*              TRANSB = 'T' or 't',  op( B ) = B'. */
00079 
00080 /*              TRANSB = 'C' or 'c',  op( B ) = conjg( B' ). */
00081 
00082 /*           Unchanged on exit. */
00083 
00084 /*  M      - INTEGER. */
00085 /*           On entry,  M  specifies  the number  of rows  of the  matrix */
00086 /*           op( A )  and of the  matrix  C.  M  must  be at least  zero. */
00087 /*           Unchanged on exit. */
00088 
00089 /*  N      - INTEGER. */
00090 /*           On entry,  N  specifies the number  of columns of the matrix */
00091 /*           op( B ) and the number of columns of the matrix C. N must be */
00092 /*           at least zero. */
00093 /*           Unchanged on exit. */
00094 
00095 /*  K      - INTEGER. */
00096 /*           On entry,  K  specifies  the number of columns of the matrix */
00097 /*           op( A ) and the number of rows of the matrix op( B ). K must */
00098 /*           be at least  zero. */
00099 /*           Unchanged on exit. */
00100 
00101 /*  ALPHA  - COMPLEX         . */
00102 /*           On entry, ALPHA specifies the scalar alpha. */
00103 /*           Unchanged on exit. */
00104 
00105 /*  A      - COMPLEX          array of DIMENSION ( LDA, ka ), where ka is */
00106 /*           k  when  TRANSA = 'N' or 'n',  and is  m  otherwise. */
00107 /*           Before entry with  TRANSA = 'N' or 'n',  the leading  m by k */
00108 /*           part of the array  A  must contain the matrix  A,  otherwise */
00109 /*           the leading  k by m  part of the array  A  must contain  the */
00110 /*           matrix A. */
00111 /*           Unchanged on exit. */
00112 
00113 /*  LDA    - INTEGER. */
00114 /*           On entry, LDA specifies the first dimension of A as declared */
00115 /*           in the calling (sub) program. When  TRANSA = 'N' or 'n' then */
00116 /*           LDA must be at least  max( 1, m ), otherwise  LDA must be at */
00117 /*           least  max( 1, k ). */
00118 /*           Unchanged on exit. */
00119 
00120 /*  B      - COMPLEX          array of DIMENSION ( LDB, kb ), where kb is */
00121 /*           n  when  TRANSB = 'N' or 'n',  and is  k  otherwise. */
00122 /*           Before entry with  TRANSB = 'N' or 'n',  the leading  k by n */
00123 /*           part of the array  B  must contain the matrix  B,  otherwise */
00124 /*           the leading  n by k  part of the array  B  must contain  the */
00125 /*           matrix B. */
00126 /*           Unchanged on exit. */
00127 
00128 /*  LDB    - INTEGER. */
00129 /*           On entry, LDB specifies the first dimension of B as declared */
00130 /*           in the calling (sub) program. When  TRANSB = 'N' or 'n' then */
00131 /*           LDB must be at least  max( 1, k ), otherwise  LDB must be at */
00132 /*           least  max( 1, n ). */
00133 /*           Unchanged on exit. */
00134 
00135 /*  BETA   - COMPLEX         . */
00136 /*           On entry,  BETA  specifies the scalar  beta.  When  BETA  is */
00137 /*           supplied as zero then C need not be set on input. */
00138 /*           Unchanged on exit. */
00139 
00140 /*  C      - COMPLEX          array of DIMENSION ( LDC, n ). */
00141 /*           Before entry, the leading  m by n  part of the array  C must */
00142 /*           contain the matrix  C,  except when  beta  is zero, in which */
00143 /*           case C need not be set on entry. */
00144 /*           On exit, the array  C  is overwritten by the  m by n  matrix */
00145 /*           ( alpha*op( A )*op( B ) + beta*C ). */
00146 
00147 /*  LDC    - INTEGER. */
00148 /*           On entry, LDC specifies the first dimension of C as declared */
00149 /*           in  the  calling  (sub)  program.   LDC  must  be  at  least */
00150 /*           max( 1, m ). */
00151 /*           Unchanged on exit. */
00152 
00153 
00154 /*  Level 3 Blas routine. */
00155 
00156 /*  -- Written on 8-February-1989. */
00157 /*     Jack Dongarra, Argonne National Laboratory. */
00158 /*     Iain Duff, AERE Harwell. */
00159 /*     Jeremy Du Croz, Numerical Algorithms Group Ltd. */
00160 /*     Sven Hammarling, Numerical Algorithms Group Ltd. */
00161 
00162 
00163 /*     .. External Functions .. */
00164 /*     .. */
00165 /*     .. External Subroutines .. */
00166 /*     .. */
00167 /*     .. Intrinsic Functions .. */
00168 /*     .. */
00169 /*     .. Local Scalars .. */
00170 /*     .. */
00171 /*     .. Parameters .. */
00172 /*     .. */
00173 
00174 /*     Set  NOTA  and  NOTB  as  true if  A  and  B  respectively are not */
00175 /*     conjugated or transposed, set  CONJA and CONJB  as true if  A  and */
00176 /*     B  respectively are to be  transposed but  not conjugated  and set */
00177 /*     NROWA, NCOLA and  NROWB  as the number of rows and  columns  of  A */
00178 /*     and the number of rows of  B  respectively. */
00179 
00180     /* Parameter adjustments */
00181     a_dim1 = *lda;
00182     a_offset = 1 + a_dim1;
00183     a -= a_offset;
00184     b_dim1 = *ldb;
00185     b_offset = 1 + b_dim1;
00186     b -= b_offset;
00187     c_dim1 = *ldc;
00188     c_offset = 1 + c_dim1;
00189     c__ -= c_offset;
00190 
00191     /* Function Body */
00192     nota = lsame_(transa, "N");
00193     notb = lsame_(transb, "N");
00194     conja = lsame_(transa, "C");
00195     conjb = lsame_(transb, "C");
00196     if (nota) {
00197         nrowa = *m;
00198         ncola = *k;
00199     } else {
00200         nrowa = *k;
00201         ncola = *m;
00202     }
00203     if (notb) {
00204         nrowb = *k;
00205     } else {
00206         nrowb = *n;
00207     }
00208 
00209 /*     Test the input parameters. */
00210 
00211     info = 0;
00212     if (! nota && ! conja && ! lsame_(transa, "T")) {
00213         info = 1;
00214     } else if (! notb && ! conjb && ! lsame_(transb, "T")) {
00215         info = 2;
00216     } else if (*m < 0) {
00217         info = 3;
00218     } else if (*n < 0) {
00219         info = 4;
00220     } else if (*k < 0) {
00221         info = 5;
00222     } else if (*lda < max(1,nrowa)) {
00223         info = 8;
00224     } else if (*ldb < max(1,nrowb)) {
00225         info = 10;
00226     } else if (*ldc < max(1,*m)) {
00227         info = 13;
00228     }
00229     if (info != 0) {
00230         xerbla_("CGEMM ", &info);
00231         return 0;
00232     }
00233 
00234 /*     Quick return if possible. */
00235 
00236     if (*m == 0 || *n == 0 || (alpha->r == 0.f && alpha->i == 0.f || *k == 0) 
00237             && (beta->r == 1.f && beta->i == 0.f)) {
00238         return 0;
00239     }
00240 
00241 /*     And when  alpha.eq.zero. */
00242 
00243     if (alpha->r == 0.f && alpha->i == 0.f) {
00244         if (beta->r == 0.f && beta->i == 0.f) {
00245             i__1 = *n;
00246             for (j = 1; j <= i__1; ++j) {
00247                 i__2 = *m;
00248                 for (i__ = 1; i__ <= i__2; ++i__) {
00249                     i__3 = i__ + j * c_dim1;
00250                     c__[i__3].r = 0.f, c__[i__3].i = 0.f;
00251 /* L10: */
00252                 }
00253 /* L20: */
00254             }
00255         } else {
00256             i__1 = *n;
00257             for (j = 1; j <= i__1; ++j) {
00258                 i__2 = *m;
00259                 for (i__ = 1; i__ <= i__2; ++i__) {
00260                     i__3 = i__ + j * c_dim1;
00261                     i__4 = i__ + j * c_dim1;
00262                     q__1.r = beta->r * c__[i__4].r - beta->i * c__[i__4].i, 
00263                             q__1.i = beta->r * c__[i__4].i + beta->i * c__[
00264                             i__4].r;
00265                     c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00266 /* L30: */
00267                 }
00268 /* L40: */
00269             }
00270         }
00271         return 0;
00272     }
00273 
00274 /*     Start the operations. */
00275 
00276     if (notb) {
00277         if (nota) {
00278 
00279 /*           Form  C := alpha*A*B + beta*C. */
00280 
00281             i__1 = *n;
00282             for (j = 1; j <= i__1; ++j) {
00283                 if (beta->r == 0.f && beta->i == 0.f) {
00284                     i__2 = *m;
00285                     for (i__ = 1; i__ <= i__2; ++i__) {
00286                         i__3 = i__ + j * c_dim1;
00287                         c__[i__3].r = 0.f, c__[i__3].i = 0.f;
00288 /* L50: */
00289                     }
00290                 } else if (beta->r != 1.f || beta->i != 0.f) {
00291                     i__2 = *m;
00292                     for (i__ = 1; i__ <= i__2; ++i__) {
00293                         i__3 = i__ + j * c_dim1;
00294                         i__4 = i__ + j * c_dim1;
00295                         q__1.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00296                                 .i, q__1.i = beta->r * c__[i__4].i + beta->i *
00297                                  c__[i__4].r;
00298                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00299 /* L60: */
00300                     }
00301                 }
00302                 i__2 = *k;
00303                 for (l = 1; l <= i__2; ++l) {
00304                     i__3 = l + j * b_dim1;
00305                     if (b[i__3].r != 0.f || b[i__3].i != 0.f) {
00306                         i__3 = l + j * b_dim1;
00307                         q__1.r = alpha->r * b[i__3].r - alpha->i * b[i__3].i, 
00308                                 q__1.i = alpha->r * b[i__3].i + alpha->i * b[
00309                                 i__3].r;
00310                         temp.r = q__1.r, temp.i = q__1.i;
00311                         i__3 = *m;
00312                         for (i__ = 1; i__ <= i__3; ++i__) {
00313                             i__4 = i__ + j * c_dim1;
00314                             i__5 = i__ + j * c_dim1;
00315                             i__6 = i__ + l * a_dim1;
00316                             q__2.r = temp.r * a[i__6].r - temp.i * a[i__6].i, 
00317                                     q__2.i = temp.r * a[i__6].i + temp.i * a[
00318                                     i__6].r;
00319                             q__1.r = c__[i__5].r + q__2.r, q__1.i = c__[i__5]
00320                                     .i + q__2.i;
00321                             c__[i__4].r = q__1.r, c__[i__4].i = q__1.i;
00322 /* L70: */
00323                         }
00324                     }
00325 /* L80: */
00326                 }
00327 /* L90: */
00328             }
00329         } else if (conja) {
00330 
00331 /*           Form  C := alpha*conjg( A' )*B + beta*C. */
00332 
00333             i__1 = *n;
00334             for (j = 1; j <= i__1; ++j) {
00335                 i__2 = *m;
00336                 for (i__ = 1; i__ <= i__2; ++i__) {
00337                     temp.r = 0.f, temp.i = 0.f;
00338                     i__3 = *k;
00339                     for (l = 1; l <= i__3; ++l) {
00340                         r_cnjg(&q__3, &a[l + i__ * a_dim1]);
00341                         i__4 = l + j * b_dim1;
00342                         q__2.r = q__3.r * b[i__4].r - q__3.i * b[i__4].i, 
00343                                 q__2.i = q__3.r * b[i__4].i + q__3.i * b[i__4]
00344                                 .r;
00345                         q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
00346                         temp.r = q__1.r, temp.i = q__1.i;
00347 /* L100: */
00348                     }
00349                     if (beta->r == 0.f && beta->i == 0.f) {
00350                         i__3 = i__ + j * c_dim1;
00351                         q__1.r = alpha->r * temp.r - alpha->i * temp.i, 
00352                                 q__1.i = alpha->r * temp.i + alpha->i * 
00353                                 temp.r;
00354                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00355                     } else {
00356                         i__3 = i__ + j * c_dim1;
00357                         q__2.r = alpha->r * temp.r - alpha->i * temp.i, 
00358                                 q__2.i = alpha->r * temp.i + alpha->i * 
00359                                 temp.r;
00360                         i__4 = i__ + j * c_dim1;
00361                         q__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00362                                 .i, q__3.i = beta->r * c__[i__4].i + beta->i *
00363                                  c__[i__4].r;
00364                         q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00365                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00366                     }
00367 /* L110: */
00368                 }
00369 /* L120: */
00370             }
00371         } else {
00372 
00373 /*           Form  C := alpha*A'*B + beta*C */
00374 
00375             i__1 = *n;
00376             for (j = 1; j <= i__1; ++j) {
00377                 i__2 = *m;
00378                 for (i__ = 1; i__ <= i__2; ++i__) {
00379                     temp.r = 0.f, temp.i = 0.f;
00380                     i__3 = *k;
00381                     for (l = 1; l <= i__3; ++l) {
00382                         i__4 = l + i__ * a_dim1;
00383                         i__5 = l + j * b_dim1;
00384                         q__2.r = a[i__4].r * b[i__5].r - a[i__4].i * b[i__5]
00385                                 .i, q__2.i = a[i__4].r * b[i__5].i + a[i__4]
00386                                 .i * b[i__5].r;
00387                         q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
00388                         temp.r = q__1.r, temp.i = q__1.i;
00389 /* L130: */
00390                     }
00391                     if (beta->r == 0.f && beta->i == 0.f) {
00392                         i__3 = i__ + j * c_dim1;
00393                         q__1.r = alpha->r * temp.r - alpha->i * temp.i, 
00394                                 q__1.i = alpha->r * temp.i + alpha->i * 
00395                                 temp.r;
00396                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00397                     } else {
00398                         i__3 = i__ + j * c_dim1;
00399                         q__2.r = alpha->r * temp.r - alpha->i * temp.i, 
00400                                 q__2.i = alpha->r * temp.i + alpha->i * 
00401                                 temp.r;
00402                         i__4 = i__ + j * c_dim1;
00403                         q__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00404                                 .i, q__3.i = beta->r * c__[i__4].i + beta->i *
00405                                  c__[i__4].r;
00406                         q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00407                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00408                     }
00409 /* L140: */
00410                 }
00411 /* L150: */
00412             }
00413         }
00414     } else if (nota) {
00415         if (conjb) {
00416 
00417 /*           Form  C := alpha*A*conjg( B' ) + beta*C. */
00418 
00419             i__1 = *n;
00420             for (j = 1; j <= i__1; ++j) {
00421                 if (beta->r == 0.f && beta->i == 0.f) {
00422                     i__2 = *m;
00423                     for (i__ = 1; i__ <= i__2; ++i__) {
00424                         i__3 = i__ + j * c_dim1;
00425                         c__[i__3].r = 0.f, c__[i__3].i = 0.f;
00426 /* L160: */
00427                     }
00428                 } else if (beta->r != 1.f || beta->i != 0.f) {
00429                     i__2 = *m;
00430                     for (i__ = 1; i__ <= i__2; ++i__) {
00431                         i__3 = i__ + j * c_dim1;
00432                         i__4 = i__ + j * c_dim1;
00433                         q__1.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00434                                 .i, q__1.i = beta->r * c__[i__4].i + beta->i *
00435                                  c__[i__4].r;
00436                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00437 /* L170: */
00438                     }
00439                 }
00440                 i__2 = *k;
00441                 for (l = 1; l <= i__2; ++l) {
00442                     i__3 = j + l * b_dim1;
00443                     if (b[i__3].r != 0.f || b[i__3].i != 0.f) {
00444                         r_cnjg(&q__2, &b[j + l * b_dim1]);
00445                         q__1.r = alpha->r * q__2.r - alpha->i * q__2.i, 
00446                                 q__1.i = alpha->r * q__2.i + alpha->i * 
00447                                 q__2.r;
00448                         temp.r = q__1.r, temp.i = q__1.i;
00449                         i__3 = *m;
00450                         for (i__ = 1; i__ <= i__3; ++i__) {
00451                             i__4 = i__ + j * c_dim1;
00452                             i__5 = i__ + j * c_dim1;
00453                             i__6 = i__ + l * a_dim1;
00454                             q__2.r = temp.r * a[i__6].r - temp.i * a[i__6].i, 
00455                                     q__2.i = temp.r * a[i__6].i + temp.i * a[
00456                                     i__6].r;
00457                             q__1.r = c__[i__5].r + q__2.r, q__1.i = c__[i__5]
00458                                     .i + q__2.i;
00459                             c__[i__4].r = q__1.r, c__[i__4].i = q__1.i;
00460 /* L180: */
00461                         }
00462                     }
00463 /* L190: */
00464                 }
00465 /* L200: */
00466             }
00467         } else {
00468 
00469 /*           Form  C := alpha*A*B'          + beta*C */
00470 
00471             i__1 = *n;
00472             for (j = 1; j <= i__1; ++j) {
00473                 if (beta->r == 0.f && beta->i == 0.f) {
00474                     i__2 = *m;
00475                     for (i__ = 1; i__ <= i__2; ++i__) {
00476                         i__3 = i__ + j * c_dim1;
00477                         c__[i__3].r = 0.f, c__[i__3].i = 0.f;
00478 /* L210: */
00479                     }
00480                 } else if (beta->r != 1.f || beta->i != 0.f) {
00481                     i__2 = *m;
00482                     for (i__ = 1; i__ <= i__2; ++i__) {
00483                         i__3 = i__ + j * c_dim1;
00484                         i__4 = i__ + j * c_dim1;
00485                         q__1.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00486                                 .i, q__1.i = beta->r * c__[i__4].i + beta->i *
00487                                  c__[i__4].r;
00488                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00489 /* L220: */
00490                     }
00491                 }
00492                 i__2 = *k;
00493                 for (l = 1; l <= i__2; ++l) {
00494                     i__3 = j + l * b_dim1;
00495                     if (b[i__3].r != 0.f || b[i__3].i != 0.f) {
00496                         i__3 = j + l * b_dim1;
00497                         q__1.r = alpha->r * b[i__3].r - alpha->i * b[i__3].i, 
00498                                 q__1.i = alpha->r * b[i__3].i + alpha->i * b[
00499                                 i__3].r;
00500                         temp.r = q__1.r, temp.i = q__1.i;
00501                         i__3 = *m;
00502                         for (i__ = 1; i__ <= i__3; ++i__) {
00503                             i__4 = i__ + j * c_dim1;
00504                             i__5 = i__ + j * c_dim1;
00505                             i__6 = i__ + l * a_dim1;
00506                             q__2.r = temp.r * a[i__6].r - temp.i * a[i__6].i, 
00507                                     q__2.i = temp.r * a[i__6].i + temp.i * a[
00508                                     i__6].r;
00509                             q__1.r = c__[i__5].r + q__2.r, q__1.i = c__[i__5]
00510                                     .i + q__2.i;
00511                             c__[i__4].r = q__1.r, c__[i__4].i = q__1.i;
00512 /* L230: */
00513                         }
00514                     }
00515 /* L240: */
00516                 }
00517 /* L250: */
00518             }
00519         }
00520     } else if (conja) {
00521         if (conjb) {
00522 
00523 /*           Form  C := alpha*conjg( A' )*conjg( B' ) + beta*C. */
00524 
00525             i__1 = *n;
00526             for (j = 1; j <= i__1; ++j) {
00527                 i__2 = *m;
00528                 for (i__ = 1; i__ <= i__2; ++i__) {
00529                     temp.r = 0.f, temp.i = 0.f;
00530                     i__3 = *k;
00531                     for (l = 1; l <= i__3; ++l) {
00532                         r_cnjg(&q__3, &a[l + i__ * a_dim1]);
00533                         r_cnjg(&q__4, &b[j + l * b_dim1]);
00534                         q__2.r = q__3.r * q__4.r - q__3.i * q__4.i, q__2.i = 
00535                                 q__3.r * q__4.i + q__3.i * q__4.r;
00536                         q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
00537                         temp.r = q__1.r, temp.i = q__1.i;
00538 /* L260: */
00539                     }
00540                     if (beta->r == 0.f && beta->i == 0.f) {
00541                         i__3 = i__ + j * c_dim1;
00542                         q__1.r = alpha->r * temp.r - alpha->i * temp.i, 
00543                                 q__1.i = alpha->r * temp.i + alpha->i * 
00544                                 temp.r;
00545                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00546                     } else {
00547                         i__3 = i__ + j * c_dim1;
00548                         q__2.r = alpha->r * temp.r - alpha->i * temp.i, 
00549                                 q__2.i = alpha->r * temp.i + alpha->i * 
00550                                 temp.r;
00551                         i__4 = i__ + j * c_dim1;
00552                         q__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00553                                 .i, q__3.i = beta->r * c__[i__4].i + beta->i *
00554                                  c__[i__4].r;
00555                         q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00556                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00557                     }
00558 /* L270: */
00559                 }
00560 /* L280: */
00561             }
00562         } else {
00563 
00564 /*           Form  C := alpha*conjg( A' )*B' + beta*C */
00565 
00566             i__1 = *n;
00567             for (j = 1; j <= i__1; ++j) {
00568                 i__2 = *m;
00569                 for (i__ = 1; i__ <= i__2; ++i__) {
00570                     temp.r = 0.f, temp.i = 0.f;
00571                     i__3 = *k;
00572                     for (l = 1; l <= i__3; ++l) {
00573                         r_cnjg(&q__3, &a[l + i__ * a_dim1]);
00574                         i__4 = j + l * b_dim1;
00575                         q__2.r = q__3.r * b[i__4].r - q__3.i * b[i__4].i, 
00576                                 q__2.i = q__3.r * b[i__4].i + q__3.i * b[i__4]
00577                                 .r;
00578                         q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
00579                         temp.r = q__1.r, temp.i = q__1.i;
00580 /* L290: */
00581                     }
00582                     if (beta->r == 0.f && beta->i == 0.f) {
00583                         i__3 = i__ + j * c_dim1;
00584                         q__1.r = alpha->r * temp.r - alpha->i * temp.i, 
00585                                 q__1.i = alpha->r * temp.i + alpha->i * 
00586                                 temp.r;
00587                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00588                     } else {
00589                         i__3 = i__ + j * c_dim1;
00590                         q__2.r = alpha->r * temp.r - alpha->i * temp.i, 
00591                                 q__2.i = alpha->r * temp.i + alpha->i * 
00592                                 temp.r;
00593                         i__4 = i__ + j * c_dim1;
00594                         q__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00595                                 .i, q__3.i = beta->r * c__[i__4].i + beta->i *
00596                                  c__[i__4].r;
00597                         q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00598                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00599                     }
00600 /* L300: */
00601                 }
00602 /* L310: */
00603             }
00604         }
00605     } else {
00606         if (conjb) {
00607 
00608 /*           Form  C := alpha*A'*conjg( B' ) + beta*C */
00609 
00610             i__1 = *n;
00611             for (j = 1; j <= i__1; ++j) {
00612                 i__2 = *m;
00613                 for (i__ = 1; i__ <= i__2; ++i__) {
00614                     temp.r = 0.f, temp.i = 0.f;
00615                     i__3 = *k;
00616                     for (l = 1; l <= i__3; ++l) {
00617                         i__4 = l + i__ * a_dim1;
00618                         r_cnjg(&q__3, &b[j + l * b_dim1]);
00619                         q__2.r = a[i__4].r * q__3.r - a[i__4].i * q__3.i, 
00620                                 q__2.i = a[i__4].r * q__3.i + a[i__4].i * 
00621                                 q__3.r;
00622                         q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
00623                         temp.r = q__1.r, temp.i = q__1.i;
00624 /* L320: */
00625                     }
00626                     if (beta->r == 0.f && beta->i == 0.f) {
00627                         i__3 = i__ + j * c_dim1;
00628                         q__1.r = alpha->r * temp.r - alpha->i * temp.i, 
00629                                 q__1.i = alpha->r * temp.i + alpha->i * 
00630                                 temp.r;
00631                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00632                     } else {
00633                         i__3 = i__ + j * c_dim1;
00634                         q__2.r = alpha->r * temp.r - alpha->i * temp.i, 
00635                                 q__2.i = alpha->r * temp.i + alpha->i * 
00636                                 temp.r;
00637                         i__4 = i__ + j * c_dim1;
00638                         q__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00639                                 .i, q__3.i = beta->r * c__[i__4].i + beta->i *
00640                                  c__[i__4].r;
00641                         q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00642                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00643                     }
00644 /* L330: */
00645                 }
00646 /* L340: */
00647             }
00648         } else {
00649 
00650 /*           Form  C := alpha*A'*B' + beta*C */
00651 
00652             i__1 = *n;
00653             for (j = 1; j <= i__1; ++j) {
00654                 i__2 = *m;
00655                 for (i__ = 1; i__ <= i__2; ++i__) {
00656                     temp.r = 0.f, temp.i = 0.f;
00657                     i__3 = *k;
00658                     for (l = 1; l <= i__3; ++l) {
00659                         i__4 = l + i__ * a_dim1;
00660                         i__5 = j + l * b_dim1;
00661                         q__2.r = a[i__4].r * b[i__5].r - a[i__4].i * b[i__5]
00662                                 .i, q__2.i = a[i__4].r * b[i__5].i + a[i__4]
00663                                 .i * b[i__5].r;
00664                         q__1.r = temp.r + q__2.r, q__1.i = temp.i + q__2.i;
00665                         temp.r = q__1.r, temp.i = q__1.i;
00666 /* L350: */
00667                     }
00668                     if (beta->r == 0.f && beta->i == 0.f) {
00669                         i__3 = i__ + j * c_dim1;
00670                         q__1.r = alpha->r * temp.r - alpha->i * temp.i, 
00671                                 q__1.i = alpha->r * temp.i + alpha->i * 
00672                                 temp.r;
00673                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00674                     } else {
00675                         i__3 = i__ + j * c_dim1;
00676                         q__2.r = alpha->r * temp.r - alpha->i * temp.i, 
00677                                 q__2.i = alpha->r * temp.i + alpha->i * 
00678                                 temp.r;
00679                         i__4 = i__ + j * c_dim1;
00680                         q__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00681                                 .i, q__3.i = beta->r * c__[i__4].i + beta->i *
00682                                  c__[i__4].r;
00683                         q__1.r = q__2.r + q__3.r, q__1.i = q__2.i + q__3.i;
00684                         c__[i__3].r = q__1.r, c__[i__3].i = q__1.i;
00685                     }
00686 /* L360: */
00687                 }
00688 /* L370: */
00689             }
00690         }
00691     }
00692 
00693     return 0;
00694 
00695 /*     End of CGEMM . */
00696 
00697 } /* cgemm_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:26