20.cuBLAS开发指南中文版--cuBLAS中的Level-2函数ger()

发布于:2023-01-17 ⋅ 阅读:(417) ⋅ 点赞:(0)

2.6.3. cublas<t>ger()

在这里插入图片描述

cublasStatus_t  cublasSger(cublasHandle_t handle, int m, int n,
                           const float           *alpha,
                           const float           *x, int incx,
                           const float           *y, int incy,
                           float           *A, int lda)
cublasStatus_t  cublasDger(cublasHandle_t handle, int m, int n,
                           const double          *alpha,
                           const double          *x, int incx,
                           const double          *y, int incy,
                           double          *A, int lda)
cublasStatus_t cublasCgeru(cublasHandle_t handle, int m, int n,
                           const cuComplex       *alpha,
                           const cuComplex       *x, int incx,
                           const cuComplex       *y, int incy,
                           cuComplex       *A, int lda)
cublasStatus_t cublasCgerc(cublasHandle_t handle, int m, int n,
                           const cuComplex       *alpha,
                           const cuComplex       *x, int incx,
                           const cuComplex       *y, int incy,
                           cuComplex       *A, int lda)
cublasStatus_t cublasZgeru(cublasHandle_t handle, int m, int n,
                           const cuDoubleComplex *alpha,
                           const cuDoubleComplex *x, int incx,
                           const cuDoubleComplex *y, int incy,
                           cuDoubleComplex *A, int lda)
cublasStatus_t cublasZgerc(cublasHandle_t handle, int m, int n,
                           const cuDoubleComplex *alpha,
                           const cuDoubleComplex *x, int incx,
                           const cuDoubleComplex *y, int incy,
                           cuDoubleComplex *A, int lda)

此函数执行 rank-1 更新

y = α o p ( A ) x + β y y=\alpha op(A)x + \beta y y=αop(A)x+βy

A = { α x y T + A   如果 g e r ( ) , g e r u ( ) 被调用 α x y H + A   如果 g e r c ( ) 被调用 A= \begin{cases} \alpha xy^T+A \ \ 如果ger(),geru()被调用\\ \alpha xy^H+A \ \ 如果 gerc()被调用 \end{cases} A={αxyT+A  如果ger(),geru()被调用αxyH+A  如果gerc()被调用

其中 A 是以列优先格式存储的 m*n 矩阵,x 和 y 是向量, α \alpha α是标量。

Param. Memory In/out Meaning
handle input handle to the cuBLAS library context.
m input number of rows of matrix A.
n input number of columns of matrix A.
alpha host or device input <type> scalar used for multiplication.
A device input <type> array of dimension lda x n with lda >= max(1,m).
lda input leading dimension of two-dimensional array used to store matrix A.
x device input <type> vector with n elements if transa == CUBLAS_OP_N and m elements otherwise.
incx input stride between consecutive elements of x.
y device in/out <type> 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 上启动

请参考:
sger, dger, cgeru, cgerc, zgeru, zgerc


网站公告

今日签到

点亮在社区的每一天
去签到