我要评分
获取效率
正确性
完整性
易理解

?sbmv

Compute the 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.

  • If Uplo = CblasUpper, the upper triangle of A is used.
  • If Uplo = CblasLower, the lower triangle of A is used.

Input

N

Integer

Order of the matrix A. N must be greater than or equal to zero.

Input

K

Integer

Super diagonal order of the matrix A. K must be greater than or equal to zero.

Input

alpha

  • For ssbmv, alpha is of single-precision floating-point type.
  • For dsbmv, alpha is of double-precision floating-point type.

Multiplication coefficient

Input

A

  • For ssbmv, A is of single-precision floating-point type.
  • For dsbmv, A is of double-precision floating-point type.

Symmetric band-shaped matrix. The matrix scale is lda*n.

Input

lda

Integer

Leading dimension of matrix A. The value of lda must be greater than or equal to (k + 1).

Input

X

  • For ssbmv, X is of single-precision floating-point type.
  • For dsbmv, X is of double-precision floating-point type.

Vector X. The vector scale is at least (1+(N-1)*abs(incX)).

Input

incX

Integer

Increment for elements in X. The value cannot be 0.

Input

beta

  • For ssbmv, beta is of single-precision floating-point type.
  • For dsbmv, beta is of double-precision floating-point type.

Multiplication coefficient

Input

Y

  • For ssbmv, Y is of single-precision floating-point type.
  • For dsbmv, Y is of double-precision floating-point type.

Vector Y. The vector scale is at least (1+(N-1)*abs(incY)).

Input/Output

incY

Integer

Increment for elements 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|