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


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