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

?hemv

Compute the product of a vector and a Hermitian matrix, that is, .

alpha and beta are multiplication coefficients, x and y are vectors including n elements, and A is an n-order Hermitian matrix.

Interface Definition

C interface:

void cblas_chemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, 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_zhemv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, 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 CHEMV(UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)

CALL ZHEMV(UPLO, N, 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 the upper triangle or the lower triangle of matrix A is used.

  • 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

alpha

  • For chemv, alpha is of single-precision complex number type.
  • For zhemv, alpha is of double-precision complex number type.

Coefficient

Input

A

  • For chemv, A is of single-precision complex number type.
  • For zhemv, A is of double-precision complex number type.

Hermitian matrix A(lda, n)

Input

lda

Integer

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

Input

X

  • For chemv, X is of single-precision complex number type.
  • For zhemv, X is of double-precision complex number 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 chemv, beta is of single-precision complex number type.
  • For zhemv, beta is of double-precision complex number type.

Multiplication coefficient

Input

Y

  • For chemv, Y is of single-precision complex number type.
  • For zhemv, Y is of double-precision complex number 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 = 3, lda = 3; 
    float alpha[2] = {1.0, 0}, beta[2] = {1.0, 0}; 
    int incx = 1, incy = 1; 
    /*            |  (21.0,  * )      *           *      | 
     *      A =   | (1.0, -1.0)  (3.0,  * )       *      | 
     *            |  (1.0, 3.0)  (2.0, 2.0)   (2.0, *  ) | 
     */ 
    float a[18] = {21.0, 0, 1.0, -1.0, 1.0, 3.0, 0, 0, 3.0, 0, 2.0, 2.0, 0, 0, 0, 0, 2.0, 0}; 
    float x[6] = {3.0, 2.0, 1.0, 2.0, -1.0, 1.0}; 
    float y[6] = {1.0, 2.0, 3.0, 2.0, -1.0, 1.0}; 
 
    cblas_chemv(CblasColMajor,CblasLower, n, alpha, a, lda, x, incx, beta, y, incy); 
    /* 
     * Output y = | 65.0, 51.0, 11.0, 11.0, -8.0, 20.0| 
     */

Fortran interface:

      INTEGER :: N=3 
      INTEGER :: LDA=3 
      COMPLEX(4) :: ALPHA=(1.0, 0) 
      COMPLEX(4) :: BETA=(1.0, 0) 
      INTEGER :: INCX=1 
      INTEGER :: INCY=1 
      COMPLEX(4) :: A(3, 3) 
      DATA A/(21.0, 0), (1.0, -1.0), (1.0, 3.0), 
     $       (0, 0), (3.0, 0), (2.0, 2.0), 
     $       (0, 0), (0, 0), (2.0, 0)/ 
 
      COMPLEX(4) :: X(3) 
      DATA X/(3.0, 2.0), (1.0, 2.0), (-1.0, 1.0)/ 
      COMPLEX(4) :: Y(3) 
      DATA Y/(1.0, 2.0), (3.0, 2.0), (-1.0, 1.0)/ 
      EXTERNAL CHEMV 
      CALL CHEMV('L', N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY) 
 
*     Output Y : (65.0, 51.0), (11.0, 11.0), (-8.0, 20.0)