?omatmul
Perform scaling and multiplication of two matrices including their out-of-place transposition/copying.
That is,
.

Interface Definition
C interface:
void cblas_somatmul(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_domatmul(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_comatmul(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_zomatmul(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 SOMATMUL(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
CALL DOMATMUL(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
CALL COMATMUL(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
CALL ZOMATMUL(ORDER, TRANSA, TRANSB, M, N, ALPHA, A, LDA, B, LDB, C, LDC)
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
order |
Enumeration type CBLAS_ORDER |
Indicates whether the matrix is in row- or column-major order. |
Input |
TransA |
Enumeration type CBLAS_TRANSPOSE |
Indicates whether matrix A is a conventional matrix, a transpose matrix, or a conjugate matrix.
|
Input |
TransB |
Enumeration type CBLAS_TRANSPOSE |
Indicates whether matrix B is a conventional matrix, a transpose matrix, or a conjugate matrix.
|
Input |
M |
Integer |
Number of rows of matrices op (A), op (B), and C. |
Input |
N |
Integer |
Number of columns of matrices op (A), op (B), and C. |
Input |
alpha |
|
Multiplication coefficient. |
Input |
A |
|
Matrix A. |
Input |
lda |
Integer |
|
Input |
B |
|
Matrix B. |
Input |
ldb |
Integer |
|
Input |
C |
|
Matrix C. |
Output |
ldc |
Integer |
If the matrix is column store, ldc must be at least max(1, m). Otherwise, ldc must be at least max(1, n). |
Input |
Dependency
#include "kblas.h"
Examples
C interface:
int m = 4;
int n = 3;
int lda = 4;
int ldb = 4;
int ldc = 4;
float alpha = 2.0;
/**
* A:
* -0.399988, -0.211286, 0.226351,
* 0.057980, 0.185737, 0.015954,
* -0.181192, 0.092167, -0.125647,
* 0.206140, -0.441963, -0.307887
* B:
* 0.274879, -0.184964, -0.331672,
* -0.476422, 0.318246, 0.295214,
* -0.067229, 0.314890, -0.072014,
* -0.088924, -0.222191, -0.121713,
* C:
* 0, 0, 0,
* 0, 0, 0,
* 0, 0, 0,
* 0, 0, 0
*/
float a[12] = {-0.399988, -0.211286, 0.226351,
0.057980, 0.185737, 0.015954,
-0.181192, 0.092167, -0.125647,
0.206140, -0.441963, -0.307887
};
float b[12] = {0.274879, -0.184964, -0.331672,
-0.476422, 0.318246, 0.295214,
-0.067229, 0.314890, -0.072014,
-0.088924, -0.222191, -0.121713,
};
float c[12] = {0};
cblas_somatmul(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, alpha, a, lda, b, ldb, c, ldc);
/**
* Output C:
* -0.219897, 0.078161, -0.150148,
* -0.055246, 0.118220, 0.009419,
* 0.024363, 0.058045, 0.018097,
* -0.036661, 0.196401, 0.074947
*/
Fortran interface:
PROGRAM OMATMUL
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.399988, -0.211286, 0.226351,
0.057980, 0.185737, 0.015954,
-0.181192, 0.092167, -0.125647,
0.206140, -0.441963, -0.307887/
DATA B/0.274879, -0.184964, -0.331672,
-0.476422, 0.318246, 0.295214,
-0.067229, 0.314890, -0.072014,
-0.088924, -0.222191, -0.121713/
DATA C/0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0/
EXTERNAL SOMATMUL
CALL SOMATMUL('C', 'N', 'N', M, N, ALPHA, A, LDA, B, LDB, C, LDC)
END
* Output C:
* -0.219897, 0.078161, -0.150148,
* -0.055246, 0.118220, 0.009419,
* 0.024363, 0.058045, 0.018097,
* -0.036661, 0.196401, 0.074947