c@427: /* dger.f -- translated by f2c (version 20061008). c@427: You must link the resulting object file with libf2c: c@427: on Microsoft Windows system, link with libf2c.lib; c@427: on Linux or Unix systems, link with .../path/to/libf2c.a -lm c@427: or, if you install libf2c.a in a standard place, with -lf2c -lm c@427: -- in that order, at the end of the command line, as in c@427: cc *.o -lf2c -lm c@427: Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., c@427: c@427: http://www.netlib.org/f2c/libf2c.zip c@427: */ c@427: c@427: #include "f2c.h" c@427: #include "blaswrap.h" c@427: c@427: /* Subroutine */ int dger_(integer *m, integer *n, doublereal *alpha, c@427: doublereal *x, integer *incx, doublereal *y, integer *incy, c@427: doublereal *a, integer *lda) c@427: { c@427: /* System generated locals */ c@427: integer a_dim1, a_offset, i__1, i__2; c@427: c@427: /* Local variables */ c@427: integer i__, j, ix, jy, kx, info; c@427: doublereal temp; c@427: extern /* Subroutine */ int xerbla_(char *, integer *); c@427: c@427: /* .. Scalar Arguments .. */ c@427: /* .. */ c@427: /* .. Array Arguments .. */ c@427: /* .. */ c@427: c@427: /* Purpose */ c@427: /* ======= */ c@427: c@427: /* DGER performs the rank 1 operation */ c@427: c@427: /* A := alpha*x*y' + A, */ c@427: c@427: /* where alpha is a scalar, x is an m element vector, y is an n element */ c@427: /* vector and A is an m by n matrix. */ c@427: c@427: /* Arguments */ c@427: /* ========== */ c@427: c@427: /* M - INTEGER. */ c@427: /* On entry, M specifies the number of rows of the matrix A. */ c@427: /* M must be at least zero. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* N - INTEGER. */ c@427: /* On entry, N specifies the number of columns of the matrix A. */ c@427: /* N must be at least zero. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* ALPHA - DOUBLE PRECISION. */ c@427: /* On entry, ALPHA specifies the scalar alpha. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* X - DOUBLE PRECISION array of dimension at least */ c@427: /* ( 1 + ( m - 1 )*abs( INCX ) ). */ c@427: /* Before entry, the incremented array X must contain the m */ c@427: /* element vector x. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* INCX - INTEGER. */ c@427: /* On entry, INCX specifies the increment for the elements of */ c@427: /* X. INCX must not be zero. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* Y - DOUBLE PRECISION array of dimension at least */ c@427: /* ( 1 + ( n - 1 )*abs( INCY ) ). */ c@427: /* Before entry, the incremented array Y must contain the n */ c@427: /* element vector y. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* INCY - INTEGER. */ c@427: /* On entry, INCY specifies the increment for the elements of */ c@427: /* Y. INCY must not be zero. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */ c@427: /* Before entry, the leading m by n part of the array A must */ c@427: /* contain the matrix of coefficients. On exit, A is */ c@427: /* overwritten by the updated matrix. */ c@427: c@427: /* LDA - INTEGER. */ c@427: /* On entry, LDA specifies the first dimension of A as declared */ c@427: /* in the calling (sub) program. LDA must be at least */ c@427: /* max( 1, m ). */ c@427: /* Unchanged on exit. */ c@427: c@427: c@427: /* Level 2 Blas routine. */ c@427: c@427: /* -- Written on 22-October-1986. */ c@427: /* Jack Dongarra, Argonne National Lab. */ c@427: /* Jeremy Du Croz, Nag Central Office. */ c@427: /* Sven Hammarling, Nag Central Office. */ c@427: /* Richard Hanson, Sandia National Labs. */ c@427: c@427: c@427: /* .. Parameters .. */ c@427: /* .. */ c@427: /* .. Local Scalars .. */ c@427: /* .. */ c@427: /* .. External Subroutines .. */ c@427: /* .. */ c@427: /* .. Intrinsic Functions .. */ c@427: /* .. */ c@427: c@427: /* Test the input parameters. */ c@427: c@427: /* Parameter adjustments */ c@427: --x; c@427: --y; c@427: a_dim1 = *lda; c@427: a_offset = 1 + a_dim1; c@427: a -= a_offset; c@427: c@427: /* Function Body */ c@427: info = 0; c@427: if (*m < 0) { c@427: info = 1; c@427: } else if (*n < 0) { c@427: info = 2; c@427: } else if (*incx == 0) { c@427: info = 5; c@427: } else if (*incy == 0) { c@427: info = 7; c@427: } else if (*lda < max(1,*m)) { c@427: info = 9; c@427: } c@427: if (info != 0) { c@427: xerbla_("DGER ", &info); c@427: return 0; c@427: } c@427: c@427: /* Quick return if possible. */ c@427: c@427: if (*m == 0 || *n == 0 || *alpha == 0.) { c@427: return 0; c@427: } c@427: c@427: /* Start the operations. In this version the elements of A are */ c@427: /* accessed sequentially with one pass through A. */ c@427: c@427: if (*incy > 0) { c@427: jy = 1; c@427: } else { c@427: jy = 1 - (*n - 1) * *incy; c@427: } c@427: if (*incx == 1) { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: if (y[jy] != 0.) { c@427: temp = *alpha * y[jy]; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: a[i__ + j * a_dim1] += x[i__] * temp; c@427: /* L10: */ c@427: } c@427: } c@427: jy += *incy; c@427: /* L20: */ c@427: } c@427: } else { c@427: if (*incx > 0) { c@427: kx = 1; c@427: } else { c@427: kx = 1 - (*m - 1) * *incx; c@427: } c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: if (y[jy] != 0.) { c@427: temp = *alpha * y[jy]; c@427: ix = kx; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: a[i__ + j * a_dim1] += x[ix] * temp; c@427: ix += *incx; c@427: /* L30: */ c@427: } c@427: } c@427: jy += *incy; c@427: /* L40: */ c@427: } c@427: } c@427: c@427: return 0; c@427: c@427: /* End of DGER . */ c@427: c@427: } /* dger_ */