cublasgemv()
cublasStatus_t cublasSgemv(cublasHandle_t handle, cublasOperation_t trans,
int m, int n,
const float *alpha,
const float *A, int lda,
const float *x, int incx,
const float *beta,
float *y, int incy)
cublasStatus_t cublasDgemv(cublasHandle_t handle, cublasOperation_t trans,
int m, int n,
const double *alpha,
const double *A, int lda,
const double *x, int incx,
const double *beta,
double *y, int incy)
cublasStatus_t cublasCgemv(cublasHandle_t handle, cublasOperation_t trans,
int m, int n,
const cuComplex *alpha,
const cuComplex *A, int lda,
const cuComplex *x, int incx,
const cuComplex *beta,
cuComplex *y, int incy)
cublasStatus_t cublasZgemv(cublasHandle_t handle, cublasOperation_t trans,
int m, int n,
const cuDoubleComplex *alpha,
const cuDoubleComplex *A, int lda,
const cuDoubleComplex *x, int incx,
const cuDoubleComplex *beta,
cuDoubleComplex *y, int incy)
此函数执行矩阵向量乘法
y = α o p ( A ) x + β y y=\alpha op(A)x + \beta y y=αop(A)x+βy
其中 A 是以列优先格式存储的 m*n 矩阵,x 和 y 是向量, α \alpha α 和 β \beta β 是标量。 此外,对于矩阵 A:
o
p
(
A
)
=
{
A
如果
t
r
a
n
s
a
=
=
C
U
B
L
A
S
O
P
N
,
A
T
如果
t
r
a
n
s
a
=
=
C
U
B
L
A
S
O
P
T
,
A
H
如果
t
r
a
n
s
a
=
=
C
U
B
L
A
S
O
P
H
op(A)= {A 如果transa==CUBLASOPN,AT 如果transa==CUBLASOPT,AH 如果transa==CUBLASOPH
Param. | Memory | In/out | Meaning |
---|---|---|---|
handle | input | handle to the cuBLAS library context. | |
trans | input | operation op(A) that is non- or (conj.) transpose. | |
m | input | number of rows of matrix A. | |
n | input | number of columns of matrix A. | |
kl | input | number of subdiagonals of matrix A. | |
ku | input | number of superdiagonals of matrix A. | |
alpha | host or device | input | scalar used for multiplication. |
A | device | input | array of dimension lda x n with lda>=kl+ku+1. |
lda | input | leading dimension of two-dimensional array used to store matrix A. | |
x | device | input | vector with n elements if transa == CUBLAS_OP_N and m elements otherwise. |
incx | input | stride between consecutive elements of x. | |
beta | host or device | input | scalar used for multiplication, if beta == 0 then y does not have to be a valid input. |
y | device | in/out | vector at least (1+(m-1)*abs(incy)) elements if transa==CUBLAS_OP_N and at least (1+(n-1)*abs(incy)) elements otherwise. |
incy | input | stride between consecutive elements of y. |
该函数可能返回的错误值及其含义如下所列。
ErrorValue | Meaning |
---|---|
CUBLAS_STATUS_SUCCESS | 操作成功完成 |
CUBLAS_STATUS_NOT_INITIALIZED | 库未初始化 |
CUBLAS_STATUS_INVALID_VALUE | 参数 m,n<0 或 incx,incy=0 |
CUBLAS_STATUS_EXECUTION_FAILED | 该功能无法在 GPU 上启动 |