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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:33