> 文档中心 > 29.cuBLAS开发指南中文版--cuBLAS中的Level-2函数tbsv()

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


2.6.12. cublastbsv()

在这里插入图片描述

cublasStatus_t cublasStbsv(cublasHandle_t handle, cublasFillMode_t uplo,      cublasOperation_t trans, cublasDiagType_t diag,      int n, int k, const float    *A, int lda,      float    *x, int incx)cublasStatus_t cublasDtbsv(cublasHandle_t handle, cublasFillMode_t uplo,      cublasOperation_t trans, cublasDiagType_t diag,      int n, int k, const double   *A, int lda,      double   *x, int incx)cublasStatus_t cublasCtbsv(cublasHandle_t handle, cublasFillMode_t uplo,      cublasOperation_t trans, cublasDiagType_t diag,      int n, int k, const cuComplex*A, int lda,      cuComplex*x, int incx)cublasStatus_t cublasZtbsv(cublasHandle_t handle, cublasFillMode_t uplo,      cublasOperation_t trans, cublasDiagType_t diag,      int n, int k, const cuDoubleComplex *A, int lda,      cuDoubleComplex *x, int incx)

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

$op(A)x = b $

其中 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 逐列存储,矩阵的主对角线存储在第 1 行,第 2 行的第一个下对角线(从第一个位置开始),第 3 行的第二个下对角线(开始 在第一个位置)等。因此,一般来说,元素 A(i,j) 存储在内存位置 A(1+i-j,j) 中, 其中i=1,…,n 和 i ∈ [ j , m i n ( m , j + k ) ] i \in[j,min(m,j+k)] i[j,min(m,j+k)] 。 此外,在概念上不对应于带状矩阵(右下角 k*k 三角形)中的元素的数组 A 中的元素不被引用。

如果 uplo == CUBLAS_FILL_MODE_UPPER 则三角形带状矩阵 A 逐列存储,矩阵的主对角线存储在第 k+1 行,第 k 行的第一个下对角线(从第一个位置开始),第 k-1 行的第二个下对角线(开始 在第一个位置)等。因此,一般来说,元素 A(1+k+i-j,j) 存储在内存位置 A(1+i-j,j) 中 i=1,…,n 和 i ∈ [ m a x ( 1 , j − k ) , j ] i \in[max(1,j-k),j] i[max(1,jk),j] 。 此外,在概念上不对应于带状矩阵(右下角 k*k 三角形)中的元素的数组 A 中的元素不被引用。

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 .
A device input array of dimension lda x n with lda>=max(1,n).
lda input leading dimension of two-dimensional array used to store matrix A.
x device input vector with n elements.
incx input stride between consecutive elements of x.

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

ErrorValue Meaning
CUBLAS_STATUS_SUCCESS 操作成功完成
CUBLAS_STATUS_NOT_INITIALIZED 库未初始化
CUBLAS_STATUS_INVALID_VALUE 参数 m,n<0 或 incx,incy=0
CUBLAS_STATUS_EXECUTION_FAILED 该功能无法在 GPU 上启动

请参考:

stbsv, dtbsv, ctbsv, ztbsv