dger.c
Go to the documentation of this file.
00001 /* dger.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 dger_(integer *m, integer *n, doublereal *alpha, 
00017         doublereal *x, integer *incx, doublereal *y, integer *incy, 
00018         doublereal *a, integer *lda)
00019 {
00020     /* System generated locals */
00021     integer a_dim1, a_offset, i__1, i__2;
00022 
00023     /* Local variables */
00024     integer i__, j, ix, jy, kx, info;
00025     doublereal temp;
00026     extern /* Subroutine */ int xerbla_(char *, integer *);
00027 
00028 /*     .. Scalar Arguments .. */
00029 /*     .. */
00030 /*     .. Array Arguments .. */
00031 /*     .. */
00032 
00033 /*  Purpose */
00034 /*  ======= */
00035 
00036 /*  DGER   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  - DOUBLE PRECISION. */
00057 /*           On entry, ALPHA specifies the scalar alpha. */
00058 /*           Unchanged on exit. */
00059 
00060 /*  X      - DOUBLE PRECISION 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      - DOUBLE PRECISION 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      - DOUBLE PRECISION 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_("DGER  ", &info);
00136         return 0;
00137     }
00138 
00139 /*     Quick return if possible. */
00140 
00141     if (*m == 0 || *n == 0 || *alpha == 0.) {
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             if (y[jy] != 0.) {
00157                 temp = *alpha * y[jy];
00158                 i__2 = *m;
00159                 for (i__ = 1; i__ <= i__2; ++i__) {
00160                     a[i__ + j * a_dim1] += x[i__] * temp;
00161 /* L10: */
00162                 }
00163             }
00164             jy += *incy;
00165 /* L20: */
00166         }
00167     } else {
00168         if (*incx > 0) {
00169             kx = 1;
00170         } else {
00171             kx = 1 - (*m - 1) * *incx;
00172         }
00173         i__1 = *n;
00174         for (j = 1; j <= i__1; ++j) {
00175             if (y[jy] != 0.) {
00176                 temp = *alpha * y[jy];
00177                 ix = kx;
00178                 i__2 = *m;
00179                 for (i__ = 1; i__ <= i__2; ++i__) {
00180                     a[i__ + j * a_dim1] += x[ix] * temp;
00181                     ix += *incx;
00182 /* L30: */
00183                 }
00184             }
00185             jy += *incy;
00186 /* L40: */
00187         }
00188     }
00189 
00190     return 0;
00191 
00192 /*     End of DGER  . */
00193 
00194 } /* dger_ */


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