?omatdiv
矩阵缩放后out-place除计算。
即。
op可取值:。
接口定义
C interface:
void cblas_somatdiv(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const float alpha, float *A, const BLASINT lda, float *B, const BLASINT ldb, float *C, const BLASINT ldc);
void cblas_domatdiv(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const double alpha, double *A, const BLASINT lda, double *B, const BLASINT ldb, double *C, const BLASINT ldc);
void cblas_comatdiv(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const float *alpha, float *A, const BLASINT lda, float *B, const BLASINT ldb, float *C, const BLASINT ldc);
void cblas_zomatdiv(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const BLASINT m, const BLASINT n, const double *alpha, double *A, const BLASINT lda, double *B, const BLASINT ldb, double *C, const BLASINT ldc);
Fortran interface:
CALL SOMATDIV(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
CALL DOMATDIV(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
CALL COMATDIV(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
CALL ZOMATDIV(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
order |
枚举类型CBLAS_ORDER |
表示矩阵是行主序或列主序。 |
输入 |
TransA |
枚举类型CBLAS_TRANSPOSE |
矩阵A为常规矩阵,转置矩阵或共轭矩阵。
|
输入 |
TransB |
枚举类型CBLAS_TRANSPOSE |
矩阵B为常规矩阵,转置矩阵或共轭矩阵。
|
输入 |
M |
整型数 |
矩阵op(A)、op(B)、C的行。 |
输入 |
N |
整型数 |
矩阵op(A)、op(B)、C的列。 |
输入 |
alpha |
|
表示乘法系数。 |
输入 |
A |
|
矩阵A。 |
输入 |
lda |
整型数 |
|
输入 |
B |
|
矩阵B。 |
输入 |
ldb |
整型数 |
|
输入 |
C |
|
矩阵C。 |
输出 |
ldc |
整型数 |
矩阵为列存,ldc至少max(1, m),否则max(1, n)。 |
输入 |
依赖
#include "kblas.h"
示例
C interface:
int m = 4; int n = 3; int lda = 4; int ldb = 4; int ldc = 4; float alpha = 2.0; /** * A: * 0.645728, 0.664078, 0.775762, * 0.806953, 0.601041, 0.714864, * 0.915711, 0.803360, 0.562129, * 0.522928, 0.647835, 0.824213 * B: * 0.718160, 0.604610, 0.991237, * 0.676218, 0.818167, 0.722511, * 0.539246, 0.880499, 0.814675, * 0.543172, 0.862320, 0.731872 * C: * 0, 0, 0, * 0, 0, 0, * 0, 0, 0, * 0, 0, 0 */ float a[12] = {0.645728, 0.664078, 0.775762, 0.806953, 0.601041, 0.714864, 0.915711, 0.803360, 0.562129, 0.522928, 0.647835, 0.824213 }; float b[12] = {0.718160, 0.604610, 0.991237, 0.676218, 0.818167, 0.722511, 0.539246, 0.880499, 0.814675, 0.543172, 0.862320, 0.731872 }; float c[12] = {0}; cblas_somatdiv(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, alpha, a, lda, b, ldb, c, ldc); /** * Output C: * 1.798285, 2.196716, 1.565241, * 2.386664, 1.469238, 1.978835, * 3.396264, 1.824785, 1.380008, * 1.925460, 1.502539, 2.252343 */
Fortran interface:
PROGRAM OMATDIV INTEGER :: M=4, N=3 INTEGER :: LDA=4, LDB=4, LDC=4 REAL(4) :: ALPHA=2.0 REAL(4) :: A(4, 3), B(4, 3), C(4, 3) DATA A/0.645728, 0.664078, 0.775762, 0.806953, 0.601041, 0.714864, 0.915711, 0.803360, 0.562129, 0.522928, 0.647835, 0.824213/ DATA B/0.718160, 0.604610, 0.991237, 0.676218, 0.818167, 0.722511, 0.539246, 0.880499, 0.814675, 0.543172, 0.862320, 0.731872/ DATA C/0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0/ EXTERNAL SOMATDIV CALL SOMATDIV('C', 'N', 'N', M, N, ALPHA, A, LDA, B, LDB, C, LDC) END * Output C: * 1.798285, 2.196716, 1.565241, * 2.386664, 1.469238, 1.978835, * 3.396264, 1.824785, 1.380008, * 1.925460, 1.502539, 2.252343