SGEMV and DGEMV compute the matrix-vector product for either a real general matrix or its transpose, using the scalars alpha and beta, vectors x and y, and matrix A or its transpose:
CGEMV and ZGEMV compute the matrix-vector product for either a complex general matrix, its transpose, or its conjugate transpose, using the scalars alpha and beta, vectors x and y, and matrix A, its transpose, or its conjugate transpose:
SGEMX and DGEMX compute the matrix-vector product for a real general matrix, using the scalar alpha, vectors x and y, and matrix A:
SGEMTX and DGEMTX compute the matrix-vector product for the transpose of a real general matrix, using the scalar alpha, vectors x and y, and the transpose of matrix A:
alpha, beta, x, y, A | Subprogram |
Short-precision real | SGEMV, SGEMX, and SGEMTX |
Long-precision real | DGEMV, DGEMX, and DGEMTX |
Short-precision complex | CGEMV |
Long-precision complex | ZGEMV |
Fortran | CALL SGEMV | DGEMV | CGEMV | ZGEMV (transa, m,
n, alpha, a, lda, x,
incx, beta, y, incy)
CALL SGEMX | DGEMX | SGEMTX | DGEMTX ( m, n, alpha, a, lda, x, incx, y, incy) |
C and C++ | sgemv | dgemv | cgemv | zgemv (transa, m, n,
alpha, a, lda, x, incx,
beta, y, incy);
sgemx | dgemx | sgemtx | dgemtx ( m, n, alpha, a, lda, x, incx, y, incy); |
PL/I | CALL SGEMV | DGEMV | CGEMV | ZGEMV (transa, m,
n, alpha, a, lda, x,
incx, beta, y, incy);
CALL SGEMX | DGEMX | SGEMTX | DGEMTX ( m, n, alpha, a, lda, x, incx, y, incy); |
If transa = 'N', A is used in the computation.
If transa = 'T', AT is used in the computation.
If transa = 'C', AH is used in the computation.
Specified as: a single character. It must be 'N', 'T', or 'C'.
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it is the length of vector y.
For SGEMTX and DGEMTX, it is the length of vector x.
Specified as: a fullword integer; 0 <= m <= lda.
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it is the length of vector x.
For SGEMTX and DGEMTX, it is the length of vector y.
Specified as: a fullword integer; n >= 0.
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, A is used in the computation.
For SGEMTX and DGEMTX, AT is used in the computation.
Specified as: an lda by (at least) n array, containing numbers of the data type indicated in Table 62.
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it has length n.
For SGEMTX and DGEMTX, it has length m.
Specified as: a one-dimensional array, containing numbers of the data type indicated in Table 62, where:
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it must have at least 1+(n-1)|incx| elements.
For SGEMTX and DGEMTX, it must have at least 1+(m-1)|incx| elements.
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it has length m.
For SGEMTX and DGEMTX, it has length n.
Specified as: a one-dimensional array, containing numbers of the data type indicated in Table 62, where:
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it must have at least 1+(m-1)|incy| elements.
For SGEMTX and DGEMTX, it must have at least 1+(n-1)|incy| elements.
For SGEMV, DGEMV, CGEMV, and ZGEMV:
For SGEMX and DGEMX, it has length m.
For SGEMTX and DGEMTX, it has length n.
Returned as: a one-dimensional array, containing numbers of the data type indicated in Table 62.
The possible computations that can be performed by these subroutines are described in the following sections. Varying implementation techniques are used for this computation to improve performance. As a result, accuracy of the computational result may vary for different computations.
For SGEMV, CGEMV, SGEMX, and SGEMTX, intermediate results are accumulated in long precision. Occasionally, for performance reasons, these intermediate results are stored.
See references [34], [35], [38], [46], and [79]. No computation is performed if m or n is 0 or if alpha is zero and beta is one.
For SGEMV, DGEMV, CGEMV, and ZGEMV, the matrix-vector product for a general matrix:
is expressed as follows:
For SGEMX and DGEMX, the matrix-vector product for a real general matrix:
is expressed as follows:
In these expressions:
For SGEMV, DGEMV, CGEMV and ZGEMV, the matrix-vector product for the transpose of a general matrix:
is expressed as follows:
For SGEMTX and DGEMTX, the matrix-vector product for the transpose of a real general matrix:
is expressed as follows:
In these expressions:
For CGEMV and ZGEMV, the matrix-vector product for the conjugate transpose of a general matrix:
is expressed as follows:
where:
Unable to allocate internal work area (for SGEMV, DGEMV, CGEMV, and ZGEMV).
None
This example shows the computation for TRANSA equal to 'N', where the real general matrix A is used in the computation. Because lda is 10 and n is 3, array A must be declared as A(E1:E2,F1:F2), where E2-E1+1=10 and F2-F1+1 >= 3. In this example, array A is declared as A(1:10,0:2).
TRANSA M N ALPHA A LDA X INCX BETA Y INCY | | | | | | | | | | | CALL SGEMV( 'N' , 4 , 3 , 1.0 , A(1,0) , 10 , X , 1 , 1.0 , Y , 2 )
* * | 1.0 2.0 3.0 | | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | A = | . . . | | . . . | | . . . | | . . . | | . . . | | . . . | * *
X = (3.0, 2.0, 1.0) Y = (4.0, . , 5.0, . , 2.0, . , 3.0)
Y = (14.0, . , 19.0, . , 17.0, . , 20.0)
This example shows the computation for TRANSA equal to 'T', where the transpose of the real general matrix A is used in the computation. Array A must follow the same rules as given in Example 1. In this example, array A is declared as A(-1:8,1:3).
TRANSA M N ALPHA A LDA X INCX BETA Y INCY | | | | | | | | | | | CALL SGEMV( 'T' , 4 , 3 , 1.0 , A(-1,1) , 10 , X , 1 , 2.0 , Y , 2 )
Y = (28.0, . , 24.0, . , 29.0)
This example shows the computation for TRANSA equal to 'N', where the complex general matrix A is used in the computation.
TRANSA M N ALPHA A LDA X INCX BETA Y INCY | | | | | | | | | | | CALL CGEMV( 'N' , 5 , 3 , ALPHA , A , 10 , X , 1 , BETA , Y , 1 ) ALPHA = (1.0, 0.0)
* * | (1.0, 2.0) (3.0, 5.0) (2.0, 0.0) | | (2.0, 3.0) (7.0, 9.0) (4.0, 8.0) | | (7.0, 4.0) (1.0, 4.0) (6.0, 0.0) | | (8.0, 2.0) (2.0, 5.0) (8.0, 0.0) | A = | (9.0, 1.0) (3.0, 6.0) (1.0, 0.0) | | . . . | | . . . | | . . . | | . . . | | . . . | * *
X = ((1.0, 2.0), (4.0, 0.0), (1.0, 1.0)) BETA = (1.0, 0.0) Y = ((1.0, 2.0), (4.0, 0.0), (1.0, -1.0), (3.0, 4.0), (2.0, 0.0))
Y = ((12.0, 28.0), (24.0, 55.0), (10.0, 39.0), (23.0, 50.0), (22.0, 44.0))
This example shows the computation for TRANSA equal to 'T', where the transpose of complex general matrix A is used in the computation. Because beta is zero, the result of the computation is alphaATx
TRANSA M N ALPHA A LDA X INCX BETA Y INCY | | | | | | | | | | | CALL CGEMV( 'T' , 5 , 3 , ALPHA , A , 10 , X , 1 , BETA , Y , 1 )
Y = ((42.0, 67.0), (10.0, 87.0), (50.0, 74.0))
This example shows the computation for TRANSA equal to 'C', where the conjugate transpose of the complex general matrix A is used in the computation.
TRANSA M N ALPHA A LDA X INCX BETA Y INCY | | | | | | | | | | | CALL CGEMV( 'C' , 5 , 3 , ALPHA , A , 10 , X , 1 , BETA , Y , 1 )
Y = ((-73.0, -13.0), (-74.0, 57.0), (-49.0, -11.0))
This example shows a matrix, A, contained in a larger array, A. The strides of vectors x and y are positive. Because lda is 10 and n is 3, array A must be declared as A(E1:E2,F1:F2), where E2-E1+1=10 and F2-F1+1 >= 3. For this example, array A is declared as A(1:10,0:2).
M N ALPHA A LDA X INCX Y INCY | | | | | | | | | CALL SGEMX( 4 , 3 , 1.0 , A(1,0) , 10 , X , 1 , Y , 2 )
* * | 1.0 2.0 3.0 | | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | A = | . . . | | . . . | | . . . | | . . . | | . . . | | . . . | * *
X = (3.0, 2.0, 1.0) Y = (4.0, . , 5.0, . , 2.0, . , 3.0)
Y = (14.0, . , 19.0, . , 17.0, . , 20.0)
This example shows a matrix, A, contained in a larger array, A. The strides of vectors x and y are of opposite sign. For y, which has negative stride, processing begins at element Y(7), which is 4.0. Array A must follow the same rules as given in Example 6. For this example, array A is declared as A(-1:8,1:3).
M N ALPHA A LDA X INCX Y INCY | | | | | | | | | CALL SGEMX( 4 , 3 , 1.0 , A(-1,1) , 10 , X , 1 , Y , -2 )
Y = (20.0, . , 17.0, . , 19.0, . , 14.0)
This example shows a matrix, A, contained in a larger array, A, and the first element of the matrix is not the first element of the array. Array A must follow the same rules as given in Example 6. For this example, array A is declared as A(1:10,1:3).
M N ALPHA A LDA X INCX Y INCY | | | | | | | | | CALL SGEMX( 4 , 3 , 1.0 , A(5,1) , 10 , X , 1 , Y , 1 )
* * | . . . | | . . . | | . . . | | . . . | A = | 1.0 2.0 3.0 | | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | | . . . | | . . . | * *
X = (3.0, 2.0, 1.0) Y = (4.0, 5.0, 2.0, 3.0)
Y = (14.0, 19.0, 17.0, 20.0)
This example shows a matrix, A, and an array, A, having the same number of rows. For this case, m and lda are equal. Because lda is 4 and n is 3, array A must be declared as A(E1:E2,F1:F2), where E2-E1+1=4 and F2-F1+1 >= 3. For this example, array A is declared as A(1:4,0:2).
M N ALPHA A LDA X INCX Y INCY | | | | | | | | | CALL SGEMX( 4 , 3 , 1.0 , A(1,0) , 4 , X , 1 , Y , 1 ) * * | 1.0 2.0 3.0 | A = | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | * * X = (3.0, 2.0, 1.0) Y = (4.0, 5.0, 2.0, 3.0)
Y = (14.0, 19.0, 17.0, 20.0)
This example shows a matrix, A, and an array, A, having the same number of rows. For this case, m and lda are equal. Because lda is 4 and n is 3, array A must be declared as A(E1:E2,F1:F2), where E2-E1+1=4 and F2-F1+1 >= 3. For this example, array A is declared as A(1:4,0:2).
M N ALPHA A LDA X INCX Y INCY | | | | | | | | | CALL SGEMTX( 4 , 3 , 1.0 , A(1,0) , 4 , X , 1 , Y , 1 ) * * | 1.0 2.0 3.0 | A = | 2.0 2.0 4.0 | | 3.0 2.0 2.0 | | 4.0 2.0 1.0 | * * X = (3.0, 2.0, 1.0, 4.0) Y = (1.0, 2.0, 3.0)
Y = (27.0, 22.0, 26.0)
This example shows a computation in which alpha is greater than 1. Array A must follow the same rules as given in Example 10. For this example, array A is declared as A(-1:2,1:3).
M N ALPHA A LDA X INCX Y INCY | | | | | | | | | CALL SGEMTX( 4 , 3 , 2.0 , A(-1,1) , 4 , X , 1 , Y , 1 )
Y = (53.0, 42.0, 49.0)