?spmv
Compute the product of a vector and a packed symmetric matrix, that is,
.
Where alpha and beta are scaling coefficients, x and y are vectors including n elements, and A is an n-order compression symmetric matrix.
Interface Definition
C interface:
void cblas_sspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const float alpha, const float *Ap, const float *X, const BLASINT incX, const float beta, float *Y, const BLASINT incY);
void cblas_dspmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo, const BLASINT N, const double alpha, const double *Ap, const double *X, const BLASINT incX, const double beta, double *Y, const BLASINT incY);
Fortran interface:
CALL SSPMV(UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY)
CALL DSPMV(UPLO, N, ALPHA, AP, 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 |
Storage expansion mode of matrix A (upper triangle or lower triangle)
|
Input |
N |
Integer |
Order of the matrix A. N must be greater than or equal to zero. |
Input |
alpha |
|
Multiplication coefficient |
Input |
Ap |
|
The size of a compressed symmetric matrix is at least (n*(n+1)/2). |
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;
float alpha = 1.0, beta = 1.0;
int incx = 1, incy = 1;
/*
* A = | 2.0 1.0 3.0 |
* | 1.0 6.0 9.0 |
* | 3.0 9.0 2.0 |
*/
float a[6] = {2.0, 1.0, 3.0, 6.0, 9.0, 2.0};
float x[3] = {1.0, 1.0, 1.0};
float y[3] = {3.0, 2.0, 2.0};
cblas_sspmv(CblasColMajor,CblasLower, n, alpha, a, x, incx, beta, y, incy);
/*
* Output y = |9.0, 18.0, 16.0|
*/
Fortran interface:
INTEGER :: N=3
REAL(4) :: ALPHA=2.0
REAL(4) :: BETA=1.0
REAL(4) :: A(6), X(3), Y(3)
DATA A/2.0, 1.0, 3.0, 6.0, 9.0, 2.0/
DATA X/1.0, 1.0, 1.0/
DATA Y/3.0, 2.0, 2.0/
EXTERNAL SSPMV
CALL SSPMV('L', N, ALPHA, A, X, INCX, BETA, Y, INCY)
* Output Y = |9.0, 18.0, 16.0|