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

2.6.13. cublas<t>tpmv()

在这里插入图片描述

cublasStatus_t cublasStpmv(cublasHandle_t handle, cublasFillMode_t uplo,
                           cublasOperation_t trans, cublasDiagType_t diag,
                           int n, const float           *AP,
                           float           *x, int incx)
cublasStatus_t cublasDtpmv(cublasHandle_t handle, cublasFillMode_t uplo,
                           cublasOperation_t trans, cublasDiagType_t diag,
                           int n, const double          *AP,
                           double          *x, int incx)
cublasStatus_t cublasCtpmv(cublasHandle_t handle, cublasFillMode_t uplo,
                           cublasOperation_t trans, cublasDiagType_t diag,
                           int n, const cuComplex       *AP,
                           cuComplex       *x, int incx)
cublasStatus_t cublasZtpmv(cublasHandle_t handle, cublasFillMode_t uplo,
                           cublasOperation_t trans, cublasDiagType_t diag,
                           int n, const cuDoubleComplex *AP,
                           cuDoubleComplex *x, int incx)

此函数执行三角带状矩阵向量乘法

$x = op(A)x $

其中 A 是三角带状矩阵,x 是向量。 此外,对于矩阵 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)= \begin{cases} A\ \ \ \ 如果 transa == CUBLAS\_OP\_N,\\ A^T \ \ 如果 transa == CUBLAS\_OP\_T,\\ A^H \ \ 如果 transa == CUBLAS\_OP\_H \end{cases} op(A)= A    如果transa==CUBLAS_OP_N,AT  如果transa==CUBLAS_OP_T,AH  如果transa==CUBLAS_OP_H

解决方案 x 在退出时覆盖右侧的 b。

此函数中不包含对奇点或接近奇点的测试。

如果 uplo == CUBLAS_FILL_MODE_LOWER 则将三角矩阵下三角部分的元素 A(i, j) 逐列无间隙地打包在一起,从而将元素存储在内存位置 AP[i+((2*n -j+1)*j)/2] 对于 j=1 , …,n 和 i>=j 。 因此,打包格式只需要 n ( n + 1 ) 2 \frac{n(n+1)}{2} 2n(n+1) 个元素进行存储。

如果 uplo == CUBLAS_FILL_MODE_UPPER 则将三角矩阵下三角部分的元素 A(i, j) 逐列无间隙地打包在一起,从而将元素存储在内存位置 AP[i+(j*(j+1))/2] 对于 j=1 , …,n 和 i<=j 。 因此,打包格式只需要 n ( n + 1 ) 2 \frac{n(n+1)}{2} 2n(n+1) 个元素进行存储。

Param. Memory In/out Meaning
handle input handle to the cuBLAS library context.
uplo input indicates if matrix A lower or upper part is stored, the other symmetric part is not referenced and is inferred from the stored elements.
trans input operation op(A) that is non- or (conj.) transpose.
diag input indicates if the elements on the main diagonal of matrix A are unity and should not be accessed.
n input number of rows and columns of matrix A.
k input number of sub- and super-diagonals of matrix .
AP device input <type> array with A stored in packed format.
lda input leading dimension of two-dimensional array used to store matrix A.
x device input <type> vector with n elements.
incx input stride between consecutive elements of x.

该函数可能返回的错误值及其含义如下所列。

ErrorValue Meaning
CUBLAS_STATUS_SUCCESS 操作成功完成
CUBLAS_STATUS_NOT_INITIALIZED 库未初始化
CUBLAS_STATUS_ALLOC_FAILED 内部暂存内存分配失败
CUBLAS_STATUS_EXECUTION_FAILED 该功能无法在 GPU 上启动

请参考:

stpmv, dtpmv, ctpmv, ztpmv

猜你喜欢

转载自blog.csdn.net/kunhe0512/article/details/126635543