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

Interface Definition
C interface:
void cblas_simatmul(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const float alpha, float *A, const BLASINT lda, float *BC, const BLASINT ldb);
void cblas_dimatmul(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const double alpha, double *A, const BLASINT lda, double *BC, const BLASINT ldb);
void cblas_cimatmul(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const float *alpha, float *A, const BLASINT lda, float *BC, const BLASINT ldb);
void cblas_zimatmul(const enum CBLAS_ORDER ordering, const enum CBLAS_TRANSPOSE TransA, const BLASINT m, const BLASINT n, const double *alpha, double *A, const BLASINT lda, double *BC, const BLASINT ldb);
Fortran interface:
CALL SIMATMUL(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
CALL DIMATMUL(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
CALL CIMATMUL(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
CALL ZIMATMUL(ORDER, TRANSA, M, N, ALPHA, A, LDA, BC, LDB)
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 |
M |
Integer |
Number of rows of matrices op(A) and BC. |
Input |
N |
Integer |
Number of columns of matrices op(A) and BC. |
Input |
alpha |
|
Multiplication coefficient. |
Input |
A |
|
Matrix A. |
Input |
lda |
Integer |
|
Input |
BC |
|
Matrix BC. |
Input |
ldb |
Integer |
|
Input |
Dependency
#include "kblas.h"
Examples
C interface:
int m = 4;
int n = 3;
int lda = 4;
int ldb = 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
* BC:
* 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 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 bc[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,
};
cblas_simatmul(CblasColMajor, CblasNoTrans, m, n, alpha, a, lda, bc, ldb);
/**
* Output BC:
* -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 IMATMUL
INTEGER :: M=4, N=3
INTEGER :: LDA=4, LDB=4
REAL(4) :: ALPHA=2.0
REAL(4) :: A(4, 3), BC(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 BC/0.274879, -0.184964, -0.331672,
-0.476422, 0.318246, 0.295214,
-0.067229, 0.314890, -0.072014,
-0.088924, -0.222191, -0.121713/
EXTERNAL SIMATMUL
CALL SIMATMUL('C', 'N', M, N, ALPHA, A, LDA, BC, LDB)
END
* Output BC:
* -0.219897, 0.078161, -0.150148,
* -0.055246, 0.118220, 0.009419,
* 0.024363, 0.058045, 0.018097,
* -0.036661, 0.196401, 0.074947