# ?gemv

Computes a matrix-vector product using a general matrix

## Syntax

FORTRAN 77:

call sgemv( trans, m, n, alpha, a, lda, x, incx, beta, y, incy )

call dgemv( trans, m, n, alpha, a, lda, x, incx, beta, y, incy )

call cgemv( trans, m, n, alpha, a, lda, x, incx, beta, y, incy )

call zgemv( trans, m, n, alpha, a, lda, x, incx, beta, y, incy )

Fortran 95:

call gemv( a, x, y [,alpha][,beta] [,trans] )

## Description

The ?gemv routines perform a matrix-vector operation defined as
`y := alpha*A*x + beta*y,`

or
`y := alpha*A'*x + beta*y,`

or
`y := alpha*conjg(A')*x + beta*y,`

where:

alpha and beta are scalars,

x and y are vectors,

A is an m-by-n matrix.

## Input Parameters

trans

  CHARACTER*1. Specifies the operation:

  if `trans= 'N'` or `'n'`, then `y := alpha*A*x + beta*y`;

  if `trans= 'T'` or `'t'`, then `y := alpha*A'*x + beta*y`;

  if `trans= 'C'` or `'c'`, then `y := alpha *conjg(A')*x + beta*y`.

m

  INTEGER. Specifies the number of rows of the matrix A. The value of m must be at least zero.

n

  INTEGER. Specifies the number of columns of the matrix A. The value of n must be at least zero.

alpha

  REAL for sgemv

  DOUBLE PRECISION for dgemv

  COMPLEX for cgemv

  DOUBLE COMPLEX for zgemv

  Specifies the scalar alpha.

a

  REAL for sgemv

  DOUBLE PRECISION for dgemv

  COMPLEX for cgemv

  DOUBLE COMPLEX for zgemv

  Array, DIMENSION `(lda, n)`. Before entry, the leading m-by-n part of the array a must contain the matrix of coefficients.

lda

  INTEGER. Specifies the first dimension of a as declared in the calling (sub)program. The value of lda must be at least `max(1, m)`.

x

  REAL for sgemv

  DOUBLE PRECISION for dgemv

  COMPLEX for cgemv

  DOUBLE COMPLEX for zgemv

  Array, DIMENSION at least `(1+(n-1)*abs(incx))` when `trans = 'N'` or 'n' and at least `(1+(m - 1)*abs(incx))` otherwise. Before entry, the incremented array x must contain the vector x.

incx

  INTEGER. Specifies the increment for the elements of x.

  The value of incx must not be zero.

beta

  REAL for sgemv

  DOUBLE PRECISION for dgemv

  COMPLEX for cgemv

  DOUBLE COMPLEX for zgemv

  Specifies the scalar beta. When beta is set to zero, then y need not be set on input.

y

  REAL for sgemv

  DOUBLE PRECISION for dgemv

  COMPLEX for cgemv

  DOUBLE COMPLEX for zgemv

  Array, DIMENSION at least `(1 +(m - 1)*abs(incy))` when `trans = 'N'` or 'n' and at least `(1 +(n - 1)*abs(incy))` otherwise. Before entry with non-zero beta, the incremented array y must contain the vector y.

incy

  INTEGER. Specifies the increment for the elements of y.

  The value of incy must not be zero.

## Output Parameters

y

  Updated vector y.

## Fortran 95 Interface Notes

Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.

Specific details for the routine gemv interface are the following:

a

  Holds the matrix A of size (m,n).

x

  Holds the vector of length (rx) where `rx = n` if `trans = 'N', rx = m` otherwise.

y

  Holds the vector of length (ry) where `ry = m` if `trans = 'N', ry = n` otherwise.

trans

  Must be 'N', 'C', or 'T'.

  The default value is 'N'.

alpha

  The default value is 1.

beta

  The default value is 1.

Parent topic: BLAS Level 2 Routines