Previous Next Contents Generated Index Doc Set Home



Product of a Triangular Matrix and a Vector

The subroutines described in this section compute one of the following results for a triangular matrix A and a vector y:



Calling Sequence

CALL DTRMV 
(UPLO, TRANSA, DIAG, N, DA, LDA, DY, INCY)
CALL STRMV 
(UPLO, TRANSA, DIAG, N, SA, LDA, SY, INCY)
CALL ZTRMV 
(UPLO, TRANSA, DIAG, N, ZA, LDA, ZY, INCY)
CALL CTRMV 
(UPLO, TRANSA, DIAG, N, CA, LDA, CY, INCY)






void dtrmv 
(char uplo, char trans, char diag, int n, double *da, 
int lda, double *dx, int incx)
void strmv 
(char uplo, char trans, char diag, int n, float *sa, 
int lda, float *sx, int incx)
void ztrmv 
(char uplo, char trans, char diag, int n, doublecomplex 
*za, int lda, doublecomplex *zx, int incx)
void ctrmv 
(char uplo, char trans, char diag, int n, complex *ca, 
int lda, complex *cx, int incx)

Arguments

UPLO

Indicates whether the values in a matrix reside in the upper or lower triangle of the array in which the matrix is stored. The legal values for UPLO are listed below. Any value not listed below is illegal.

'L' or 'l'

Only the lower triangle of the array will be referenced.

'U' or 'u'

Only the upper triangle of the array will be referenced.

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.

DIAG

Indicates whether or not a triangular matrix is unit triangular. If the matrix is unit triangular then none of the diagonal elements of the array will be accessed. The legal values for DIAG are listed below. Any value not listed below is illegal.

'N' or 'n'

The matrix is not unit triangular.

'U' or 'u'

The matrix is unit triangular.

N

Size of a matrix with N rows and N columns. N 0.

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 max(1,N).

xY

Y and INCY describe a vector 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 is one 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, N
      PARAMETER        (N = 3)
      PARAMETER        (LDA = N)
C
      DOUBLE PRECISION  A(LDA,N), Y(N)
      INTEGER           I, INCY, J
C
      EXTERNAL DTRMV
C
C     Initialize the array A to store in triangular form the
C     matrix A shown below.  Initialize the array Y to store
C     the vector y shown below.
C
C         1              7
C     A = 2  4       y = 8
C         3  5  6        9
C
      DATA A / 1.0D0, 2.0D0, 3.0D0, 8D8, 4.0D0, 5.0D0, 8D8, 8D8,
     $         6.0D0 /
      DATA Y / 7.0D0, 8.0D0, 9.0D0 /
C
      PRINT 1000
      DO 10, I = 1, N
        PRINT 1010, (A(I,J), J = 1, I)
   10 CONTINUE
      PRINT 1020
      PRINT 1030, Y
      INCY = 1
      CALL DTRMV ('LOWER TRIANGULAR A', 'NOT TRANSPOSED A',
     $            'NOT UNIT DIAGONAL A', N, A, LDA, Y, INCY)
      PRINT 1040
      PRINT 1030, Y
C
 1000 FORMAT (1X, 'A:')
 1010 FORMAT (1X, 3(2X, F5.1))
 1020 FORMAT (/1X, 'y:')
 1030 FORMAT (1X, 2X, F5.1)
 1040 FORMAT (/1X, 'A*y:')
C
      END
 

Sample Output

 
 A:
     1.0
     2.0    4.0
     3.0    5.0    6.0



 y:
     7.0
     8.0
     9.0



 A*y:
     7.0
    46.0
   115.0






Previous Next Contents Generated Index Doc Set Home