?gbmv
Compute the product of a vector and a band matrix.
That is,
,
, or
.
For the Fortran interface,
,
, or
.
alpha and beta are multiplication coefficients, x and y are vectors, and A is a band matrix of m*n.
Interface Definition
C interface:
void cblas_sgbmv(const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const BLASINT M, const BLASINT N, const BLASINT KL, const BLASINT KU, const float alpha, const float *A, const BLASINT lda, const float *X, const BLASINT incX, const float beta, float *Y, const BLASINT incY);
void cblas_dgbmv(const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const BLASINT M, const BLASINT N, const BLASINT KL, const BLASINT KU, const double alpha, const double *A, const BLASINT lda, const double *X, const BLASINT incX, const double beta, double *Y, const BLASINT incY);
void cblas_cgbmv(const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const BLASINT M, const BLASINT N, const BLASINT KL, const BLASINT KU, const void *alpha, const void *A, const BLASINT lda, const void *X, const BLASINT incX, const void *beta, void *Y, const BLASINT incY);
void cblas_zgbmv(const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const BLASINT M, const BLASINT N, const BLASINT KL, const BLASINT KU, const void *alpha, const void *A, const BLASINT lda, const void *X, const BLASINT incX, const void *beta, void *Y, const BLASINT incY);
Fortran interface:
CALL SGBMV(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CALL DGBMV(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CALL CGBMV(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CALL ZGBMV(TRANS, M, N, KL, KU, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
order |
Enumeration type CBLAS_ORDER |
Indicates whether the matrix is in row- or column-major order. |
Input |
TransA |
Enumeration type CBLAS_TRANSPOSE |
Indicates whether matrix A is a conventional matrix, a transpose matrix, or a conjugate matrix.
For the Fortran interface: |
Input |
M |
Integer |
Number of rows in matrix A. The value of M must be greater than or equal to 0. |
Input |
N |
Integer |
Number of columns of matrix A. The value of N must be greater than or equal to 0. |
Input |
KL |
Integer |
Subdiagonal order of A. The value of KL must be greater than or equal to 0. |
Input |
KU |
Integer |
Hyperdiagonal order of A. The value of KU must be greater than or equal to 0. |
Input |
alpha |
|
Multiplication coefficient. |
Input |
A |
|
Band matrix. The matrix size is lda*N. |
Input |
lda |
Integer |
Length of the leading dimension in matrix A. The value of lda must be greater than or equal to (KL + KU + 1). |
Input |
X |
|
Vector X. If TransA = CblasNoTrans, the vector size is at least (1+(N-1)*abs(incX)). Otherwise, the vector size must be at least (1+(M-1)*abs(incX)). |
Input |
incX |
Integer |
Increment for elements in X. The value cannot be 0. |
Input |
beta |
|
Multiplication coefficient. |
Input |
Y |
|
Vector Y. If TransA = CblasNoTrans, the vector size is at least (1+(M-1)*abs(incY)). Otherwise, the vector size is at least (1+(N-1)*abs(incY)). |
Input/Output |
incY |
Integer |
Increment for elements in Y. The value cannot be 0. |
Input |
Dependency
#include "kblas.h"
Examples
C interface:
int m = 5, n = 4;
float alpha = 2.0;
/**
* | . . 2.0 2.0 |
* | . 1.0 2.0 3.0 |
* | 1.0 2.0 2.0 4.0 |
* A = | 1.0 3.0 2.0 5.0 |
* | 1.0 4.0 2.0 . |
* | 1.0 5.0 . . |
* | . . . . |
* | . . . . |
*/
float a[32] = {0, 0, 1.0, 1.0, 1.0, 1.0, 0, 0,
0, 1.0, 2.0, 3.0, 4.0, 5.0, 0, 0,
2.0, 2.0, 2.0, 2.0, 2.0, 0, 0, 0,
2.0, 3.0, 4.0, 5.0, 0, 0, 0, 0};
float x[4] = {2.0, 2.0, 3.0, 4.0};
float y[5] = {1.0, 1.0, 13.0, 4.0, 5.0};
cblas_sgbmv(CblasColMajor,CblasNoTrans, m, n, 3, 2, alpha, a, 8, x, 1, 10.0, y, 1);
/**
* Ouput y: 30.0, 50.0, 182.0, 104.0, 122.0
*/
Fortran interface:
INTEGER :: M=5
INTEGER :: N=4
REAL(4) :: ALPHA=2.0
REAL(4) A(8, 4)
DATA A /0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 2, 3, 4, 5, 0, 0,
2, 2, 2, 2, 2, 0, 0, 0, 2, 3, 4, 5, 0, 0, 0, 0/
REAL(4) X(4)
DATA X /2, 2, 3, 4/
REAL(4) Y(5)
DATA Y /1, 1, 13, 4, 5/
CALL SGBMV('N', M, N, 3, 2, ALPHA, A, 8, X, 1, 10, Y, 1)
* Ouput y: 20.0 40.0 52.0 64.0 72.0





