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


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