?omatcopy
矩阵out-place转置或复制的缩放,结果存储到另一地址空间。
即:。
op(X)可取值:,alpha为乘法系数,A为m*n矩阵。
接口定义
C interface:
void cblas_somatcopy(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const float alpha, const float *A, const BLASINT lda, float *B, const BLASINT ldb);
void cblas_domatcopy(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const double alpha, const double *A, const BLASINT lda, double *B, const BLASINT ldb);
void cblas_comatcopy(const enum CBLAS_ORDER sOrder, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const float *alpha, const float *A, const BLASINT lda, float *B, const BLASINT ldb);
void cblas_zomatcopy(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE Trans, const BLASINT M, const BLASINT N, const double *alpha, const double *A, const BLASINT lda, double *B, const BLASINT ldb);
Fortran interface:
CALL SOMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)
CALL DOMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)
CALL COMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)
CALL ZOMATCOPY(ORDER, TRANS, M, N, ALPHA, A, LDA, B, LDB)
参数
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
order |
枚举类型CBLAS_ORDER |
表示矩阵是行主序或列主序。 |
输入 |
Trans |
枚举类型CBLAS_TRANSPOSE |
矩阵A为常规矩阵,转置矩阵或共轭矩阵。
|
输入 |
M |
整型数 |
矩阵A的行。 |
输入 |
N |
整型数 |
矩阵A的列。 |
输入 |
alpha |
|
乘法系数。 |
输入 |
A |
|
矩阵A。 |
输入 |
lda |
整型数 |
|
输入 |
B |
|
矩阵B。 |
输出 |
ldb |
整型数 |
|
输入 |
依赖
#include "kblas.h"
示例
C interface:
int m = 4; int k = 3; int lda = 4; int ldb = 4; float alpha[2] = {1.0, 2.0}; /** * A: * 0.340188, -0.105617, -0.222225, 0.053970, 0.135712, 0.217297 * 0.283099, 0.298440, -0.022603, 0.128871, -0.358397, 0.106969 * 0.411647, -0.302449, -0.135216, 0.013401, -0.483699, -0.257113 * -0.164777, 0.268230, 0.452230, 0.416195, -0.362768, 0.304177 */ float a[24] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647, -0.302449, -0.164777, 0.268230, -0.222225, 0.053970, -0.022603, 0.128871, -0.135216, 0.013401, 0.452230, 0.416195, 0.135712, 0.217297, -0.358397, 0.109, -0.483699, -0.257113, -0.362768, 0.304177}; float b[24] = {0}; cblas_comatcopy(CblasColMajor, CblasNoTrans, m, k, alpha, a, lda, b, lda); /** * Output B: * 0.551422, 0.574759, -0.313781, 0.864638, 1.016545, 0.520845 * -0.701237, -0.061324, -0.330165, -0.390480, -0.280345, 0.083665 * -0.162018, -0.257031, -0.380160, 1.320655, -0.298882, 0.488721 * -0.576397, -0.607794, 0.030527, -1.224511, -0.971122, -0.421359 */
Fortran interface:
PROGRAM OMATCOPY INTEGER :: M=4, K=3 INTEGER :: LDA=4, LDB=4 COMPLEX(4) :: ALPHA=(1.0, 2.0) COMPLEX(4) :: A(4, 3), B(4, 3) DATA A/(0.340188, -0.105617), (0.283099, 0.298440), $ (0.411647, -0.302449), (-0.164777, 0.268230), $ (-0.222225, 0.053970), (-0.022603, 0.128871), $ (-0.135216, 0.013401), (0.452230, 0.416195), $ (0.135712, 0.217297), (-0.358397, 0.109), $ (-0.483699, -0.257113), (-0.362768, 0.304177)/ EXTERNAL COMATCOPY CALL COMATCOPY('C', 'N', M, K, ALPHA, A, LDA, B, LDB) END * Output B: * (0.551422000,0.574759007) (-0.313781023,0.864637971) (1.01654494,0.520844996) * (-0.701236963,-6.132400036E-02) (-0.330164999,-0.390479982) (-0.280344993,8.366499841E-02) * (-0.162018001,-0.257030994) (-0.380160004,1.32065499) (-0.298882008,0.488721013) * (-0.576397002,-0.607794046) (3.052702546E-02,-1.22451103) (-0.971121967,-0.421359003)