cgerc.c
Go to the documentation of this file.
00001 /* cgerc.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 cgerc_(integer *m, integer *n, complex *alpha, complex *
00017         x, integer *incx, complex *y, integer *incy, complex *a, integer *lda)
00018 {
00019     /* System generated locals */
00020     integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
00021     complex q__1, q__2;
00022 
00023     /* Builtin functions */
00024     void r_cnjg(complex *, complex *);
00025 
00026     /* Local variables */
00027     integer i__, j, ix, jy, kx, info;
00028     complex temp;
00029     extern /* Subroutine */ int xerbla_(char *, integer *);
00030 
00031 /*     .. Scalar Arguments .. */
00032 /*     .. */
00033 /*     .. Array Arguments .. */
00034 /*     .. */
00035 
00036 /*  Purpose */
00037 /*  ======= */
00038 
00039 /*  CGERC  performs the rank 1 operation */
00040 
00041 /*     A := alpha*x*conjg( y' ) + A, */
00042 
00043 /*  where alpha is a scalar, x is an m element vector, y is an n element */
00044 /*  vector and A is an m by n matrix. */
00045 
00046 /*  Arguments */
00047 /*  ========== */
00048 
00049 /*  M      - INTEGER. */
00050 /*           On entry, M specifies the number of rows of the matrix A. */
00051 /*           M must be at least zero. */
00052 /*           Unchanged on exit. */
00053 
00054 /*  N      - INTEGER. */
00055 /*           On entry, N specifies the number of columns of the matrix A. */
00056 /*           N must be at least zero. */
00057 /*           Unchanged on exit. */
00058 
00059 /*  ALPHA  - COMPLEX         . */
00060 /*           On entry, ALPHA specifies the scalar alpha. */
00061 /*           Unchanged on exit. */
00062 
00063 /*  X      - COMPLEX          array of dimension at least */
00064 /*           ( 1 + ( m - 1 )*abs( INCX ) ). */
00065 /*           Before entry, the incremented array X must contain the m */
00066 /*           element vector x. */
00067 /*           Unchanged on exit. */
00068 
00069 /*  INCX   - INTEGER. */
00070 /*           On entry, INCX specifies the increment for the elements of */
00071 /*           X. INCX must not be zero. */
00072 /*           Unchanged on exit. */
00073 
00074 /*  Y      - COMPLEX          array of dimension at least */
00075 /*           ( 1 + ( n - 1 )*abs( INCY ) ). */
00076 /*           Before entry, the incremented array Y must contain the n */
00077 /*           element vector y. */
00078 /*           Unchanged on exit. */
00079 
00080 /*  INCY   - INTEGER. */
00081 /*           On entry, INCY specifies the increment for the elements of */
00082 /*           Y. INCY must not be zero. */
00083 /*           Unchanged on exit. */
00084 
00085 /*  A      - COMPLEX          array of DIMENSION ( LDA, n ). */
00086 /*           Before entry, the leading m by n part of the array A must */
00087 /*           contain the matrix of coefficients. On exit, A is */
00088 /*           overwritten by the updated matrix. */
00089 
00090 /*  LDA    - INTEGER. */
00091 /*           On entry, LDA specifies the first dimension of A as declared */
00092 /*           in the calling (sub) program. LDA must be at least */
00093 /*           max( 1, m ). */
00094 /*           Unchanged on exit. */
00095 
00096 
00097 /*  Level 2 Blas routine. */
00098 
00099 /*  -- Written on 22-October-1986. */
00100 /*     Jack Dongarra, Argonne National Lab. */
00101 /*     Jeremy Du Croz, Nag Central Office. */
00102 /*     Sven Hammarling, Nag Central Office. */
00103 /*     Richard Hanson, Sandia National Labs. */
00104 
00105 
00106 /*     .. Parameters .. */
00107 /*     .. */
00108 /*     .. Local Scalars .. */
00109 /*     .. */
00110 /*     .. External Subroutines .. */
00111 /*     .. */
00112 /*     .. Intrinsic Functions .. */
00113 /*     .. */
00114 
00115 /*     Test the input parameters. */
00116 
00117     /* Parameter adjustments */
00118     --x;
00119     --y;
00120     a_dim1 = *lda;
00121     a_offset = 1 + a_dim1;
00122     a -= a_offset;
00123 
00124     /* Function Body */
00125     info = 0;
00126     if (*m < 0) {
00127         info = 1;
00128     } else if (*n < 0) {
00129         info = 2;
00130     } else if (*incx == 0) {
00131         info = 5;
00132     } else if (*incy == 0) {
00133         info = 7;
00134     } else if (*lda < max(1,*m)) {
00135         info = 9;
00136     }
00137     if (info != 0) {
00138         xerbla_("CGERC ", &info);
00139         return 0;
00140     }
00141 
00142 /*     Quick return if possible. */
00143 
00144     if (*m == 0 || *n == 0 || alpha->r == 0.f && alpha->i == 0.f) {
00145         return 0;
00146     }
00147 
00148 /*     Start the operations. In this version the elements of A are */
00149 /*     accessed sequentially with one pass through A. */
00150 
00151     if (*incy > 0) {
00152         jy = 1;
00153     } else {
00154         jy = 1 - (*n - 1) * *incy;
00155     }
00156     if (*incx == 1) {
00157         i__1 = *n;
00158         for (j = 1; j <= i__1; ++j) {
00159             i__2 = jy;
00160             if (y[i__2].r != 0.f || y[i__2].i != 0.f) {
00161                 r_cnjg(&q__2, &y[jy]);
00162                 q__1.r = alpha->r * q__2.r - alpha->i * q__2.i, q__1.i = 
00163                         alpha->r * q__2.i + alpha->i * q__2.r;
00164                 temp.r = q__1.r, temp.i = q__1.i;
00165                 i__2 = *m;
00166                 for (i__ = 1; i__ <= i__2; ++i__) {
00167                     i__3 = i__ + j * a_dim1;
00168                     i__4 = i__ + j * a_dim1;
00169                     i__5 = i__;
00170                     q__2.r = x[i__5].r * temp.r - x[i__5].i * temp.i, q__2.i =
00171                              x[i__5].r * temp.i + x[i__5].i * temp.r;
00172                     q__1.r = a[i__4].r + q__2.r, q__1.i = a[i__4].i + q__2.i;
00173                     a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00174 /* L10: */
00175                 }
00176             }
00177             jy += *incy;
00178 /* L20: */
00179         }
00180     } else {
00181         if (*incx > 0) {
00182             kx = 1;
00183         } else {
00184             kx = 1 - (*m - 1) * *incx;
00185         }
00186         i__1 = *n;
00187         for (j = 1; j <= i__1; ++j) {
00188             i__2 = jy;
00189             if (y[i__2].r != 0.f || y[i__2].i != 0.f) {
00190                 r_cnjg(&q__2, &y[jy]);
00191                 q__1.r = alpha->r * q__2.r - alpha->i * q__2.i, q__1.i = 
00192                         alpha->r * q__2.i + alpha->i * q__2.r;
00193                 temp.r = q__1.r, temp.i = q__1.i;
00194                 ix = kx;
00195                 i__2 = *m;
00196                 for (i__ = 1; i__ <= i__2; ++i__) {
00197                     i__3 = i__ + j * a_dim1;
00198                     i__4 = i__ + j * a_dim1;
00199                     i__5 = ix;
00200                     q__2.r = x[i__5].r * temp.r - x[i__5].i * temp.i, q__2.i =
00201                              x[i__5].r * temp.i + x[i__5].i * temp.r;
00202                     q__1.r = a[i__4].r + q__2.r, q__1.i = a[i__4].i + q__2.i;
00203                     a[i__3].r = q__1.r, a[i__3].i = q__1.i;
00204                     ix += *incx;
00205 /* L30: */
00206                 }
00207             }
00208             jy += *incy;
00209 /* L40: */
00210         }
00211     }
00212 
00213     return 0;
00214 
00215 /*     End of CGERC . */
00216 
00217 } /* cgerc_ */


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