Rate This Document
Findability
Accuracy
Completeness
Readability

?symv

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

Where alpha and beta are multiplication coefficients, x and y are vectors including n elements, and A is a symmetric matrix including n*n.

Interface Definition

C interface:

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

CALL DSYMV(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 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

alpha

  • For ssymv, alpha is of single-precision floating-point type.
  • For dsymv, alpha is of double-precision floating-point type.

Coefficient

Input

A

  • For ssymv, A is of single-precision floating-point type.
  • For dsymv, A is of double-precision floating-point type.

Symmetric matrix A(lda, n)

Input

lda

Integer

Leading dimension of matrix A. The value of lda must be greater than or equal to max(1, n).

Input

X

  • For ssymv, X is of single-precision floating-point type.
  • For dsymv, 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 ssymv, beta is of single-precision floating-point type.
  • For dsymv, beta is of double-precision floating-point type.

Multiplication coefficient

Input

Y

  • For ssymv, Y is of single-precision floating-point type.
  • For dsymv, 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 = 3, lda = 3; 
    float alpha = 1.0, beta = 1.0; 
    int incx = 1, incy = 1; 
    /* 
     * A =  | 0.0   *    *  | 
     *      | 2.0  3.0   *  | 
     *      | 0.0  4.0  1.0 | 
     */ 
    float a[9] = {0, 2.0, 0, 0, 3.0, 4.0, 0, 0, 1.0}; 
    float x[3] = {5.0, 2.0, 1.0}; 
    float y[3] = {1.0, 1.0, 3.0}; 
 
    cblas_ssymv(CblasColMajor,CblasLower, n, alpha, a, lda, x, incx, beta, y, incy); 
    /* 
     * Output y: 5.000000, 21.000000, 12.000000 
     */

Fortran interface:

      INTEGER :: N=3, LDA=3 
      REAL(4) :: ALPHA=1.0, BETA=1.0 
      INTEGER :: INCX=1, INCY=1 
      REAL(4) :: A(9), X(3), Y(3) 
      DATA A/0, 2.0, 0, 0, 3.0, 4.0, 0, 0, 1.0/ 
      DATA X/5.0, 2.0, 1.0/ 
      DATA Y/1.0, 1.0, 3.0/ 
      EXTERNAL SSYMV 
      CALL SSYMV('L', N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY) 
 
*     Output Y: 5.000000, 21.000000, 12.000000