[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

# Technical Reference: Base Operating System and Extensions , Volume 2

## SGEMV, DGEMV, CGEMV, or ZGEMV Subroutine

### Purpose

Performs matrix-vector operation with general matrices.

### Library

BLAS Library (libblas.a)

### FORTRAN Syntax

SUBROUTINE SGEMV(TRANS, M, N, ALPHA, A, LDA, X,
INCX, BETA, Y, INCY)
REAL ALPHA, BETA
INTEGER INCX, INCY, LDA, M, N
CHARACTER*1 TRANS
REAL A(LDA,*), X(*), Y(*)

```SUBROUTINE DGEMV(TRANS, M, N, ALPHA, A, LDA, X,
INCX, BETA, Y, INCY)
DOUBLE PRECISION ALPHA,BETA
INTEGER INCX,INCY,LDA,M,N
CHARACTER*1 TRANS
DOUBLE PRECISION A(LDA,*), X(*), Y(*)
```

```SUBROUTINE CGEMV(TRANS, M, N, ALPHA, A, LDA, X,
INCX, BETA, Y, INCY)
COMPLEX ALPHA,BETA
INTEGER INCX,INCY,LDA,M,N
CHARACTER*1 TRANS
COMPLEX A(LDA,*), X(*), Y(*)
```

```SUBROUTINE ZGEMV(TRANS, M, N, ALPHA, A, LDA, X,
INCX, BETA, Y, INCY)
COMPLEX*16 ALPHA,BETA
INTEGER INCX,INCY,LDA,M,N
CHARACTER*1 TRANS
COMPLEX*16 A(LDA,*), X(*), Y(*)
```

### Description

The SGEMV, DGEMV, CGEMV, or ZGEMV subroutine performs one of the following matrix-vector operations:

y := alpha * A * x + beta * y

OR

y := alpha * A' * x + beta * y

where alpha and beta are scalars, x and y are vectors, and A is an M by N matrix.

### Parameters

 TRANS On entry, TRANS specifies the operation to be performed as follows: TRANS = 'N' or 'n' y := alpha * A * x + beta * y TRANS = 'T' or 't' y := alpha * A' * x + beta * y TRANS = 'C' or 'c' y := alpha * A' * x + beta * y Unchanged on exit. M On entry, M specifies the number of rows of the matrix A; M must be at least 0; unchanged on exit. N On entry, N specifies the number of columns of the matrix A; N must be at least 0; unchanged on exit. ALPHA On entry, ALPHA specifies the scalar alpha; unchanged on exit. A An array of dimension ( LDA, N ); on entry, the leading M by N part of the array A must contain the matrix of coefficients; unchanged on exit. LDA On entry, LDA specifies the first dimension of A as declared in the calling (sub) program; LDA must be at least max( 1, M ); unchanged on exit. X A vector of dimension at least (1 + (N-1) * abs( INCX ) ) when TRANS = 'N' or 'n', otherwise, at least (1 + (M-1) * abs( INCX ) ); on entry, the incremented array X must contain the vector x; unchanged on exit. INCX On entry, INCX specifies the increment for the elements of X; INCX must not be 0; unchanged on exit. BETA On entry, BETA specifies the scalar beta; when BETA is supplied as 0, Y need not be set on input; unchanged on exit. Y A vector of dimension at least 1 + (M-1) * abs( INCY ) ) when TRANS = 'N' or 'n', otherwise at least (1 + (N-1) * abs( INCY ) ); on entry, with BETA nonzero, the incremented array Y must contain the vector y; on exit, Y is overwritten by the updated vector y. INCY On entry, INCY specifies the increment for the elements of Y; INCY must not be 0; unchanged on exit.

[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]