?sbmv
Product of a vector and a symmetric band matrix, that is,
.
Alpha and beta are multiplication coefficients, x and y are vectors including n elements, and A is an n x n symmetric band matrix.
Interface Definition
C interface:
void cblas_ssbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const BLASINT K, 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_dsbmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const BLASINT K, const double alpha, const double *A, const BLASINT lda, const double *X, const BLASINT incX, const double beta, double *Y, const BLASINT incY);
Fortran interface:
CALL SSBMV(UPLO, N, K, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
CALL DSBMV(UPLO, N, K, 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 |
Uplo |
Enumeration type CBLAS_UPLO |
Indicates whether to use the upper triangle or lower triangle of matrix A.
|
Input |
N |
Integer |
Order of the matrix A, and N is required to be greater than or equal to zero. |
Input |
K |
Integer |
Super diagonal order of the matrix A. K is required to be greater than or equal to zero. |
Input |
alpha |
|
Multiplication coefficient |
Input |
A |
|
Symmetric band-shaped matrix. The matrix scale is lda x n. |
Input |
lda |
Integer |
Leading dimension of matrix A. The value of lda must be greater than or equal to (k + 1). |
Input |
X |
|
Vector X. The vector scale is at least (1+(N-1)*abs(incX)). |
Input |
incX |
Integer |
Vector increase step in X. The value cannot be 0. |
Input |
beta |
|
Multiplication coefficient |
Input |
Y |
|
Vector Y. The vector scale is at least (1+(N-1)*abs(incY)). |
Input/Output |
incY |
Integer |
Vector increase step in Y. The value cannot be 0. |
Input |
Dependencies
#include "kblas.h"
Examples
C interface:
int n = 4, k = 2;
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 6.0 |
* | 1.0 5.0 2.0 2.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, 2.0, 0, 0,
2.0, 3.0, 4.0, 5.0, 6.0, 2.0, 0, 0};
float x[4] = {2.0, 2.0, 3.0, 4.0};
float y[4] = {1.0, 1.0, 13.0, 4.0};
cblas_ssbmv(CblasColMajor,CblasUpper, n, k, alpha, a, 8, x, 1, 1.0, y, 1);
/**
* Output y = |21.0, 41.0, 65.0, 62.0|
*/
Fortran interface:
INTEGER :: N=4, K=2
REAL(4) :: ALPHA=2.0
REAL(4) :: BETA=1.0
REAL(4) :: A(32)
DATA A/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, 2.0, 0, 0,
$ 2.0, 3.0, 4.0, 5.0, 6.0, 2.0, 0, 0/
REAL(4) :: X(4), Y(4)
DATA X/2.0, 2.0, 3.0, 4.0/
DATA Y/1.0, 1.0, 13.0, 4.0/
EXTERNAL SSBMV
CALL SSBMV('L', N, K, ALPHA, A, 8, X, 1, BETA, Y, 1)
* Output Y = |21.0, 41.0, 65.0, 62.0|