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


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