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


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