BLAS
BLAS
- MKL 中的 BLAS,参考 MKL - BLAS
- 标准的 BLAS 参考 netlib - BLAS
BLAS 的命名规则
BLAS 中的函数名一般规则是 <character><name><mode> ()
-
<character>指明数据类型-
sreal, single precision -
ccomplex, single precision -
dreal, double precision -
zcomplex, double precision
-
-
<name>指明矩阵类型 BLAS 2 and 3-
gegeneral matrix -
gbgeneral band matrix -
sysymmetric matrix -
spsymmetric matrix (packed storage) -
sbsymmetric band matrix -
hehermitian matrix -
hphermitian matrix (packed storage) -
hbhermitian band matrix -
trtriangular matrix -
tptriangular matrix (packed storage) -
tbtriangular band matrix
-
-
<mod>指明操作的细节-
cconjugated vector -
uunconjugated vector -
gGivens rotation construction -
mmodified Givens rotation -
mgmodified Givens rotation construction -
mvmatrix-vector product -
svsolving a system of linear equations with a single unknown vector -
rrank-1 update of matrix -
r2rank-2 update of matrix -
mmmatrix-matrix product -
smsolving a system of linear equations with multiple unkonwn vectors -
rkrank-k update of matrix -
r2krank-2k update of a matrix
-
CBLAS 约定
CBLAS 是 BLAS 的 c 接口, BLAS 是 fortran 标准。
CBLAS 函数都遵循以下约定
- 输入参数是
const指针 - 非复数标量输入参数传值
- 复标量参数传
void指针 - 数组参数传地址
- BLAS 特征参数由适当的枚举类型代替
- level 2 和 level 3 需要一个额外的
CBLAS_LAYOUT类型的参数来指定矩阵是行优先CblasRowMajor还是列优先CblasColMajor
枚举类型
enum CBLAS_LAYOUT {
CblasRowMajor=101, /* row-major arrays */
CblasColMajor=102}; /* column-major arrays */
enum CBLAS_TRANSPOSE {
CblasNoTrans=111, /* trans='N' */
CblasTrans=112, /* trans='T' */
CblasConjTrans=113}; /* trans='C' */
enum CBLAS_UPLO {
CblasUpper=121, /* uplo ='U' */
CblasLower=122}; /* uplo ='L' */
enum CBLAS_DIAG {
CblasNonUnit=131, /* diag ='N' */
CblasUnit=132}; /* diag ='U' */
enum CBLAS_SIDE {
CblasLeft=141, /* side ='L' */
CblasRight=142}; /* side ='R' */
矩阵存储方式
- 完全存储矩阵 \(A_{ij}_{}\) 在二维数组列存储
a[i + j*lda]行存储a[i*lda + j] - packed storage 可以用更有效的方式存储矩阵
评论
Comments powered by Disqus