c@427: /* dgemv.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 dgemv_(char *trans, integer *m, integer *n, doublereal * c@427: alpha, doublereal *a, integer *lda, doublereal *x, integer *incx, c@427: doublereal *beta, doublereal *y, integer *incy) 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, iy, jx, jy, kx, ky, info; c@427: doublereal temp; c@427: integer lenx, leny; c@427: extern logical lsame_(char *, char *); 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: /* DGEMV performs one of the matrix-vector operations */ c@427: c@427: /* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */ c@427: c@427: /* where alpha and beta are scalars, x and y are vectors and A is an */ c@427: /* m by n matrix. */ c@427: c@427: /* Arguments */ c@427: /* ========== */ c@427: c@427: /* TRANS - CHARACTER*1. */ c@427: /* On entry, TRANS specifies the operation to be performed as */ c@427: /* follows: */ c@427: c@427: /* TRANS = 'N' or 'n' y := alpha*A*x + beta*y. */ c@427: c@427: /* TRANS = 'T' or 't' y := alpha*A'*x + beta*y. */ c@427: c@427: /* TRANS = 'C' or 'c' y := alpha*A'*x + beta*y. */ c@427: c@427: /* Unchanged on exit. */ 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: /* 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. */ c@427: /* Unchanged on exit. */ 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: /* X - DOUBLE PRECISION array of DIMENSION at least */ c@427: /* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' */ c@427: /* and at least */ c@427: /* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. */ c@427: /* Before entry, the incremented array X must contain the */ c@427: /* 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: /* BETA - DOUBLE PRECISION. */ c@427: /* On entry, BETA specifies the scalar beta. When BETA is */ c@427: /* supplied as zero then Y need not be set on input. */ c@427: /* Unchanged on exit. */ c@427: c@427: /* Y - DOUBLE PRECISION array of DIMENSION at least */ c@427: /* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' */ c@427: /* and at least */ c@427: /* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. */ c@427: /* Before entry with BETA non-zero, the incremented array Y */ c@427: /* must contain the vector y. On exit, Y is overwritten by the */ c@427: /* updated vector y. */ 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: 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 Functions .. */ 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: a_dim1 = *lda; c@427: a_offset = 1 + a_dim1; c@427: a -= a_offset; c@427: --x; c@427: --y; c@427: c@427: /* Function Body */ c@427: info = 0; c@427: if (! lsame_(trans, "N") && ! lsame_(trans, "T") && ! lsame_(trans, "C") c@427: ) { c@427: info = 1; c@427: } else if (*m < 0) { c@427: info = 2; c@427: } else if (*n < 0) { c@427: info = 3; c@427: } else if (*lda < max(1,*m)) { c@427: info = 6; c@427: } else if (*incx == 0) { c@427: info = 8; c@427: } else if (*incy == 0) { c@427: info = 11; c@427: } c@427: if (info != 0) { c@427: xerbla_("DGEMV ", &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. && *beta == 1.) { c@427: return 0; c@427: } c@427: c@427: /* Set LENX and LENY, the lengths of the vectors x and y, and set */ c@427: /* up the start points in X and Y. */ c@427: c@427: if (lsame_(trans, "N")) { c@427: lenx = *n; c@427: leny = *m; c@427: } else { c@427: lenx = *m; c@427: leny = *n; c@427: } c@427: if (*incx > 0) { c@427: kx = 1; c@427: } else { c@427: kx = 1 - (lenx - 1) * *incx; c@427: } c@427: if (*incy > 0) { c@427: ky = 1; c@427: } else { c@427: ky = 1 - (leny - 1) * *incy; 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: /* First form y := beta*y. */ c@427: c@427: if (*beta != 1.) { c@427: if (*incy == 1) { c@427: if (*beta == 0.) { c@427: i__1 = leny; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: y[i__] = 0.; c@427: /* L10: */ c@427: } c@427: } else { c@427: i__1 = leny; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: y[i__] = *beta * y[i__]; c@427: /* L20: */ c@427: } c@427: } c@427: } else { c@427: iy = ky; c@427: if (*beta == 0.) { c@427: i__1 = leny; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: y[iy] = 0.; c@427: iy += *incy; c@427: /* L30: */ c@427: } c@427: } else { c@427: i__1 = leny; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: y[iy] = *beta * y[iy]; c@427: iy += *incy; c@427: /* L40: */ c@427: } c@427: } c@427: } c@427: } c@427: if (*alpha == 0.) { c@427: return 0; c@427: } c@427: if (lsame_(trans, "N")) { c@427: c@427: /* Form y := alpha*A*x + y. */ c@427: c@427: jx = kx; c@427: if (*incy == 1) { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: if (x[jx] != 0.) { c@427: temp = *alpha * x[jx]; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: y[i__] += temp * a[i__ + j * a_dim1]; c@427: /* L50: */ c@427: } c@427: } c@427: jx += *incx; c@427: /* L60: */ c@427: } c@427: } else { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: if (x[jx] != 0.) { c@427: temp = *alpha * x[jx]; c@427: iy = ky; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: y[iy] += temp * a[i__ + j * a_dim1]; c@427: iy += *incy; c@427: /* L70: */ c@427: } c@427: } c@427: jx += *incx; c@427: /* L80: */ c@427: } c@427: } c@427: } else { c@427: c@427: /* Form y := alpha*A'*x + y. */ c@427: c@427: jy = ky; c@427: if (*incx == 1) { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: temp = 0.; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: temp += a[i__ + j * a_dim1] * x[i__]; c@427: /* L90: */ c@427: } c@427: y[jy] += *alpha * temp; c@427: jy += *incy; c@427: /* L100: */ c@427: } c@427: } else { c@427: i__1 = *n; c@427: for (j = 1; j <= i__1; ++j) { c@427: temp = 0.; c@427: ix = kx; c@427: i__2 = *m; c@427: for (i__ = 1; i__ <= i__2; ++i__) { c@427: temp += a[i__ + j * a_dim1] * x[ix]; c@427: ix += *incx; c@427: /* L110: */ c@427: } c@427: y[jy] += *alpha * temp; c@427: jy += *incy; c@427: /* L120: */ c@427: } c@427: } c@427: } c@427: c@427: return 0; c@427: c@427: /* End of DGEMV . */ c@427: c@427: } /* dgemv_ */