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


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