zsymm.c
Go to the documentation of this file.
00001 /* zsymm.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 zsymm_(char *side, char *uplo, integer *m, integer *n, 
00017         doublecomplex *alpha, doublecomplex *a, integer *lda, doublecomplex *
00018         b, integer *ldb, doublecomplex *beta, doublecomplex *c__, integer *
00019         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, z__5;
00025 
00026     /* Local variables */
00027     integer i__, j, k, info;
00028     doublecomplex temp1, temp2;
00029     extern logical lsame_(char *, char *);
00030     integer nrowa;
00031     logical upper;
00032     extern /* Subroutine */ int xerbla_(char *, integer *);
00033 
00034 /*     .. Scalar Arguments .. */
00035 /*     .. */
00036 /*     .. Array Arguments .. */
00037 /*     .. */
00038 
00039 /*  Purpose */
00040 /*  ======= */
00041 
00042 /*  ZSYMM  performs one of the matrix-matrix operations */
00043 
00044 /*     C := alpha*A*B + beta*C, */
00045 
00046 /*  or */
00047 
00048 /*     C := alpha*B*A + beta*C, */
00049 
00050 /*  where  alpha and beta are scalars, A is a symmetric matrix and  B and */
00051 /*  C are m by n matrices. */
00052 
00053 /*  Arguments */
00054 /*  ========== */
00055 
00056 /*  SIDE   - CHARACTER*1. */
00057 /*           On entry,  SIDE  specifies whether  the  symmetric matrix  A */
00058 /*           appears on the  left or right  in the  operation as follows: */
00059 
00060 /*              SIDE = 'L' or 'l'   C := alpha*A*B + beta*C, */
00061 
00062 /*              SIDE = 'R' or 'r'   C := alpha*B*A + beta*C, */
00063 
00064 /*           Unchanged on exit. */
00065 
00066 /*  UPLO   - CHARACTER*1. */
00067 /*           On  entry,   UPLO  specifies  whether  the  upper  or  lower */
00068 /*           triangular  part  of  the  symmetric  matrix   A  is  to  be */
00069 /*           referenced as follows: */
00070 
00071 /*              UPLO = 'U' or 'u'   Only the upper triangular part of the */
00072 /*                                  symmetric matrix is to be referenced. */
00073 
00074 /*              UPLO = 'L' or 'l'   Only the lower triangular part of the */
00075 /*                                  symmetric matrix is to be referenced. */
00076 
00077 /*           Unchanged on exit. */
00078 
00079 /*  M      - INTEGER. */
00080 /*           On entry,  M  specifies the number of rows of the matrix  C. */
00081 /*           M  must be at least zero. */
00082 /*           Unchanged on exit. */
00083 
00084 /*  N      - INTEGER. */
00085 /*           On entry, N specifies the number of columns of the matrix C. */
00086 /*           N  must be at least zero. */
00087 /*           Unchanged on exit. */
00088 
00089 /*  ALPHA  - COMPLEX*16      . */
00090 /*           On entry, ALPHA specifies the scalar alpha. */
00091 /*           Unchanged on exit. */
00092 
00093 /*  A      - COMPLEX*16       array of DIMENSION ( LDA, ka ), where ka is */
00094 /*           m  when  SIDE = 'L' or 'l'  and is n  otherwise. */
00095 /*           Before entry  with  SIDE = 'L' or 'l',  the  m by m  part of */
00096 /*           the array  A  must contain the  symmetric matrix,  such that */
00097 /*           when  UPLO = 'U' or 'u', the leading m by m upper triangular */
00098 /*           part of the array  A  must contain the upper triangular part */
00099 /*           of the  symmetric matrix and the  strictly  lower triangular */
00100 /*           part of  A  is not referenced,  and when  UPLO = 'L' or 'l', */
00101 /*           the leading  m by m  lower triangular part  of the  array  A */
00102 /*           must  contain  the  lower triangular part  of the  symmetric */
00103 /*           matrix and the  strictly upper triangular part of  A  is not */
00104 /*           referenced. */
00105 /*           Before entry  with  SIDE = 'R' or 'r',  the  n by n  part of */
00106 /*           the array  A  must contain the  symmetric matrix,  such that */
00107 /*           when  UPLO = 'U' or 'u', the leading n by n upper triangular */
00108 /*           part of the array  A  must contain the upper triangular part */
00109 /*           of the  symmetric matrix and the  strictly  lower triangular */
00110 /*           part of  A  is not referenced,  and when  UPLO = 'L' or 'l', */
00111 /*           the leading  n by n  lower triangular part  of the  array  A */
00112 /*           must  contain  the  lower triangular part  of the  symmetric */
00113 /*           matrix and the  strictly upper triangular part of  A  is not */
00114 /*           referenced. */
00115 /*           Unchanged on exit. */
00116 
00117 /*  LDA    - INTEGER. */
00118 /*           On entry, LDA specifies the first dimension of A as declared */
00119 /*           in the  calling (sub) program. When  SIDE = 'L' or 'l'  then */
00120 /*           LDA must be at least  max( 1, m ), otherwise  LDA must be at */
00121 /*           least max( 1, n ). */
00122 /*           Unchanged on exit. */
00123 
00124 /*  B      - COMPLEX*16       array of DIMENSION ( LDB, n ). */
00125 /*           Before entry, the leading  m by n part of the array  B  must */
00126 /*           contain the 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.   LDB  must  be  at  least */
00132 /*           max( 1, m ). */
00133 /*           Unchanged on exit. */
00134 
00135 /*  BETA   - COMPLEX*16      . */
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*16       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 updated */
00145 /*           matrix. */
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 NROWA as the number of rows of A. */
00175 
00176     /* Parameter adjustments */
00177     a_dim1 = *lda;
00178     a_offset = 1 + a_dim1;
00179     a -= a_offset;
00180     b_dim1 = *ldb;
00181     b_offset = 1 + b_dim1;
00182     b -= b_offset;
00183     c_dim1 = *ldc;
00184     c_offset = 1 + c_dim1;
00185     c__ -= c_offset;
00186 
00187     /* Function Body */
00188     if (lsame_(side, "L")) {
00189         nrowa = *m;
00190     } else {
00191         nrowa = *n;
00192     }
00193     upper = lsame_(uplo, "U");
00194 
00195 /*     Test the input parameters. */
00196 
00197     info = 0;
00198     if (! lsame_(side, "L") && ! lsame_(side, "R")) {
00199         info = 1;
00200     } else if (! upper && ! lsame_(uplo, "L")) {
00201         info = 2;
00202     } else if (*m < 0) {
00203         info = 3;
00204     } else if (*n < 0) {
00205         info = 4;
00206     } else if (*lda < max(1,nrowa)) {
00207         info = 7;
00208     } else if (*ldb < max(1,*m)) {
00209         info = 9;
00210     } else if (*ldc < max(1,*m)) {
00211         info = 12;
00212     }
00213     if (info != 0) {
00214         xerbla_("ZSYMM ", &info);
00215         return 0;
00216     }
00217 
00218 /*     Quick return if possible. */
00219 
00220     if (*m == 0 || *n == 0 || alpha->r == 0. && alpha->i == 0. && (beta->r == 
00221             1. && beta->i == 0.)) {
00222         return 0;
00223     }
00224 
00225 /*     And when  alpha.eq.zero. */
00226 
00227     if (alpha->r == 0. && alpha->i == 0.) {
00228         if (beta->r == 0. && beta->i == 0.) {
00229             i__1 = *n;
00230             for (j = 1; j <= i__1; ++j) {
00231                 i__2 = *m;
00232                 for (i__ = 1; i__ <= i__2; ++i__) {
00233                     i__3 = i__ + j * c_dim1;
00234                     c__[i__3].r = 0., c__[i__3].i = 0.;
00235 /* L10: */
00236                 }
00237 /* L20: */
00238             }
00239         } else {
00240             i__1 = *n;
00241             for (j = 1; j <= i__1; ++j) {
00242                 i__2 = *m;
00243                 for (i__ = 1; i__ <= i__2; ++i__) {
00244                     i__3 = i__ + j * c_dim1;
00245                     i__4 = i__ + j * c_dim1;
00246                     z__1.r = beta->r * c__[i__4].r - beta->i * c__[i__4].i, 
00247                             z__1.i = beta->r * c__[i__4].i + beta->i * c__[
00248                             i__4].r;
00249                     c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00250 /* L30: */
00251                 }
00252 /* L40: */
00253             }
00254         }
00255         return 0;
00256     }
00257 
00258 /*     Start the operations. */
00259 
00260     if (lsame_(side, "L")) {
00261 
00262 /*        Form  C := alpha*A*B + beta*C. */
00263 
00264         if (upper) {
00265             i__1 = *n;
00266             for (j = 1; j <= i__1; ++j) {
00267                 i__2 = *m;
00268                 for (i__ = 1; i__ <= i__2; ++i__) {
00269                     i__3 = i__ + j * b_dim1;
00270                     z__1.r = alpha->r * b[i__3].r - alpha->i * b[i__3].i, 
00271                             z__1.i = alpha->r * b[i__3].i + alpha->i * b[i__3]
00272                             .r;
00273                     temp1.r = z__1.r, temp1.i = z__1.i;
00274                     temp2.r = 0., temp2.i = 0.;
00275                     i__3 = i__ - 1;
00276                     for (k = 1; k <= i__3; ++k) {
00277                         i__4 = k + j * c_dim1;
00278                         i__5 = k + j * c_dim1;
00279                         i__6 = k + i__ * a_dim1;
00280                         z__2.r = temp1.r * a[i__6].r - temp1.i * a[i__6].i, 
00281                                 z__2.i = temp1.r * a[i__6].i + temp1.i * a[
00282                                 i__6].r;
00283                         z__1.r = c__[i__5].r + z__2.r, z__1.i = c__[i__5].i + 
00284                                 z__2.i;
00285                         c__[i__4].r = z__1.r, c__[i__4].i = z__1.i;
00286                         i__4 = k + j * b_dim1;
00287                         i__5 = k + i__ * a_dim1;
00288                         z__2.r = b[i__4].r * a[i__5].r - b[i__4].i * a[i__5]
00289                                 .i, z__2.i = b[i__4].r * a[i__5].i + b[i__4]
00290                                 .i * a[i__5].r;
00291                         z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
00292                         temp2.r = z__1.r, temp2.i = z__1.i;
00293 /* L50: */
00294                     }
00295                     if (beta->r == 0. && beta->i == 0.) {
00296                         i__3 = i__ + j * c_dim1;
00297                         i__4 = i__ + i__ * a_dim1;
00298                         z__2.r = temp1.r * a[i__4].r - temp1.i * a[i__4].i, 
00299                                 z__2.i = temp1.r * a[i__4].i + temp1.i * a[
00300                                 i__4].r;
00301                         z__3.r = alpha->r * temp2.r - alpha->i * temp2.i, 
00302                                 z__3.i = alpha->r * temp2.i + alpha->i * 
00303                                 temp2.r;
00304                         z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
00305                         c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00306                     } else {
00307                         i__3 = i__ + j * c_dim1;
00308                         i__4 = i__ + j * c_dim1;
00309                         z__3.r = beta->r * c__[i__4].r - beta->i * c__[i__4]
00310                                 .i, z__3.i = beta->r * c__[i__4].i + beta->i *
00311                                  c__[i__4].r;
00312                         i__5 = i__ + i__ * a_dim1;
00313                         z__4.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, 
00314                                 z__4.i = temp1.r * a[i__5].i + temp1.i * a[
00315                                 i__5].r;
00316                         z__2.r = z__3.r + z__4.r, z__2.i = z__3.i + z__4.i;
00317                         z__5.r = alpha->r * temp2.r - alpha->i * temp2.i, 
00318                                 z__5.i = alpha->r * temp2.i + alpha->i * 
00319                                 temp2.r;
00320                         z__1.r = z__2.r + z__5.r, z__1.i = z__2.i + z__5.i;
00321                         c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00322                     }
00323 /* L60: */
00324                 }
00325 /* L70: */
00326             }
00327         } else {
00328             i__1 = *n;
00329             for (j = 1; j <= i__1; ++j) {
00330                 for (i__ = *m; i__ >= 1; --i__) {
00331                     i__2 = i__ + j * b_dim1;
00332                     z__1.r = alpha->r * b[i__2].r - alpha->i * b[i__2].i, 
00333                             z__1.i = alpha->r * b[i__2].i + alpha->i * b[i__2]
00334                             .r;
00335                     temp1.r = z__1.r, temp1.i = z__1.i;
00336                     temp2.r = 0., temp2.i = 0.;
00337                     i__2 = *m;
00338                     for (k = i__ + 1; k <= i__2; ++k) {
00339                         i__3 = k + j * c_dim1;
00340                         i__4 = k + j * c_dim1;
00341                         i__5 = k + i__ * a_dim1;
00342                         z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i, 
00343                                 z__2.i = temp1.r * a[i__5].i + temp1.i * a[
00344                                 i__5].r;
00345                         z__1.r = c__[i__4].r + z__2.r, z__1.i = c__[i__4].i + 
00346                                 z__2.i;
00347                         c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00348                         i__3 = k + j * b_dim1;
00349                         i__4 = k + i__ * a_dim1;
00350                         z__2.r = b[i__3].r * a[i__4].r - b[i__3].i * a[i__4]
00351                                 .i, z__2.i = b[i__3].r * a[i__4].i + b[i__3]
00352                                 .i * a[i__4].r;
00353                         z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
00354                         temp2.r = z__1.r, temp2.i = z__1.i;
00355 /* L80: */
00356                     }
00357                     if (beta->r == 0. && beta->i == 0.) {
00358                         i__2 = i__ + j * c_dim1;
00359                         i__3 = i__ + i__ * a_dim1;
00360                         z__2.r = temp1.r * a[i__3].r - temp1.i * a[i__3].i, 
00361                                 z__2.i = temp1.r * a[i__3].i + temp1.i * a[
00362                                 i__3].r;
00363                         z__3.r = alpha->r * temp2.r - alpha->i * temp2.i, 
00364                                 z__3.i = alpha->r * temp2.i + alpha->i * 
00365                                 temp2.r;
00366                         z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
00367                         c__[i__2].r = z__1.r, c__[i__2].i = z__1.i;
00368                     } else {
00369                         i__2 = i__ + j * c_dim1;
00370                         i__3 = i__ + j * c_dim1;
00371                         z__3.r = beta->r * c__[i__3].r - beta->i * c__[i__3]
00372                                 .i, z__3.i = beta->r * c__[i__3].i + beta->i *
00373                                  c__[i__3].r;
00374                         i__4 = i__ + i__ * a_dim1;
00375                         z__4.r = temp1.r * a[i__4].r - temp1.i * a[i__4].i, 
00376                                 z__4.i = temp1.r * a[i__4].i + temp1.i * a[
00377                                 i__4].r;
00378                         z__2.r = z__3.r + z__4.r, z__2.i = z__3.i + z__4.i;
00379                         z__5.r = alpha->r * temp2.r - alpha->i * temp2.i, 
00380                                 z__5.i = alpha->r * temp2.i + alpha->i * 
00381                                 temp2.r;
00382                         z__1.r = z__2.r + z__5.r, z__1.i = z__2.i + z__5.i;
00383                         c__[i__2].r = z__1.r, c__[i__2].i = z__1.i;
00384                     }
00385 /* L90: */
00386                 }
00387 /* L100: */
00388             }
00389         }
00390     } else {
00391 
00392 /*        Form  C := alpha*B*A + beta*C. */
00393 
00394         i__1 = *n;
00395         for (j = 1; j <= i__1; ++j) {
00396             i__2 = j + j * a_dim1;
00397             z__1.r = alpha->r * a[i__2].r - alpha->i * a[i__2].i, z__1.i = 
00398                     alpha->r * a[i__2].i + alpha->i * a[i__2].r;
00399             temp1.r = z__1.r, temp1.i = z__1.i;
00400             if (beta->r == 0. && beta->i == 0.) {
00401                 i__2 = *m;
00402                 for (i__ = 1; i__ <= i__2; ++i__) {
00403                     i__3 = i__ + j * c_dim1;
00404                     i__4 = i__ + j * b_dim1;
00405                     z__1.r = temp1.r * b[i__4].r - temp1.i * b[i__4].i, 
00406                             z__1.i = temp1.r * b[i__4].i + temp1.i * b[i__4]
00407                             .r;
00408                     c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00409 /* L110: */
00410                 }
00411             } else {
00412                 i__2 = *m;
00413                 for (i__ = 1; i__ <= i__2; ++i__) {
00414                     i__3 = i__ + j * c_dim1;
00415                     i__4 = i__ + j * c_dim1;
00416                     z__2.r = beta->r * c__[i__4].r - beta->i * c__[i__4].i, 
00417                             z__2.i = beta->r * c__[i__4].i + beta->i * c__[
00418                             i__4].r;
00419                     i__5 = i__ + j * b_dim1;
00420                     z__3.r = temp1.r * b[i__5].r - temp1.i * b[i__5].i, 
00421                             z__3.i = temp1.r * b[i__5].i + temp1.i * b[i__5]
00422                             .r;
00423                     z__1.r = z__2.r + z__3.r, z__1.i = z__2.i + z__3.i;
00424                     c__[i__3].r = z__1.r, c__[i__3].i = z__1.i;
00425 /* L120: */
00426                 }
00427             }
00428             i__2 = j - 1;
00429             for (k = 1; k <= i__2; ++k) {
00430                 if (upper) {
00431                     i__3 = k + j * a_dim1;
00432                     z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i, 
00433                             z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
00434                             .r;
00435                     temp1.r = z__1.r, temp1.i = z__1.i;
00436                 } else {
00437                     i__3 = j + k * a_dim1;
00438                     z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i, 
00439                             z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
00440                             .r;
00441                     temp1.r = z__1.r, temp1.i = z__1.i;
00442                 }
00443                 i__3 = *m;
00444                 for (i__ = 1; i__ <= i__3; ++i__) {
00445                     i__4 = i__ + j * c_dim1;
00446                     i__5 = i__ + j * c_dim1;
00447                     i__6 = i__ + k * b_dim1;
00448                     z__2.r = temp1.r * b[i__6].r - temp1.i * b[i__6].i, 
00449                             z__2.i = temp1.r * b[i__6].i + temp1.i * b[i__6]
00450                             .r;
00451                     z__1.r = c__[i__5].r + z__2.r, z__1.i = c__[i__5].i + 
00452                             z__2.i;
00453                     c__[i__4].r = z__1.r, c__[i__4].i = z__1.i;
00454 /* L130: */
00455                 }
00456 /* L140: */
00457             }
00458             i__2 = *n;
00459             for (k = j + 1; k <= i__2; ++k) {
00460                 if (upper) {
00461                     i__3 = j + k * a_dim1;
00462                     z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i, 
00463                             z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
00464                             .r;
00465                     temp1.r = z__1.r, temp1.i = z__1.i;
00466                 } else {
00467                     i__3 = k + j * a_dim1;
00468                     z__1.r = alpha->r * a[i__3].r - alpha->i * a[i__3].i, 
00469                             z__1.i = alpha->r * a[i__3].i + alpha->i * a[i__3]
00470                             .r;
00471                     temp1.r = z__1.r, temp1.i = z__1.i;
00472                 }
00473                 i__3 = *m;
00474                 for (i__ = 1; i__ <= i__3; ++i__) {
00475                     i__4 = i__ + j * c_dim1;
00476                     i__5 = i__ + j * c_dim1;
00477                     i__6 = i__ + k * b_dim1;
00478                     z__2.r = temp1.r * b[i__6].r - temp1.i * b[i__6].i, 
00479                             z__2.i = temp1.r * b[i__6].i + temp1.i * b[i__6]
00480                             .r;
00481                     z__1.r = c__[i__5].r + z__2.r, z__1.i = c__[i__5].i + 
00482                             z__2.i;
00483                     c__[i__4].r = z__1.r, c__[i__4].i = z__1.i;
00484 /* L150: */
00485                 }
00486 /* L160: */
00487             }
00488 /* L170: */
00489         }
00490     }
00491 
00492     return 0;
00493 
00494 /*     End of ZSYMM . */
00495 
00496 } /* zsymm_ */


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