Previous Next Contents Generated Index Doc Set Home



Product of a Matrix in Banded Storage and a Vector

The subroutines described in this section compute one of the following results for a matrix A in banded storage and a vector x:



Calling Sequence

CALL DGBMV 
(TRANSA, M, N, NSUB, NSUPER, DALPHA, DA, LDA, DX, INCX, 
DBETA, DY, INCY)
CALL SGBMV 
(TRANSA, M, N, NSUB, NSUPER, SALPHA, SA, LDA, SX, INCX, 
SBETA, SY, INCY)
CALL ZGBMV 
(TRANSA, M, N, NSUB, NSUPER, ZALPHA, ZA, LDA, ZX, INCX, 
ZBETA, ZY, INCY)
CALL CGBMV 
(TRANSA, M, N, NSUB, NSUPER, CALPHA, CA, LDA, CX, INCX, 
CBETA, CY, INCY)






void dgbmv 
(char trans, int m, int n, int nsub, int nsuper, double 
dalpha, double *da, int lda, double *dx, int incx, 
double dbeta, double *dy, int incy)
void sgbmv 
(char trans, int m, int n, int nsub, int nsuper, float 
salpha, float *sa, int lda, float *sx, int incx, float 
sbeta, float *sy, int incy)
void zgbmv 
(char trans, int m, int n, int nsub, int nsuper, 
doublecomplex *zalpha, doublecomplex *za, int lda, 
doublecomplex *zx, int incx, doublecomplex *zbeta, 
doublecomplex *zy, int incy)
void cgbmv 
(char trans, int m, int n, int nsub, int nsuper, 
complex *calpha, complex *ca, int lda, complex *cx, int 
incx, complex *cbeta, complex *cy, int incy)

Arguments

TRANSA

Indicates how to use the matrix stored in the array argument. The legal values for TRANSA are listed below. Any value not listed below is illegal.

'N' or 'n'

Use the matrix as it is stored in the array.

'T' or 't'

Use the transpose of the matrix.

'C' or 'c'

Use the conjugate transpose of the matrix.

M

Number of rows in the matrix A. M 0.

N

Number of columns in the matrix A. N 0.

NSUB

Number of subdiagonals of A. N-1 NSUB 0 but if N = 0 then NSUB = 0.

NSUPER

Number of superdiagonals of A. N-1 NSUPER 0 but if N = 0 then NSUPER = 0.

xALPHA

Scalar that scales the input value of the matrix A.

xA

Two-dimensional array that contains the input matrix.

LDA

Leading dimension of the array A as specified in a dimension or type statement. LDA NSUB + 1 + NSUPER.

xX

X and INCX describe a vector of length N if TRANSA = 'N' or 'n', otherwise of length M. X contains an input vector.

INCX

Scalar that contains the storage spacing between successive elements of the vector. INCX 0. If INCX = 1, then elements of the vector are contiguous in memory. INCX may take on values besides 1 to allow the programmer to extract from a matrix a vector that is not stored in contiguous memory locations.

If X is a one-dimensional array and INCX = -1 then the array will be accessed in reverse order.

If X is a two-dimensional array and INCX = LDA then the vector will be a row of the array.

If X is a two-dimensional array and INCX = LDA+1 then the vector will be a diagonal of the array.

xBETA

Scalar that scales the input value of the vector Y.

xY

Y and INCY describe a vector of length M if TRANSA = 'N' or 'n', otherwise of length N.

On entry, an input vector.

On exit, a result vector.

INCY

Scalar that contains the storage spacing between successive elements of the vector Y. INCY 0. If INCY = 1, then elements of the vector are contiguous in memory. INCY may take on values besides 1 to allow the programmer to extract from a matrix a vector that is not stored in contiguous memory locations.

If Y is a one-dimensional array and INCY = -1 then the array will be accessed in reverse order.

If Y is a two-dimensional array and INCY = LDA then the vector will be a row of the array.

If Y is a two-dimensional array and INCY = LDA+1 then the vector will be a diagonal of the array.

Sample Program

 
      PROGRAM TEST
      IMPLICIT NONE
C
      INTEGER           LDA, M, N, NSUB, NSUPER
      PARAMETER        (M = 5)
      PARAMETER        (N = 5)
      PARAMETER        (NSUB = 0)
      PARAMETER        (NSUPER = 2)
      PARAMETER        (LDA = NSUB + 1 + NSUPER)
C
      INTEGER           I, J
      DOUBLE PRECISION  A(LDA,N), ALPHA, BETA, X(N), Y(N)
C
      EXTERNAL DGBMV
      INTRINSIC MIN
C
C     Initialize the array A to store in banded form the matrix A 
C     with two superdiagonals and no subdiagonals shown below. 
C     Initialize the arrays X and Y to store the vectors x and y
C     shown below.
C
C           1  1  1              1        1
C              2  2  2           2        1
C       A =       3  3  3    x = 3    y = 1
C                    4  4        4        1
C                       5        5        1
C
      DATA A / 8.0D8, 8.0D8, 1.0D0, 8.0D8, 1.0D0, 2.0D0,
     $         1.0D0, 2.0D0, 3.0D0, 2.0D0, 3.0D0, 4.0D0,
     $         3.0D0, 4.0D0, 5.0D0 /
      DATA X / 1.0D0, 2.0D0, 3.0D0, 4.0D0, 5.0D0 /
      DATA Y / 1.0D0, 1.0D0, 1.0D0, 1.0D0, 1.0D0 /
C
      PRINT 1000
      DO 10, I = 1, N
        PRINT 1010, (0.0D0, J = 1, I - 1),
     $     (A(3 - J,J + I), J = 0, MIN(5 - I, 2)), 
     $     (0.0D0, J = 1, 3 - I)
   10 CONTINUE
      PRINT 1020
      DO 20, I = 1, 3
        PRINT 1010, (A(I,J), J = 1, N)
   20 CONTINUE
      PRINT 1030
      PRINT 1040, (X(I), Y(I), I = 1, N)
      ALPHA = 2.0D0
      BETA = 3.0D0
      CALL DGBMV ('NO TRANSPOSE A', M, N, NSUB, NSUPER, ALPHA,
     $            A, LDA, X, 1, BETA, Y, 1)
      PRINT 1050
      PRINT 1060, Y
C
 1000 FORMAT (/1X, 'Array A in full form:')
 1010 FORMAT (1X, 5(2X, F4.1))
 1020 FORMAT (/1X, 'Array A in packed form: ',
     $        ' (* in unused fields)')
 1030 FORMAT (/5X, 'x', 5X, 'y')
 1040 FORMAT (3X, F4.1, 2X, F4.1)
 1050 FORMAT (/1X, 'Ax + y:')
 1060 FORMAT (3X, F4.1)
C
      END
 

Sample Output




 Array A in full form:
    1.0   1.0   1.0   0.0   0.0
    0.0   2.0   2.0   2.0   0.0
    0.0   0.0   3.0   3.0   3.0
    0.0   0.0   0.0   4.0   4.0
    0.0   0.0   0.0   0.0   5.0



 Array A in packed form:  (* in unused fields)
   ****  ****   1.0   2.0   3.0
   ****   1.0   2.0   3.0   4.0
    1.0   2.0   3.0   4.0   5.0



     x     y
    1.0   1.0
    2.0   1.0
    3.0   1.0
    4.0   1.0
    5.0   1.0



 Ax + y:
   15.0
   39.0
   75.0
   75.0
   53.0






Previous Next Contents Generated Index Doc Set Home