?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.
|
Input |
N |
Integer |
Order of the matrix A. N must be greater than or equal to zero. |
Input |
alpha |
|
Coefficient |
Input |
A |
|
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 |
|
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 |
|
Multiplication coefficient |
Input |
Y |
|
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